diff --git a/google-cloud-bom/pom.xml b/google-cloud-bom/pom.xml index 120ff58291b0..16706fba7c3d 100644 --- a/google-cloud-bom/pom.xml +++ b/google-cloud-bom/pom.xml @@ -152,6 +152,12 @@ gax 1.27.0 + + com.google.api + gax + 1.27.0 + testlib + com.google.api gax-grpc diff --git a/google-cloud-clients/google-cloud-compute/pom.xml b/google-cloud-clients/google-cloud-compute/pom.xml index b8d84bce2e84..8de54f648c2d 100644 --- a/google-cloud-clients/google-cloud-compute/pom.xml +++ b/google-cloud-clients/google-cloud-compute/pom.xml @@ -58,5 +58,17 @@ objenesis test + + com.google.api + gax-httpjson + testlib + test + + + com.google.api + gax + testlib + test + diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AbandonInstancesInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AbandonInstancesInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..5b3df3ee8132 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AbandonInstancesInstanceGroupManagerHttpRequest.java @@ -0,0 +1,461 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AbandonInstancesInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final InstanceGroupManagersAbandonInstancesRequest + instanceGroupManagersAbandonInstancesRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private AbandonInstancesInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.instanceGroupManagersAbandonInstancesRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private AbandonInstancesInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + InstanceGroupManagersAbandonInstancesRequest + instanceGroupManagersAbandonInstancesRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.instanceGroupManagersAbandonInstancesRequestResource = + instanceGroupManagersAbandonInstancesRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("instanceGroupManagersAbandonInstancesRequestResource")) { + return instanceGroupManagersAbandonInstancesRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceGroupManagersAbandonInstancesRequest getApiMessageRequestBody() { + return instanceGroupManagersAbandonInstancesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public InstanceGroupManagersAbandonInstancesRequest + getInstanceGroupManagersAbandonInstancesRequestResource() { + return instanceGroupManagersAbandonInstancesRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AbandonInstancesInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AbandonInstancesInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AbandonInstancesInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AbandonInstancesInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private InstanceGroupManagersAbandonInstancesRequest + instanceGroupManagersAbandonInstancesRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AbandonInstancesInstanceGroupManagerHttpRequest other) { + if (other == AbandonInstancesInstanceGroupManagerHttpRequest.getDefaultInstance()) + return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getInstanceGroupManagersAbandonInstancesRequestResource() != null) { + this.instanceGroupManagersAbandonInstancesRequestResource = + other.instanceGroupManagersAbandonInstancesRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AbandonInstancesInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.instanceGroupManagersAbandonInstancesRequestResource = + source.instanceGroupManagersAbandonInstancesRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public InstanceGroupManagersAbandonInstancesRequest + getInstanceGroupManagersAbandonInstancesRequestResource() { + return instanceGroupManagersAbandonInstancesRequestResource; + } + + public Builder setInstanceGroupManagersAbandonInstancesRequestResource( + InstanceGroupManagersAbandonInstancesRequest + instanceGroupManagersAbandonInstancesRequestResource) { + this.instanceGroupManagersAbandonInstancesRequestResource = + instanceGroupManagersAbandonInstancesRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AbandonInstancesInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AbandonInstancesInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + instanceGroupManagersAbandonInstancesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setInstanceGroupManagersAbandonInstancesRequestResource( + this.instanceGroupManagersAbandonInstancesRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AbandonInstancesInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "instanceGroupManagersAbandonInstancesRequestResource=" + + instanceGroupManagersAbandonInstancesRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AbandonInstancesInstanceGroupManagerHttpRequest) { + AbandonInstancesInstanceGroupManagerHttpRequest that = + (AbandonInstancesInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals( + this.instanceGroupManagersAbandonInstancesRequestResource, + that.getInstanceGroupManagersAbandonInstancesRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + instanceGroupManagersAbandonInstancesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AbandonInstancesRegionInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AbandonInstancesRegionInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..8a1b6a30beb0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AbandonInstancesRegionInstanceGroupManagerHttpRequest.java @@ -0,0 +1,462 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AbandonInstancesRegionInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final RegionInstanceGroupManagersAbandonInstancesRequest + regionInstanceGroupManagersAbandonInstancesRequestResource; + private final String requestId; + private final String userIp; + + private AbandonInstancesRegionInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.regionInstanceGroupManagersAbandonInstancesRequestResource = null; + this.requestId = null; + this.userIp = null; + } + + private AbandonInstancesRegionInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + String key, + String prettyPrint, + String quotaUser, + RegionInstanceGroupManagersAbandonInstancesRequest + regionInstanceGroupManagersAbandonInstancesRequestResource, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.regionInstanceGroupManagersAbandonInstancesRequestResource = + regionInstanceGroupManagersAbandonInstancesRequestResource; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("regionInstanceGroupManagersAbandonInstancesRequestResource")) { + return regionInstanceGroupManagersAbandonInstancesRequestResource; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public RegionInstanceGroupManagersAbandonInstancesRequest getApiMessageRequestBody() { + return regionInstanceGroupManagersAbandonInstancesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public RegionInstanceGroupManagersAbandonInstancesRequest + getRegionInstanceGroupManagersAbandonInstancesRequestResource() { + return regionInstanceGroupManagersAbandonInstancesRequestResource; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + AbandonInstancesRegionInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AbandonInstancesRegionInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AbandonInstancesRegionInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AbandonInstancesRegionInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private String key; + private String prettyPrint; + private String quotaUser; + private RegionInstanceGroupManagersAbandonInstancesRequest + regionInstanceGroupManagersAbandonInstancesRequestResource; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AbandonInstancesRegionInstanceGroupManagerHttpRequest other) { + if (other == AbandonInstancesRegionInstanceGroupManagerHttpRequest.getDefaultInstance()) + return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegionInstanceGroupManagersAbandonInstancesRequestResource() != null) { + this.regionInstanceGroupManagersAbandonInstancesRequestResource = + other.regionInstanceGroupManagersAbandonInstancesRequestResource; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AbandonInstancesRegionInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.regionInstanceGroupManagersAbandonInstancesRequestResource = + source.regionInstanceGroupManagersAbandonInstancesRequestResource; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public RegionInstanceGroupManagersAbandonInstancesRequest + getRegionInstanceGroupManagersAbandonInstancesRequestResource() { + return regionInstanceGroupManagersAbandonInstancesRequestResource; + } + + public Builder setRegionInstanceGroupManagersAbandonInstancesRequestResource( + RegionInstanceGroupManagersAbandonInstancesRequest + regionInstanceGroupManagersAbandonInstancesRequestResource) { + this.regionInstanceGroupManagersAbandonInstancesRequestResource = + regionInstanceGroupManagersAbandonInstancesRequestResource; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AbandonInstancesRegionInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AbandonInstancesRegionInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + regionInstanceGroupManagersAbandonInstancesRequestResource, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegionInstanceGroupManagersAbandonInstancesRequestResource( + this.regionInstanceGroupManagersAbandonInstancesRequestResource); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AbandonInstancesRegionInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "regionInstanceGroupManagersAbandonInstancesRequestResource=" + + regionInstanceGroupManagersAbandonInstancesRequestResource + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AbandonInstancesRegionInstanceGroupManagerHttpRequest) { + AbandonInstancesRegionInstanceGroupManagerHttpRequest that = + (AbandonInstancesRegionInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals( + this.regionInstanceGroupManagersAbandonInstancesRequestResource, + that.getRegionInstanceGroupManagersAbandonInstancesRequestResource()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + regionInstanceGroupManagersAbandonInstancesRequestResource, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorConfig.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorConfig.java new file mode 100644 index 000000000000..f23011e953c4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorConfig.java @@ -0,0 +1,175 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AcceleratorConfig implements ApiMessage { + private final Integer acceleratorCount; + private final String acceleratorType; + + private AcceleratorConfig() { + this.acceleratorCount = null; + this.acceleratorType = null; + } + + private AcceleratorConfig(Integer acceleratorCount, String acceleratorType) { + this.acceleratorCount = acceleratorCount; + this.acceleratorType = acceleratorType; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("acceleratorCount")) { + return acceleratorCount; + } + if (fieldName.equals("acceleratorType")) { + return acceleratorType; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getAcceleratorCount() { + return acceleratorCount; + } + + public String getAcceleratorType() { + return acceleratorType; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AcceleratorConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AcceleratorConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AcceleratorConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AcceleratorConfig(); + } + + public static class Builder { + private Integer acceleratorCount; + private String acceleratorType; + + Builder() {} + + public Builder mergeFrom(AcceleratorConfig other) { + if (other == AcceleratorConfig.getDefaultInstance()) return this; + if (other.getAcceleratorCount() != null) { + this.acceleratorCount = other.acceleratorCount; + } + if (other.getAcceleratorType() != null) { + this.acceleratorType = other.acceleratorType; + } + return this; + } + + Builder(AcceleratorConfig source) { + this.acceleratorCount = source.acceleratorCount; + this.acceleratorType = source.acceleratorType; + } + + public Integer getAcceleratorCount() { + return acceleratorCount; + } + + public Builder setAcceleratorCount(Integer acceleratorCount) { + this.acceleratorCount = acceleratorCount; + return this; + } + + public String getAcceleratorType() { + return acceleratorType; + } + + public Builder setAcceleratorType(String acceleratorType) { + this.acceleratorType = acceleratorType; + return this; + } + + public AcceleratorConfig build() { + + return new AcceleratorConfig(acceleratorCount, acceleratorType); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAcceleratorCount(this.acceleratorCount); + newBuilder.setAcceleratorType(this.acceleratorType); + return newBuilder; + } + } + + @Override + public String toString() { + return "AcceleratorConfig{" + + "acceleratorCount=" + + acceleratorCount + + ", " + + "acceleratorType=" + + acceleratorType + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AcceleratorConfig) { + AcceleratorConfig that = (AcceleratorConfig) o; + return Objects.equals(this.acceleratorCount, that.getAcceleratorCount()) + && Objects.equals(this.acceleratorType, that.getAcceleratorType()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(acceleratorCount, acceleratorType); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorType.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorType.java new file mode 100644 index 000000000000..fb87ef23f2f4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorType.java @@ -0,0 +1,405 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AcceleratorType implements ApiMessage { + private final String creationTimestamp; + private final DeprecationStatus deprecated; + private final String description; + private final String id; + private final String kind; + private final Integer maximumCardsPerInstance; + private final String name; + private final String selfLink; + private final String zone; + + private AcceleratorType() { + this.creationTimestamp = null; + this.deprecated = null; + this.description = null; + this.id = null; + this.kind = null; + this.maximumCardsPerInstance = null; + this.name = null; + this.selfLink = null; + this.zone = null; + } + + private AcceleratorType( + String creationTimestamp, + DeprecationStatus deprecated, + String description, + String id, + String kind, + Integer maximumCardsPerInstance, + String name, + String selfLink, + String zone) { + this.creationTimestamp = creationTimestamp; + this.deprecated = deprecated; + this.description = description; + this.id = id; + this.kind = kind; + this.maximumCardsPerInstance = maximumCardsPerInstance; + this.name = name; + this.selfLink = selfLink; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("deprecated")) { + return deprecated; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("maximumCardsPerInstance")) { + return maximumCardsPerInstance; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public Integer getMaximumCardsPerInstance() { + return maximumCardsPerInstance; + } + + public String getName() { + return name; + } + + public String getSelfLink() { + return selfLink; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AcceleratorType prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AcceleratorType getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AcceleratorType DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AcceleratorType(); + } + + public static class Builder { + private String creationTimestamp; + private DeprecationStatus deprecated; + private String description; + private String id; + private String kind; + private Integer maximumCardsPerInstance; + private String name; + private String selfLink; + private String zone; + + Builder() {} + + public Builder mergeFrom(AcceleratorType other) { + if (other == AcceleratorType.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDeprecated() != null) { + this.deprecated = other.deprecated; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getMaximumCardsPerInstance() != null) { + this.maximumCardsPerInstance = other.maximumCardsPerInstance; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(AcceleratorType source) { + this.creationTimestamp = source.creationTimestamp; + this.deprecated = source.deprecated; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.maximumCardsPerInstance = source.maximumCardsPerInstance; + this.name = source.name; + this.selfLink = source.selfLink; + this.zone = source.zone; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public Builder setDeprecated(DeprecationStatus deprecated) { + this.deprecated = deprecated; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public Integer getMaximumCardsPerInstance() { + return maximumCardsPerInstance; + } + + public Builder setMaximumCardsPerInstance(Integer maximumCardsPerInstance) { + this.maximumCardsPerInstance = maximumCardsPerInstance; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public AcceleratorType build() { + + return new AcceleratorType( + creationTimestamp, + deprecated, + description, + id, + kind, + maximumCardsPerInstance, + name, + selfLink, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDeprecated(this.deprecated); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setMaximumCardsPerInstance(this.maximumCardsPerInstance); + newBuilder.setName(this.name); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "AcceleratorType{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "deprecated=" + + deprecated + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "maximumCardsPerInstance=" + + maximumCardsPerInstance + + ", " + + "name=" + + name + + ", " + + "selfLink=" + + selfLink + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AcceleratorType) { + AcceleratorType that = (AcceleratorType) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.deprecated, that.getDeprecated()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.maximumCardsPerInstance, that.getMaximumCardsPerInstance()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + deprecated, + description, + id, + kind, + maximumCardsPerInstance, + name, + selfLink, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeAggregatedList.java new file mode 100644 index 000000000000..3ef933c0ed8e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AcceleratorTypeAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private AcceleratorTypeAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private AcceleratorTypeAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AcceleratorTypeAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AcceleratorTypeAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AcceleratorTypeAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AcceleratorTypeAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(AcceleratorTypeAggregatedList other) { + if (other == AcceleratorTypeAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(AcceleratorTypeAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public AcceleratorTypeAggregatedList build() { + + return new AcceleratorTypeAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "AcceleratorTypeAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AcceleratorTypeAggregatedList) { + AcceleratorTypeAggregatedList that = (AcceleratorTypeAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeClient.java new file mode 100644 index 000000000000..957ce264f3c5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeClient.java @@ -0,0 +1,732 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.AcceleratorTypeStub; +import com.google.cloud.compute.v1.stub.AcceleratorTypeStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+ *   ProjectZoneAcceleratorTypeName acceleratorType = ProjectZoneAcceleratorTypeName.of("[PROJECT]", "[ZONE]", "[ACCELERATOR_TYPE]");
+ *   AcceleratorType response = acceleratorTypeClient.getAcceleratorType(acceleratorType);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the acceleratorTypeClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of AcceleratorTypeSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * AcceleratorTypeSettings acceleratorTypeSettings =
+ *     AcceleratorTypeSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * AcceleratorTypeClient acceleratorTypeClient =
+ *     AcceleratorTypeClient.create(acceleratorTypeSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * AcceleratorTypeSettings acceleratorTypeSettings =
+ *     AcceleratorTypeSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * AcceleratorTypeClient acceleratorTypeClient =
+ *     AcceleratorTypeClient.create(acceleratorTypeSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AcceleratorTypeClient implements BackgroundResource { + private final AcceleratorTypeSettings settings; + private final AcceleratorTypeStub stub; + + /** Constructs an instance of AcceleratorTypeClient with default settings. */ + public static final AcceleratorTypeClient create() throws IOException { + return create(AcceleratorTypeSettings.newBuilder().build()); + } + + /** + * Constructs an instance of AcceleratorTypeClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final AcceleratorTypeClient create(AcceleratorTypeSettings settings) + throws IOException { + return new AcceleratorTypeClient(settings); + } + + /** + * Constructs an instance of AcceleratorTypeClient, using the given stub for making calls. This is + * for advanced usage - prefer to use AcceleratorTypeSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final AcceleratorTypeClient create(AcceleratorTypeStub stub) { + return new AcceleratorTypeClient(stub); + } + + /** + * Constructs an instance of AcceleratorTypeClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected AcceleratorTypeClient(AcceleratorTypeSettings settings) throws IOException { + this.settings = settings; + this.stub = ((AcceleratorTypeStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected AcceleratorTypeClient(AcceleratorTypeStub stub) { + this.settings = null; + this.stub = stub; + } + + public final AcceleratorTypeSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AcceleratorTypeStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of accelerator types. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (AcceleratorTypesScopedList element : acceleratorTypeClient.aggregatedListAcceleratorTypes(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListAcceleratorTypesPagedResponse aggregatedListAcceleratorTypes( + ProjectName project) { + AggregatedListAcceleratorTypesHttpRequest request = + AggregatedListAcceleratorTypesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListAcceleratorTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of accelerator types. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (AcceleratorTypesScopedList element : acceleratorTypeClient.aggregatedListAcceleratorTypes(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListAcceleratorTypesPagedResponse aggregatedListAcceleratorTypes( + String project) { + AggregatedListAcceleratorTypesHttpRequest request = + AggregatedListAcceleratorTypesHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListAcceleratorTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of accelerator types. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListAcceleratorTypesHttpRequest request = AggregatedListAcceleratorTypesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (AcceleratorTypesScopedList element : acceleratorTypeClient.aggregatedListAcceleratorTypes(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListAcceleratorTypesPagedResponse aggregatedListAcceleratorTypes( + AggregatedListAcceleratorTypesHttpRequest request) { + return aggregatedListAcceleratorTypesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of accelerator types. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListAcceleratorTypesHttpRequest request = AggregatedListAcceleratorTypesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListAcceleratorTypesPagedResponse> future = acceleratorTypeClient.aggregatedListAcceleratorTypesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (AcceleratorTypesScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListAcceleratorTypesHttpRequest, AggregatedListAcceleratorTypesPagedResponse> + aggregatedListAcceleratorTypesPagedCallable() { + return stub.aggregatedListAcceleratorTypesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of accelerator types. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListAcceleratorTypesHttpRequest request = AggregatedListAcceleratorTypesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     AcceleratorTypeAggregatedList response = acceleratorTypeClient.aggregatedListAcceleratorTypesCallable().call(request);
+   *     for (AcceleratorTypesScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList> + aggregatedListAcceleratorTypesCallable() { + return stub.aggregatedListAcceleratorTypesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified accelerator type. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectZoneAcceleratorTypeName acceleratorType = ProjectZoneAcceleratorTypeName.of("[PROJECT]", "[ZONE]", "[ACCELERATOR_TYPE]");
+   *   AcceleratorType response = acceleratorTypeClient.getAcceleratorType(acceleratorType);
+   * }
+   * 
+ * + * @param acceleratorType Name of the accelerator type to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AcceleratorType getAcceleratorType(ProjectZoneAcceleratorTypeName acceleratorType) { + + GetAcceleratorTypeHttpRequest request = + GetAcceleratorTypeHttpRequest.newBuilder() + .setAcceleratorType(acceleratorType == null ? null : acceleratorType.toString()) + .build(); + return getAcceleratorType(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified accelerator type. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectZoneAcceleratorTypeName acceleratorType = ProjectZoneAcceleratorTypeName.of("[PROJECT]", "[ZONE]", "[ACCELERATOR_TYPE]");
+   *   AcceleratorType response = acceleratorTypeClient.getAcceleratorType(acceleratorType.toString());
+   * }
+   * 
+ * + * @param acceleratorType Name of the accelerator type to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AcceleratorType getAcceleratorType(String acceleratorType) { + + GetAcceleratorTypeHttpRequest request = + GetAcceleratorTypeHttpRequest.newBuilder().setAcceleratorType(acceleratorType).build(); + return getAcceleratorType(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified accelerator type. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectZoneAcceleratorTypeName acceleratorType = ProjectZoneAcceleratorTypeName.of("[PROJECT]", "[ZONE]", "[ACCELERATOR_TYPE]");
+   *   GetAcceleratorTypeHttpRequest request = GetAcceleratorTypeHttpRequest.newBuilder()
+   *     .setAcceleratorType(acceleratorType.toString())
+   *     .build();
+   *   AcceleratorType response = acceleratorTypeClient.getAcceleratorType(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AcceleratorType getAcceleratorType(GetAcceleratorTypeHttpRequest request) { + return getAcceleratorTypeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified accelerator type. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectZoneAcceleratorTypeName acceleratorType = ProjectZoneAcceleratorTypeName.of("[PROJECT]", "[ZONE]", "[ACCELERATOR_TYPE]");
+   *   GetAcceleratorTypeHttpRequest request = GetAcceleratorTypeHttpRequest.newBuilder()
+   *     .setAcceleratorType(acceleratorType.toString())
+   *     .build();
+   *   ApiFuture<AcceleratorType> future = acceleratorTypeClient.getAcceleratorTypeCallable().futureCall(request);
+   *   // Do something
+   *   AcceleratorType response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getAcceleratorTypeCallable() { + return stub.getAcceleratorTypeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of accelerator types available to the specified project. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (AcceleratorType element : acceleratorTypeClient.listAcceleratorTypes(zone).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListAcceleratorTypesPagedResponse listAcceleratorTypes(ProjectZoneName zone) { + ListAcceleratorTypesHttpRequest request = + ListAcceleratorTypesHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .build(); + return listAcceleratorTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of accelerator types available to the specified project. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (AcceleratorType element : acceleratorTypeClient.listAcceleratorTypes(zone.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListAcceleratorTypesPagedResponse listAcceleratorTypes(String zone) { + ListAcceleratorTypesHttpRequest request = + ListAcceleratorTypesHttpRequest.newBuilder().setZone(zone).build(); + return listAcceleratorTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of accelerator types available to the specified project. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListAcceleratorTypesHttpRequest request = ListAcceleratorTypesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   for (AcceleratorType element : acceleratorTypeClient.listAcceleratorTypes(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListAcceleratorTypesPagedResponse listAcceleratorTypes( + ListAcceleratorTypesHttpRequest request) { + return listAcceleratorTypesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of accelerator types available to the specified project. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListAcceleratorTypesHttpRequest request = ListAcceleratorTypesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   ApiFuture<ListAcceleratorTypesPagedResponse> future = acceleratorTypeClient.listAcceleratorTypesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (AcceleratorType element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listAcceleratorTypesPagedCallable() { + return stub.listAcceleratorTypesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of accelerator types available to the specified project. + * + *

Sample code: + * + *


+   * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListAcceleratorTypesHttpRequest request = ListAcceleratorTypesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   while (true) {
+   *     AcceleratorTypeList response = acceleratorTypeClient.listAcceleratorTypesCallable().call(request);
+   *     for (AcceleratorType element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listAcceleratorTypesCallable() { + return stub.listAcceleratorTypesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListAcceleratorTypesPagedResponse + extends AbstractPagedListResponse< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AcceleratorTypesScopedList, AggregatedListAcceleratorTypesPage, + AggregatedListAcceleratorTypesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AcceleratorTypesScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListAcceleratorTypesPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + AggregatedListAcceleratorTypesPage, AggregatedListAcceleratorTypesPagedResponse>() { + @Override + public AggregatedListAcceleratorTypesPagedResponse apply( + AggregatedListAcceleratorTypesPage input) { + return new AggregatedListAcceleratorTypesPagedResponse(input); + } + }); + } + + private AggregatedListAcceleratorTypesPagedResponse(AggregatedListAcceleratorTypesPage page) { + super(page, AggregatedListAcceleratorTypesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListAcceleratorTypesPage + extends AbstractPage< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AcceleratorTypesScopedList, AggregatedListAcceleratorTypesPage> { + + private AggregatedListAcceleratorTypesPage( + PageContext< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AcceleratorTypesScopedList> + context, + AcceleratorTypeAggregatedList response) { + super(context, response); + } + + private static AggregatedListAcceleratorTypesPage createEmptyPage() { + return new AggregatedListAcceleratorTypesPage(null, null); + } + + @Override + protected AggregatedListAcceleratorTypesPage createPage( + PageContext< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AcceleratorTypesScopedList> + context, + AcceleratorTypeAggregatedList response) { + return new AggregatedListAcceleratorTypesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AcceleratorTypesScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListAcceleratorTypesFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AcceleratorTypesScopedList, AggregatedListAcceleratorTypesPage, + AggregatedListAcceleratorTypesFixedSizeCollection> { + + private AggregatedListAcceleratorTypesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListAcceleratorTypesFixedSizeCollection createEmptyCollection() { + return new AggregatedListAcceleratorTypesFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListAcceleratorTypesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListAcceleratorTypesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListAcceleratorTypesPagedResponse + extends AbstractPagedListResponse< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, AcceleratorType, + ListAcceleratorTypesPage, ListAcceleratorTypesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListAcceleratorTypesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListAcceleratorTypesPagedResponse apply(ListAcceleratorTypesPage input) { + return new ListAcceleratorTypesPagedResponse(input); + } + }); + } + + private ListAcceleratorTypesPagedResponse(ListAcceleratorTypesPage page) { + super(page, ListAcceleratorTypesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListAcceleratorTypesPage + extends AbstractPage< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, AcceleratorType, + ListAcceleratorTypesPage> { + + private ListAcceleratorTypesPage( + PageContext context, + AcceleratorTypeList response) { + super(context, response); + } + + private static ListAcceleratorTypesPage createEmptyPage() { + return new ListAcceleratorTypesPage(null, null); + } + + @Override + protected ListAcceleratorTypesPage createPage( + PageContext context, + AcceleratorTypeList response) { + return new ListAcceleratorTypesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListAcceleratorTypesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, AcceleratorType, + ListAcceleratorTypesPage, ListAcceleratorTypesFixedSizeCollection> { + + private ListAcceleratorTypesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListAcceleratorTypesFixedSizeCollection createEmptyCollection() { + return new ListAcceleratorTypesFixedSizeCollection(null, 0); + } + + @Override + protected ListAcceleratorTypesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListAcceleratorTypesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeList.java new file mode 100644 index 000000000000..6445ea9d8386 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AcceleratorTypeList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private AcceleratorTypeList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private AcceleratorTypeList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AcceleratorTypeList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AcceleratorTypeList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AcceleratorTypeList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AcceleratorTypeList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(AcceleratorTypeList other) { + if (other == AcceleratorTypeList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(AcceleratorTypeList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(AcceleratorType items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public AcceleratorTypeList build() { + + return new AcceleratorTypeList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "AcceleratorTypeList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AcceleratorTypeList) { + AcceleratorTypeList that = (AcceleratorTypeList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeSettings.java new file mode 100644 index 000000000000..8164d4985e80 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypeSettings.java @@ -0,0 +1,217 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.AcceleratorTypeClient.AggregatedListAcceleratorTypesPagedResponse; +import static com.google.cloud.compute.v1.AcceleratorTypeClient.ListAcceleratorTypesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.AcceleratorTypeStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link AcceleratorTypeClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getAcceleratorType to 30 seconds: + * + *

+ * 
+ * AcceleratorTypeSettings.Builder acceleratorTypeSettingsBuilder =
+ *     AcceleratorTypeSettings.newBuilder();
+ * acceleratorTypeSettingsBuilder.getAcceleratorTypeSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * AcceleratorTypeSettings acceleratorTypeSettings = acceleratorTypeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AcceleratorTypeSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListAcceleratorTypes. */ + public PagedCallSettings< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AggregatedListAcceleratorTypesPagedResponse> + aggregatedListAcceleratorTypesSettings() { + return ((AcceleratorTypeStubSettings) getStubSettings()) + .aggregatedListAcceleratorTypesSettings(); + } + + /** Returns the object with the settings used for calls to getAcceleratorType. */ + public UnaryCallSettings + getAcceleratorTypeSettings() { + return ((AcceleratorTypeStubSettings) getStubSettings()).getAcceleratorTypeSettings(); + } + + /** Returns the object with the settings used for calls to listAcceleratorTypes. */ + public PagedCallSettings< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, ListAcceleratorTypesPagedResponse> + listAcceleratorTypesSettings() { + return ((AcceleratorTypeStubSettings) getStubSettings()).listAcceleratorTypesSettings(); + } + + public static final AcceleratorTypeSettings create(AcceleratorTypeStubSettings stub) + throws IOException { + return new AcceleratorTypeSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return AcceleratorTypeStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return AcceleratorTypeStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return AcceleratorTypeStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return AcceleratorTypeStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return AcceleratorTypeStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return AcceleratorTypeStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return AcceleratorTypeStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return AcceleratorTypeStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected AcceleratorTypeSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for AcceleratorTypeSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(AcceleratorTypeStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(AcceleratorTypeStubSettings.newBuilder()); + } + + protected Builder(AcceleratorTypeSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(AcceleratorTypeStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public AcceleratorTypeStubSettings.Builder getStubSettingsBuilder() { + return ((AcceleratorTypeStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListAcceleratorTypes. */ + public PagedCallSettings.Builder< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AggregatedListAcceleratorTypesPagedResponse> + aggregatedListAcceleratorTypesSettings() { + return getStubSettingsBuilder().aggregatedListAcceleratorTypesSettings(); + } + + /** Returns the builder for the settings used for calls to getAcceleratorType. */ + public UnaryCallSettings.Builder + getAcceleratorTypeSettings() { + return getStubSettingsBuilder().getAcceleratorTypeSettings(); + } + + /** Returns the builder for the settings used for calls to listAcceleratorTypes. */ + public PagedCallSettings.Builder< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, ListAcceleratorTypesPagedResponse> + listAcceleratorTypesSettings() { + return getStubSettingsBuilder().listAcceleratorTypesSettings(); + } + + @Override + public AcceleratorTypeSettings build() throws IOException { + return new AcceleratorTypeSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypesScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypesScopedList.java new file mode 100644 index 000000000000..91d5ebd7ae01 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AcceleratorTypesScopedList.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AcceleratorTypesScopedList implements ApiMessage { + private final List acceleratorTypes; + private final Warning warning; + + private AcceleratorTypesScopedList() { + this.acceleratorTypes = null; + this.warning = null; + } + + private AcceleratorTypesScopedList(List acceleratorTypes, Warning warning) { + this.acceleratorTypes = acceleratorTypes; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("acceleratorTypes")) { + return acceleratorTypes; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getAcceleratorTypesList() { + return acceleratorTypes; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AcceleratorTypesScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AcceleratorTypesScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AcceleratorTypesScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AcceleratorTypesScopedList(); + } + + public static class Builder { + private List acceleratorTypes; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(AcceleratorTypesScopedList other) { + if (other == AcceleratorTypesScopedList.getDefaultInstance()) return this; + if (other.getAcceleratorTypesList() != null) { + this.acceleratorTypes = other.acceleratorTypes; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(AcceleratorTypesScopedList source) { + this.acceleratorTypes = source.acceleratorTypes; + this.warning = source.warning; + } + + public List getAcceleratorTypesList() { + return acceleratorTypes; + } + + public Builder addAllAcceleratorTypes(List acceleratorTypes) { + if (this.acceleratorTypes == null) { + this.acceleratorTypes = new ArrayList<>(acceleratorTypes.size()); + } + this.acceleratorTypes.addAll(acceleratorTypes); + return this; + } + + public Builder addAcceleratorTypes(AcceleratorType acceleratorTypes) { + this.acceleratorTypes.add(acceleratorTypes); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public AcceleratorTypesScopedList build() { + + return new AcceleratorTypesScopedList(acceleratorTypes, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllAcceleratorTypes(this.acceleratorTypes); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "AcceleratorTypesScopedList{" + + "acceleratorTypes=" + + acceleratorTypes + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AcceleratorTypesScopedList) { + AcceleratorTypesScopedList that = (AcceleratorTypesScopedList) o; + return Objects.equals(this.acceleratorTypes, that.getAcceleratorTypesList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(acceleratorTypes, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AccessConfig.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AccessConfig.java new file mode 100644 index 000000000000..700c7be5d262 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AccessConfig.java @@ -0,0 +1,297 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AccessConfig implements ApiMessage { + private final String kind; + private final String name; + private final String natIP; + private final String publicPtrDomainName; + private final Boolean setPublicPtr; + private final String type; + + private AccessConfig() { + this.kind = null; + this.name = null; + this.natIP = null; + this.publicPtrDomainName = null; + this.setPublicPtr = null; + this.type = null; + } + + private AccessConfig( + String kind, + String name, + String natIP, + String publicPtrDomainName, + Boolean setPublicPtr, + String type) { + this.kind = kind; + this.name = name; + this.natIP = natIP; + this.publicPtrDomainName = publicPtrDomainName; + this.setPublicPtr = setPublicPtr; + this.type = type; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("natIP")) { + return natIP; + } + if (fieldName.equals("publicPtrDomainName")) { + return publicPtrDomainName; + } + if (fieldName.equals("setPublicPtr")) { + return setPublicPtr; + } + if (fieldName.equals("type")) { + return type; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getNatIP() { + return natIP; + } + + public String getPublicPtrDomainName() { + return publicPtrDomainName; + } + + public Boolean getSetPublicPtr() { + return setPublicPtr; + } + + public String getType() { + return type; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AccessConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AccessConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AccessConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AccessConfig(); + } + + public static class Builder { + private String kind; + private String name; + private String natIP; + private String publicPtrDomainName; + private Boolean setPublicPtr; + private String type; + + Builder() {} + + public Builder mergeFrom(AccessConfig other) { + if (other == AccessConfig.getDefaultInstance()) return this; + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNatIP() != null) { + this.natIP = other.natIP; + } + if (other.getPublicPtrDomainName() != null) { + this.publicPtrDomainName = other.publicPtrDomainName; + } + if (other.getSetPublicPtr() != null) { + this.setPublicPtr = other.setPublicPtr; + } + if (other.getType() != null) { + this.type = other.type; + } + return this; + } + + Builder(AccessConfig source) { + this.kind = source.kind; + this.name = source.name; + this.natIP = source.natIP; + this.publicPtrDomainName = source.publicPtrDomainName; + this.setPublicPtr = source.setPublicPtr; + this.type = source.type; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getNatIP() { + return natIP; + } + + public Builder setNatIP(String natIP) { + this.natIP = natIP; + return this; + } + + public String getPublicPtrDomainName() { + return publicPtrDomainName; + } + + public Builder setPublicPtrDomainName(String publicPtrDomainName) { + this.publicPtrDomainName = publicPtrDomainName; + return this; + } + + public Boolean getSetPublicPtr() { + return setPublicPtr; + } + + public Builder setSetPublicPtr(Boolean setPublicPtr) { + this.setPublicPtr = setPublicPtr; + return this; + } + + public String getType() { + return type; + } + + public Builder setType(String type) { + this.type = type; + return this; + } + + public AccessConfig build() { + + return new AccessConfig(kind, name, natIP, publicPtrDomainName, setPublicPtr, type); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setNatIP(this.natIP); + newBuilder.setPublicPtrDomainName(this.publicPtrDomainName); + newBuilder.setSetPublicPtr(this.setPublicPtr); + newBuilder.setType(this.type); + return newBuilder; + } + } + + @Override + public String toString() { + return "AccessConfig{" + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "natIP=" + + natIP + + ", " + + "publicPtrDomainName=" + + publicPtrDomainName + + ", " + + "setPublicPtr=" + + setPublicPtr + + ", " + + "type=" + + type + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AccessConfig) { + AccessConfig that = (AccessConfig) o; + return Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.natIP, that.getNatIP()) + && Objects.equals(this.publicPtrDomainName, that.getPublicPtrDomainName()) + && Objects.equals(this.setPublicPtr, that.getSetPublicPtr()) + && Objects.equals(this.type, that.getType()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(kind, name, natIP, publicPtrDomainName, setPublicPtr, type); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddAccessConfigInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddAccessConfigInstanceHttpRequest.java new file mode 100644 index 000000000000..355d5d314cfb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddAccessConfigInstanceHttpRequest.java @@ -0,0 +1,481 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AddAccessConfigInstanceHttpRequest implements ApiMessage { + private final AccessConfig accessConfigResource; + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final String networkInterface; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private AddAccessConfigInstanceHttpRequest() { + this.accessConfigResource = null; + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.networkInterface = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private AddAccessConfigInstanceHttpRequest( + AccessConfig accessConfigResource, + String access_token, + String callback, + String fields, + String instance, + String key, + String networkInterface, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.accessConfigResource = accessConfigResource; + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.networkInterface = networkInterface; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("accessConfigResource")) { + return accessConfigResource; + } + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("networkInterface")) { + return networkInterface; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public AccessConfig getApiMessageRequestBody() { + return accessConfigResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public AccessConfig getAccessConfigResource() { + return accessConfigResource; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getNetworkInterface() { + return networkInterface; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AddAccessConfigInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AddAccessConfigInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AddAccessConfigInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AddAccessConfigInstanceHttpRequest(); + } + + public static class Builder { + private AccessConfig accessConfigResource; + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private String networkInterface; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AddAccessConfigInstanceHttpRequest other) { + if (other == AddAccessConfigInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessConfigResource() != null) { + this.accessConfigResource = other.accessConfigResource; + } + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getNetworkInterface() != null) { + this.networkInterface = other.networkInterface; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AddAccessConfigInstanceHttpRequest source) { + this.accessConfigResource = source.accessConfigResource; + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.networkInterface = source.networkInterface; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public AccessConfig getAccessConfigResource() { + return accessConfigResource; + } + + public Builder setAccessConfigResource(AccessConfig accessConfigResource) { + this.accessConfigResource = accessConfigResource; + return this; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getNetworkInterface() { + return networkInterface; + } + + public Builder setNetworkInterface(String networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AddAccessConfigInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (networkInterface == null) { + missing += " networkInterface"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AddAccessConfigInstanceHttpRequest( + accessConfigResource, + access_token, + callback, + fields, + instance, + key, + networkInterface, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessConfigResource(this.accessConfigResource); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setNetworkInterface(this.networkInterface); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AddAccessConfigInstanceHttpRequest{" + + "accessConfigResource=" + + accessConfigResource + + ", " + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "networkInterface=" + + networkInterface + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AddAccessConfigInstanceHttpRequest) { + AddAccessConfigInstanceHttpRequest that = (AddAccessConfigInstanceHttpRequest) o; + return Objects.equals(this.accessConfigResource, that.getAccessConfigResource()) + && Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.networkInterface, that.getNetworkInterface()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + accessConfigResource, + access_token, + callback, + fields, + instance, + key, + networkInterface, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddHealthCheckTargetPoolHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddHealthCheckTargetPoolHttpRequest.java new file mode 100644 index 000000000000..9262d462efe4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddHealthCheckTargetPoolHttpRequest.java @@ -0,0 +1,451 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AddHealthCheckTargetPoolHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetPool; + private final TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource; + private final String userIp; + + private AddHealthCheckTargetPoolHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetPool = null; + this.targetPoolsAddHealthCheckRequestResource = null; + this.userIp = null; + } + + private AddHealthCheckTargetPoolHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetPool, + TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetPool = targetPool; + this.targetPoolsAddHealthCheckRequestResource = targetPoolsAddHealthCheckRequestResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetPool")) { + return targetPool; + } + if (fieldName.equals("targetPoolsAddHealthCheckRequestResource")) { + return targetPoolsAddHealthCheckRequestResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetPoolsAddHealthCheckRequest getApiMessageRequestBody() { + return targetPoolsAddHealthCheckRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetPool() { + return targetPool; + } + + public TargetPoolsAddHealthCheckRequest getTargetPoolsAddHealthCheckRequestResource() { + return targetPoolsAddHealthCheckRequestResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AddHealthCheckTargetPoolHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AddHealthCheckTargetPoolHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AddHealthCheckTargetPoolHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AddHealthCheckTargetPoolHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetPool; + private TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AddHealthCheckTargetPoolHttpRequest other) { + if (other == AddHealthCheckTargetPoolHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetPool() != null) { + this.targetPool = other.targetPool; + } + if (other.getTargetPoolsAddHealthCheckRequestResource() != null) { + this.targetPoolsAddHealthCheckRequestResource = + other.targetPoolsAddHealthCheckRequestResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AddHealthCheckTargetPoolHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetPool = source.targetPool; + this.targetPoolsAddHealthCheckRequestResource = + source.targetPoolsAddHealthCheckRequestResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetPool() { + return targetPool; + } + + public Builder setTargetPool(String targetPool) { + this.targetPool = targetPool; + return this; + } + + public TargetPoolsAddHealthCheckRequest getTargetPoolsAddHealthCheckRequestResource() { + return targetPoolsAddHealthCheckRequestResource; + } + + public Builder setTargetPoolsAddHealthCheckRequestResource( + TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource) { + this.targetPoolsAddHealthCheckRequestResource = targetPoolsAddHealthCheckRequestResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AddHealthCheckTargetPoolHttpRequest build() { + String missing = ""; + + if (targetPool == null) { + missing += " targetPool"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AddHealthCheckTargetPoolHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetPool, + targetPoolsAddHealthCheckRequestResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetPool(this.targetPool); + newBuilder.setTargetPoolsAddHealthCheckRequestResource( + this.targetPoolsAddHealthCheckRequestResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AddHealthCheckTargetPoolHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetPool=" + + targetPool + + ", " + + "targetPoolsAddHealthCheckRequestResource=" + + targetPoolsAddHealthCheckRequestResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AddHealthCheckTargetPoolHttpRequest) { + AddHealthCheckTargetPoolHttpRequest that = (AddHealthCheckTargetPoolHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetPool, that.getTargetPool()) + && Objects.equals( + this.targetPoolsAddHealthCheckRequestResource, + that.getTargetPoolsAddHealthCheckRequestResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetPool, + targetPoolsAddHealthCheckRequestResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddInstanceTargetPoolHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddInstanceTargetPoolHttpRequest.java new file mode 100644 index 000000000000..29504b899fbf --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddInstanceTargetPoolHttpRequest.java @@ -0,0 +1,449 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AddInstanceTargetPoolHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetPool; + private final TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource; + private final String userIp; + + private AddInstanceTargetPoolHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetPool = null; + this.targetPoolsAddInstanceRequestResource = null; + this.userIp = null; + } + + private AddInstanceTargetPoolHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetPool, + TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetPool = targetPool; + this.targetPoolsAddInstanceRequestResource = targetPoolsAddInstanceRequestResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetPool")) { + return targetPool; + } + if (fieldName.equals("targetPoolsAddInstanceRequestResource")) { + return targetPoolsAddInstanceRequestResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetPoolsAddInstanceRequest getApiMessageRequestBody() { + return targetPoolsAddInstanceRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetPool() { + return targetPool; + } + + public TargetPoolsAddInstanceRequest getTargetPoolsAddInstanceRequestResource() { + return targetPoolsAddInstanceRequestResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AddInstanceTargetPoolHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AddInstanceTargetPoolHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AddInstanceTargetPoolHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AddInstanceTargetPoolHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetPool; + private TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AddInstanceTargetPoolHttpRequest other) { + if (other == AddInstanceTargetPoolHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetPool() != null) { + this.targetPool = other.targetPool; + } + if (other.getTargetPoolsAddInstanceRequestResource() != null) { + this.targetPoolsAddInstanceRequestResource = other.targetPoolsAddInstanceRequestResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AddInstanceTargetPoolHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetPool = source.targetPool; + this.targetPoolsAddInstanceRequestResource = source.targetPoolsAddInstanceRequestResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetPool() { + return targetPool; + } + + public Builder setTargetPool(String targetPool) { + this.targetPool = targetPool; + return this; + } + + public TargetPoolsAddInstanceRequest getTargetPoolsAddInstanceRequestResource() { + return targetPoolsAddInstanceRequestResource; + } + + public Builder setTargetPoolsAddInstanceRequestResource( + TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource) { + this.targetPoolsAddInstanceRequestResource = targetPoolsAddInstanceRequestResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AddInstanceTargetPoolHttpRequest build() { + String missing = ""; + + if (targetPool == null) { + missing += " targetPool"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AddInstanceTargetPoolHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetPool, + targetPoolsAddInstanceRequestResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetPool(this.targetPool); + newBuilder.setTargetPoolsAddInstanceRequestResource( + this.targetPoolsAddInstanceRequestResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AddInstanceTargetPoolHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetPool=" + + targetPool + + ", " + + "targetPoolsAddInstanceRequestResource=" + + targetPoolsAddInstanceRequestResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AddInstanceTargetPoolHttpRequest) { + AddInstanceTargetPoolHttpRequest that = (AddInstanceTargetPoolHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetPool, that.getTargetPool()) + && Objects.equals( + this.targetPoolsAddInstanceRequestResource, + that.getTargetPoolsAddInstanceRequestResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetPool, + targetPoolsAddInstanceRequestResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddInstancesInstanceGroupHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddInstancesInstanceGroupHttpRequest.java new file mode 100644 index 000000000000..d728e67f4649 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddInstancesInstanceGroupHttpRequest.java @@ -0,0 +1,451 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AddInstancesInstanceGroupHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroup; + private final InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private AddInstancesInstanceGroupHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroup = null; + this.instanceGroupsAddInstancesRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private AddInstancesInstanceGroupHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroup, + InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroup = instanceGroup; + this.instanceGroupsAddInstancesRequestResource = instanceGroupsAddInstancesRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroup")) { + return instanceGroup; + } + if (fieldName.equals("instanceGroupsAddInstancesRequestResource")) { + return instanceGroupsAddInstancesRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceGroupsAddInstancesRequest getApiMessageRequestBody() { + return instanceGroupsAddInstancesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public InstanceGroupsAddInstancesRequest getInstanceGroupsAddInstancesRequestResource() { + return instanceGroupsAddInstancesRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AddInstancesInstanceGroupHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AddInstancesInstanceGroupHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AddInstancesInstanceGroupHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AddInstancesInstanceGroupHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroup; + private InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AddInstancesInstanceGroupHttpRequest other) { + if (other == AddInstancesInstanceGroupHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroup() != null) { + this.instanceGroup = other.instanceGroup; + } + if (other.getInstanceGroupsAddInstancesRequestResource() != null) { + this.instanceGroupsAddInstancesRequestResource = + other.instanceGroupsAddInstancesRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AddInstancesInstanceGroupHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroup = source.instanceGroup; + this.instanceGroupsAddInstancesRequestResource = + source.instanceGroupsAddInstancesRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public InstanceGroupsAddInstancesRequest getInstanceGroupsAddInstancesRequestResource() { + return instanceGroupsAddInstancesRequestResource; + } + + public Builder setInstanceGroupsAddInstancesRequestResource( + InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource) { + this.instanceGroupsAddInstancesRequestResource = instanceGroupsAddInstancesRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AddInstancesInstanceGroupHttpRequest build() { + String missing = ""; + + if (instanceGroup == null) { + missing += " instanceGroup"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AddInstancesInstanceGroupHttpRequest( + access_token, + callback, + fields, + instanceGroup, + instanceGroupsAddInstancesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroup(this.instanceGroup); + newBuilder.setInstanceGroupsAddInstancesRequestResource( + this.instanceGroupsAddInstancesRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AddInstancesInstanceGroupHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroup=" + + instanceGroup + + ", " + + "instanceGroupsAddInstancesRequestResource=" + + instanceGroupsAddInstancesRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AddInstancesInstanceGroupHttpRequest) { + AddInstancesInstanceGroupHttpRequest that = (AddInstancesInstanceGroupHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals( + this.instanceGroupsAddInstancesRequestResource, + that.getInstanceGroupsAddInstancesRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroup, + instanceGroupsAddInstancesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddPeeringNetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddPeeringNetworkHttpRequest.java new file mode 100644 index 000000000000..2ee03b079e03 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddPeeringNetworkHttpRequest.java @@ -0,0 +1,447 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AddPeeringNetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String network; + private final NetworksAddPeeringRequest networksAddPeeringRequestResource; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private AddPeeringNetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.network = null; + this.networksAddPeeringRequestResource = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private AddPeeringNetworkHttpRequest( + String access_token, + String callback, + String fields, + String key, + String network, + NetworksAddPeeringRequest networksAddPeeringRequestResource, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.network = network; + this.networksAddPeeringRequestResource = networksAddPeeringRequestResource; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("networksAddPeeringRequestResource")) { + return networksAddPeeringRequestResource; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public NetworksAddPeeringRequest getApiMessageRequestBody() { + return networksAddPeeringRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getNetwork() { + return network; + } + + public NetworksAddPeeringRequest getNetworksAddPeeringRequestResource() { + return networksAddPeeringRequestResource; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AddPeeringNetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AddPeeringNetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AddPeeringNetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AddPeeringNetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String network; + private NetworksAddPeeringRequest networksAddPeeringRequestResource; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AddPeeringNetworkHttpRequest other) { + if (other == AddPeeringNetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getNetworksAddPeeringRequestResource() != null) { + this.networksAddPeeringRequestResource = other.networksAddPeeringRequestResource; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AddPeeringNetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.network = source.network; + this.networksAddPeeringRequestResource = source.networksAddPeeringRequestResource; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public NetworksAddPeeringRequest getNetworksAddPeeringRequestResource() { + return networksAddPeeringRequestResource; + } + + public Builder setNetworksAddPeeringRequestResource( + NetworksAddPeeringRequest networksAddPeeringRequestResource) { + this.networksAddPeeringRequestResource = networksAddPeeringRequestResource; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AddPeeringNetworkHttpRequest build() { + String missing = ""; + + if (network == null) { + missing += " network"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AddPeeringNetworkHttpRequest( + access_token, + callback, + fields, + key, + network, + networksAddPeeringRequestResource, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setNetwork(this.network); + newBuilder.setNetworksAddPeeringRequestResource(this.networksAddPeeringRequestResource); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AddPeeringNetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "network=" + + network + + ", " + + "networksAddPeeringRequestResource=" + + networksAddPeeringRequestResource + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AddPeeringNetworkHttpRequest) { + AddPeeringNetworkHttpRequest that = (AddPeeringNetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals( + this.networksAddPeeringRequestResource, that.getNetworksAddPeeringRequestResource()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + network, + networksAddPeeringRequestResource, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Address.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Address.java new file mode 100644 index 000000000000..3d04956026b1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Address.java @@ -0,0 +1,542 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Address implements ApiMessage { + private final String address; + private final String addressType; + private final String creationTimestamp; + private final String description; + private final String id; + private final String ipVersion; + private final String kind; + private final String name; + private final String region; + private final String selfLink; + private final String status; + private final String subnetwork; + private final List users; + + private Address() { + this.address = null; + this.addressType = null; + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.ipVersion = null; + this.kind = null; + this.name = null; + this.region = null; + this.selfLink = null; + this.status = null; + this.subnetwork = null; + this.users = null; + } + + private Address( + String address, + String addressType, + String creationTimestamp, + String description, + String id, + String ipVersion, + String kind, + String name, + String region, + String selfLink, + String status, + String subnetwork, + List users) { + this.address = address; + this.addressType = addressType; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.ipVersion = ipVersion; + this.kind = kind; + this.name = name; + this.region = region; + this.selfLink = selfLink; + this.status = status; + this.subnetwork = subnetwork; + this.users = users; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("address")) { + return address; + } + if (fieldName.equals("addressType")) { + return addressType; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("ipVersion")) { + return ipVersion; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("status")) { + return status; + } + if (fieldName.equals("subnetwork")) { + return subnetwork; + } + if (fieldName.equals("users")) { + return users; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAddress() { + return address; + } + + public String getAddressType() { + return addressType; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getIpVersion() { + return ipVersion; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public String getStatus() { + return status; + } + + public String getSubnetwork() { + return subnetwork; + } + + public List getUsersList() { + return users; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Address prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Address getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Address DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Address(); + } + + public static class Builder { + private String address; + private String addressType; + private String creationTimestamp; + private String description; + private String id; + private String ipVersion; + private String kind; + private String name; + private String region; + private String selfLink; + private String status; + private String subnetwork; + private List users; + + Builder() {} + + public Builder mergeFrom(Address other) { + if (other == Address.getDefaultInstance()) return this; + if (other.getAddress() != null) { + this.address = other.address; + } + if (other.getAddressType() != null) { + this.addressType = other.addressType; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getIpVersion() != null) { + this.ipVersion = other.ipVersion; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getStatus() != null) { + this.status = other.status; + } + if (other.getSubnetwork() != null) { + this.subnetwork = other.subnetwork; + } + if (other.getUsersList() != null) { + this.users = other.users; + } + return this; + } + + Builder(Address source) { + this.address = source.address; + this.addressType = source.addressType; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.ipVersion = source.ipVersion; + this.kind = source.kind; + this.name = source.name; + this.region = source.region; + this.selfLink = source.selfLink; + this.status = source.status; + this.subnetwork = source.subnetwork; + this.users = source.users; + } + + public String getAddress() { + return address; + } + + public Builder setAddress(String address) { + this.address = address; + return this; + } + + public String getAddressType() { + return addressType; + } + + public Builder setAddressType(String addressType) { + this.addressType = addressType; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getIpVersion() { + return ipVersion; + } + + public Builder setIpVersion(String ipVersion) { + this.ipVersion = ipVersion; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public String getSubnetwork() { + return subnetwork; + } + + public Builder setSubnetwork(String subnetwork) { + this.subnetwork = subnetwork; + return this; + } + + public List getUsersList() { + return users; + } + + public Builder addAllUsers(List users) { + if (this.users == null) { + this.users = new ArrayList<>(users.size()); + } + this.users.addAll(users); + return this; + } + + public Builder addUsers(String users) { + this.users.add(users); + return this; + } + + public Address build() { + + return new Address( + address, + addressType, + creationTimestamp, + description, + id, + ipVersion, + kind, + name, + region, + selfLink, + status, + subnetwork, + users); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAddress(this.address); + newBuilder.setAddressType(this.addressType); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setIpVersion(this.ipVersion); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setStatus(this.status); + newBuilder.setSubnetwork(this.subnetwork); + newBuilder.addAllUsers(this.users); + return newBuilder; + } + } + + @Override + public String toString() { + return "Address{" + + "address=" + + address + + ", " + + "addressType=" + + addressType + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "ipVersion=" + + ipVersion + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + ", " + + "status=" + + status + + ", " + + "subnetwork=" + + subnetwork + + ", " + + "users=" + + users + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Address) { + Address that = (Address) o; + return Objects.equals(this.address, that.getAddress()) + && Objects.equals(this.addressType, that.getAddressType()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.ipVersion, that.getIpVersion()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.status, that.getStatus()) + && Objects.equals(this.subnetwork, that.getSubnetwork()) + && Objects.equals(this.users, that.getUsersList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + address, + addressType, + creationTimestamp, + description, + id, + ipVersion, + kind, + name, + region, + selfLink, + status, + subnetwork, + users); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressAggregatedList.java new file mode 100644 index 000000000000..4fb93c707ae0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AddressAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private AddressAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private AddressAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AddressAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AddressAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AddressAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AddressAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(AddressAggregatedList other) { + if (other == AddressAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(AddressAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public AddressAggregatedList build() { + + return new AddressAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "AddressAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AddressAggregatedList) { + AddressAggregatedList that = (AddressAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressClient.java new file mode 100644 index 000000000000..0dc4ac78c33c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressClient.java @@ -0,0 +1,914 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.AddressStub; +import com.google.cloud.compute.v1.stub.AddressStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (AddressClient addressClient = AddressClient.create()) {
+ *   ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
+ *   Operation response = addressClient.deleteAddress(address);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the addressClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of AddressSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * AddressSettings addressSettings =
+ *     AddressSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * AddressClient addressClient =
+ *     AddressClient.create(addressSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * AddressSettings addressSettings =
+ *     AddressSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * AddressClient addressClient =
+ *     AddressClient.create(addressSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AddressClient implements BackgroundResource { + private final AddressSettings settings; + private final AddressStub stub; + + /** Constructs an instance of AddressClient with default settings. */ + public static final AddressClient create() throws IOException { + return create(AddressSettings.newBuilder().build()); + } + + /** + * Constructs an instance of AddressClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final AddressClient create(AddressSettings settings) throws IOException { + return new AddressClient(settings); + } + + /** + * Constructs an instance of AddressClient, using the given stub for making calls. This is for + * advanced usage - prefer to use AddressSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final AddressClient create(AddressStub stub) { + return new AddressClient(stub); + } + + /** + * Constructs an instance of AddressClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected AddressClient(AddressSettings settings) throws IOException { + this.settings = settings; + this.stub = ((AddressStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected AddressClient(AddressStub stub) { + this.settings = null; + this.stub = stub; + } + + public final AddressSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AddressStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of addresses. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (AddressesScopedList element : addressClient.aggregatedListAddresses(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListAddressesPagedResponse aggregatedListAddresses(ProjectName project) { + AggregatedListAddressesHttpRequest request = + AggregatedListAddressesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListAddresses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of addresses. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (AddressesScopedList element : addressClient.aggregatedListAddresses(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListAddressesPagedResponse aggregatedListAddresses(String project) { + AggregatedListAddressesHttpRequest request = + AggregatedListAddressesHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListAddresses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of addresses. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListAddressesHttpRequest request = AggregatedListAddressesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (AddressesScopedList element : addressClient.aggregatedListAddresses(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListAddressesPagedResponse aggregatedListAddresses( + AggregatedListAddressesHttpRequest request) { + return aggregatedListAddressesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of addresses. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListAddressesHttpRequest request = AggregatedListAddressesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListAddressesPagedResponse> future = addressClient.aggregatedListAddressesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (AddressesScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListAddressesHttpRequest, AggregatedListAddressesPagedResponse> + aggregatedListAddressesPagedCallable() { + return stub.aggregatedListAddressesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of addresses. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListAddressesHttpRequest request = AggregatedListAddressesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     AddressAggregatedList response = addressClient.aggregatedListAddressesCallable().call(request);
+   *     for (AddressesScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListAddressesCallable() { + return stub.aggregatedListAddressesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified address resource. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
+   *   Operation response = addressClient.deleteAddress(address);
+   * }
+   * 
+ * + * @param address Name of the address resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteAddress(ProjectRegionAddressName address) { + + DeleteAddressHttpRequest request = + DeleteAddressHttpRequest.newBuilder() + .setAddress(address == null ? null : address.toString()) + .build(); + return deleteAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified address resource. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
+   *   Operation response = addressClient.deleteAddress(address.toString());
+   * }
+   * 
+ * + * @param address Name of the address resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteAddress(String address) { + + DeleteAddressHttpRequest request = + DeleteAddressHttpRequest.newBuilder().setAddress(address).build(); + return deleteAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified address resource. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
+   *   DeleteAddressHttpRequest request = DeleteAddressHttpRequest.newBuilder()
+   *     .setAddress(address.toString())
+   *     .build();
+   *   Operation response = addressClient.deleteAddress(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteAddress(DeleteAddressHttpRequest request) { + return deleteAddressCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified address resource. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
+   *   DeleteAddressHttpRequest request = DeleteAddressHttpRequest.newBuilder()
+   *     .setAddress(address.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = addressClient.deleteAddressCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteAddressCallable() { + return stub.deleteAddressCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified address resource. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
+   *   Address response = addressClient.getAddress(address);
+   * }
+   * 
+ * + * @param address Name of the address resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Address getAddress(ProjectRegionAddressName address) { + + GetAddressHttpRequest request = + GetAddressHttpRequest.newBuilder() + .setAddress(address == null ? null : address.toString()) + .build(); + return getAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified address resource. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
+   *   Address response = addressClient.getAddress(address.toString());
+   * }
+   * 
+ * + * @param address Name of the address resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Address getAddress(String address) { + + GetAddressHttpRequest request = GetAddressHttpRequest.newBuilder().setAddress(address).build(); + return getAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified address resource. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
+   *   GetAddressHttpRequest request = GetAddressHttpRequest.newBuilder()
+   *     .setAddress(address.toString())
+   *     .build();
+   *   Address response = addressClient.getAddress(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Address getAddress(GetAddressHttpRequest request) { + return getAddressCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified address resource. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
+   *   GetAddressHttpRequest request = GetAddressHttpRequest.newBuilder()
+   *     .setAddress(address.toString())
+   *     .build();
+   *   ApiFuture<Address> future = addressClient.getAddressCallable().futureCall(request);
+   *   // Do something
+   *   Address response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getAddressCallable() { + return stub.getAddressCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an address resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Address addressResource = Address.newBuilder().build();
+   *   Operation response = addressClient.insertAddress(region, addressResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param addressResource A reserved address resource. (== resource_for beta.addresses ==) (== + * resource_for v1.addresses ==) (== resource_for beta.globalAddresses ==) (== resource_for + * v1.globalAddresses ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertAddress(ProjectRegionName region, Address addressResource) { + + InsertAddressHttpRequest request = + InsertAddressHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setAddressResource(addressResource) + .build(); + return insertAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an address resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Address addressResource = Address.newBuilder().build();
+   *   Operation response = addressClient.insertAddress(region.toString(), addressResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param addressResource A reserved address resource. (== resource_for beta.addresses ==) (== + * resource_for v1.addresses ==) (== resource_for beta.globalAddresses ==) (== resource_for + * v1.globalAddresses ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertAddress(String region, Address addressResource) { + + InsertAddressHttpRequest request = + InsertAddressHttpRequest.newBuilder() + .setRegion(region) + .setAddressResource(addressResource) + .build(); + return insertAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an address resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Address addressResource = Address.newBuilder().build();
+   *   InsertAddressHttpRequest request = InsertAddressHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setAddressResource(addressResource)
+   *     .build();
+   *   Operation response = addressClient.insertAddress(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertAddress(InsertAddressHttpRequest request) { + return insertAddressCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an address resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Address addressResource = Address.newBuilder().build();
+   *   InsertAddressHttpRequest request = InsertAddressHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setAddressResource(addressResource)
+   *     .build();
+   *   ApiFuture<Operation> future = addressClient.insertAddressCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertAddressCallable() { + return stub.insertAddressCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of addresses contained within the specified region. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Address element : addressClient.listAddresses(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListAddressesPagedResponse listAddresses(ProjectRegionName region) { + ListAddressesHttpRequest request = + ListAddressesHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listAddresses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of addresses contained within the specified region. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Address element : addressClient.listAddresses(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListAddressesPagedResponse listAddresses(String region) { + ListAddressesHttpRequest request = + ListAddressesHttpRequest.newBuilder().setRegion(region).build(); + return listAddresses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of addresses contained within the specified region. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListAddressesHttpRequest request = ListAddressesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (Address element : addressClient.listAddresses(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListAddressesPagedResponse listAddresses(ListAddressesHttpRequest request) { + return listAddressesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of addresses contained within the specified region. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListAddressesHttpRequest request = ListAddressesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListAddressesPagedResponse> future = addressClient.listAddressesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Address element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listAddressesPagedCallable() { + return stub.listAddressesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of addresses contained within the specified region. + * + *

Sample code: + * + *


+   * try (AddressClient addressClient = AddressClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListAddressesHttpRequest request = ListAddressesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     AddressList response = addressClient.listAddressesCallable().call(request);
+   *     for (Address element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listAddressesCallable() { + return stub.listAddressesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListAddressesPagedResponse + extends AbstractPagedListResponse< + AggregatedListAddressesHttpRequest, AddressAggregatedList, AddressesScopedList, + AggregatedListAddressesPage, AggregatedListAddressesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListAddressesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public AggregatedListAddressesPagedResponse apply(AggregatedListAddressesPage input) { + return new AggregatedListAddressesPagedResponse(input); + } + }); + } + + private AggregatedListAddressesPagedResponse(AggregatedListAddressesPage page) { + super(page, AggregatedListAddressesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListAddressesPage + extends AbstractPage< + AggregatedListAddressesHttpRequest, AddressAggregatedList, AddressesScopedList, + AggregatedListAddressesPage> { + + private AggregatedListAddressesPage( + PageContext + context, + AddressAggregatedList response) { + super(context, response); + } + + private static AggregatedListAddressesPage createEmptyPage() { + return new AggregatedListAddressesPage(null, null); + } + + @Override + protected AggregatedListAddressesPage createPage( + PageContext + context, + AddressAggregatedList response) { + return new AggregatedListAddressesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListAddressesFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListAddressesHttpRequest, AddressAggregatedList, AddressesScopedList, + AggregatedListAddressesPage, AggregatedListAddressesFixedSizeCollection> { + + private AggregatedListAddressesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListAddressesFixedSizeCollection createEmptyCollection() { + return new AggregatedListAddressesFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListAddressesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListAddressesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListAddressesPagedResponse + extends AbstractPagedListResponse< + ListAddressesHttpRequest, AddressList, Address, ListAddressesPage, + ListAddressesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListAddressesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListAddressesPagedResponse apply(ListAddressesPage input) { + return new ListAddressesPagedResponse(input); + } + }); + } + + private ListAddressesPagedResponse(ListAddressesPage page) { + super(page, ListAddressesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListAddressesPage + extends AbstractPage { + + private ListAddressesPage( + PageContext context, AddressList response) { + super(context, response); + } + + private static ListAddressesPage createEmptyPage() { + return new ListAddressesPage(null, null); + } + + @Override + protected ListAddressesPage createPage( + PageContext context, AddressList response) { + return new ListAddressesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListAddressesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListAddressesHttpRequest, AddressList, Address, ListAddressesPage, + ListAddressesFixedSizeCollection> { + + private ListAddressesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListAddressesFixedSizeCollection createEmptyCollection() { + return new ListAddressesFixedSizeCollection(null, 0); + } + + @Override + protected ListAddressesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListAddressesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressList.java new file mode 100644 index 000000000000..dfad4309cbbe --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AddressList implements ApiMessage { + private final String id; + private final List
items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private AddressList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private AddressList( + String id, + List
items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List
getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AddressList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AddressList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AddressList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AddressList(); + } + + public static class Builder { + private String id; + private List
items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(AddressList other) { + if (other == AddressList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(AddressList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List
getItemsList() { + return items; + } + + public Builder addAllItems(List
items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Address items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public AddressList build() { + + return new AddressList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "AddressList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AddressList) { + AddressList that = (AddressList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressSettings.java new file mode 100644 index 000000000000..b5a5b4ef2359 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressSettings.java @@ -0,0 +1,232 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.AddressClient.AggregatedListAddressesPagedResponse; +import static com.google.cloud.compute.v1.AddressClient.ListAddressesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.AddressStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link AddressClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteAddress to 30 seconds: + * + *

+ * 
+ * AddressSettings.Builder addressSettingsBuilder =
+ *     AddressSettings.newBuilder();
+ * addressSettingsBuilder.deleteAddressSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * AddressSettings addressSettings = addressSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AddressSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListAddresses. */ + public PagedCallSettings< + AggregatedListAddressesHttpRequest, AddressAggregatedList, + AggregatedListAddressesPagedResponse> + aggregatedListAddressesSettings() { + return ((AddressStubSettings) getStubSettings()).aggregatedListAddressesSettings(); + } + + /** Returns the object with the settings used for calls to deleteAddress. */ + public UnaryCallSettings deleteAddressSettings() { + return ((AddressStubSettings) getStubSettings()).deleteAddressSettings(); + } + + /** Returns the object with the settings used for calls to getAddress. */ + public UnaryCallSettings getAddressSettings() { + return ((AddressStubSettings) getStubSettings()).getAddressSettings(); + } + + /** Returns the object with the settings used for calls to insertAddress. */ + public UnaryCallSettings insertAddressSettings() { + return ((AddressStubSettings) getStubSettings()).insertAddressSettings(); + } + + /** Returns the object with the settings used for calls to listAddresses. */ + public PagedCallSettings + listAddressesSettings() { + return ((AddressStubSettings) getStubSettings()).listAddressesSettings(); + } + + public static final AddressSettings create(AddressStubSettings stub) throws IOException { + return new AddressSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return AddressStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return AddressStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return AddressStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return AddressStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return AddressStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return AddressStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return AddressStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return AddressStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected AddressSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for AddressSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(AddressStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(AddressStubSettings.newBuilder()); + } + + protected Builder(AddressSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(AddressStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public AddressStubSettings.Builder getStubSettingsBuilder() { + return ((AddressStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListAddresses. */ + public PagedCallSettings.Builder< + AggregatedListAddressesHttpRequest, AddressAggregatedList, + AggregatedListAddressesPagedResponse> + aggregatedListAddressesSettings() { + return getStubSettingsBuilder().aggregatedListAddressesSettings(); + } + + /** Returns the builder for the settings used for calls to deleteAddress. */ + public UnaryCallSettings.Builder deleteAddressSettings() { + return getStubSettingsBuilder().deleteAddressSettings(); + } + + /** Returns the builder for the settings used for calls to getAddress. */ + public UnaryCallSettings.Builder getAddressSettings() { + return getStubSettingsBuilder().getAddressSettings(); + } + + /** Returns the builder for the settings used for calls to insertAddress. */ + public UnaryCallSettings.Builder insertAddressSettings() { + return getStubSettingsBuilder().insertAddressSettings(); + } + + /** Returns the builder for the settings used for calls to listAddresses. */ + public PagedCallSettings.Builder< + ListAddressesHttpRequest, AddressList, ListAddressesPagedResponse> + listAddressesSettings() { + return getStubSettingsBuilder().listAddressesSettings(); + } + + @Override + public AddressSettings build() throws IOException { + return new AddressSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressesScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressesScopedList.java new file mode 100644 index 000000000000..b8aa0161070a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressesScopedList.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AddressesScopedList implements ApiMessage { + private final List

addresses; + private final Warning warning; + + private AddressesScopedList() { + this.addresses = null; + this.warning = null; + } + + private AddressesScopedList(List
addresses, Warning warning) { + this.addresses = addresses; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("addresses")) { + return addresses; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List
getAddressesList() { + return addresses; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AddressesScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AddressesScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AddressesScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AddressesScopedList(); + } + + public static class Builder { + private List
addresses; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(AddressesScopedList other) { + if (other == AddressesScopedList.getDefaultInstance()) return this; + if (other.getAddressesList() != null) { + this.addresses = other.addresses; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(AddressesScopedList source) { + this.addresses = source.addresses; + this.warning = source.warning; + } + + public List
getAddressesList() { + return addresses; + } + + public Builder addAllAddresses(List
addresses) { + if (this.addresses == null) { + this.addresses = new ArrayList<>(addresses.size()); + } + this.addresses.addAll(addresses); + return this; + } + + public Builder addAddresses(Address addresses) { + this.addresses.add(addresses); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public AddressesScopedList build() { + + return new AddressesScopedList(addresses, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllAddresses(this.addresses); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "AddressesScopedList{" + "addresses=" + addresses + ", " + "warning=" + warning + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AddressesScopedList) { + AddressesScopedList that = (AddressesScopedList) o; + return Objects.equals(this.addresses, that.getAddressesList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(addresses, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListAcceleratorTypesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListAcceleratorTypesHttpRequest.java new file mode 100644 index 000000000000..e2478c51f2dc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListAcceleratorTypesHttpRequest.java @@ -0,0 +1,510 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListAcceleratorTypesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListAcceleratorTypesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListAcceleratorTypesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListAcceleratorTypesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListAcceleratorTypesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListAcceleratorTypesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListAcceleratorTypesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListAcceleratorTypesHttpRequest other) { + if (other == AggregatedListAcceleratorTypesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListAcceleratorTypesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListAcceleratorTypesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListAcceleratorTypesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListAcceleratorTypesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListAcceleratorTypesHttpRequest) { + AggregatedListAcceleratorTypesHttpRequest that = + (AggregatedListAcceleratorTypesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListAddressesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListAddressesHttpRequest.java new file mode 100644 index 000000000000..88436c282b6b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListAddressesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListAddressesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListAddressesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListAddressesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListAddressesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListAddressesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListAddressesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListAddressesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListAddressesHttpRequest other) { + if (other == AggregatedListAddressesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListAddressesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListAddressesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListAddressesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListAddressesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListAddressesHttpRequest) { + AggregatedListAddressesHttpRequest that = (AggregatedListAddressesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListAutoscalersHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListAutoscalersHttpRequest.java new file mode 100644 index 000000000000..71a24f28b3a4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListAutoscalersHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListAutoscalersHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListAutoscalersHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListAutoscalersHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListAutoscalersHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListAutoscalersHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListAutoscalersHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListAutoscalersHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListAutoscalersHttpRequest other) { + if (other == AggregatedListAutoscalersHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListAutoscalersHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListAutoscalersHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListAutoscalersHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListAutoscalersHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListAutoscalersHttpRequest) { + AggregatedListAutoscalersHttpRequest that = (AggregatedListAutoscalersHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListBackendServicesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListBackendServicesHttpRequest.java new file mode 100644 index 000000000000..69a8227af819 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListBackendServicesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListBackendServicesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListBackendServicesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListBackendServicesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListBackendServicesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListBackendServicesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListBackendServicesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListBackendServicesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListBackendServicesHttpRequest other) { + if (other == AggregatedListBackendServicesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListBackendServicesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListBackendServicesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListBackendServicesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListBackendServicesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListBackendServicesHttpRequest) { + AggregatedListBackendServicesHttpRequest that = (AggregatedListBackendServicesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListDiskTypesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListDiskTypesHttpRequest.java new file mode 100644 index 000000000000..89e876b8abb4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListDiskTypesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListDiskTypesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListDiskTypesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListDiskTypesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListDiskTypesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListDiskTypesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListDiskTypesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListDiskTypesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListDiskTypesHttpRequest other) { + if (other == AggregatedListDiskTypesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListDiskTypesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListDiskTypesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListDiskTypesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListDiskTypesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListDiskTypesHttpRequest) { + AggregatedListDiskTypesHttpRequest that = (AggregatedListDiskTypesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListDisksHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListDisksHttpRequest.java new file mode 100644 index 000000000000..c9f8029f34e8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListDisksHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListDisksHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListDisksHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListDisksHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListDisksHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListDisksHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListDisksHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListDisksHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListDisksHttpRequest other) { + if (other == AggregatedListDisksHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListDisksHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListDisksHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListDisksHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListDisksHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListDisksHttpRequest) { + AggregatedListDisksHttpRequest that = (AggregatedListDisksHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListForwardingRulesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListForwardingRulesHttpRequest.java new file mode 100644 index 000000000000..72cea01f104d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListForwardingRulesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListForwardingRulesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListForwardingRulesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListForwardingRulesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListForwardingRulesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListForwardingRulesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListForwardingRulesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListForwardingRulesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListForwardingRulesHttpRequest other) { + if (other == AggregatedListForwardingRulesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListForwardingRulesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListForwardingRulesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListForwardingRulesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListForwardingRulesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListForwardingRulesHttpRequest) { + AggregatedListForwardingRulesHttpRequest that = (AggregatedListForwardingRulesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListGlobalOperationsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListGlobalOperationsHttpRequest.java new file mode 100644 index 000000000000..fb2284b7dbee --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListGlobalOperationsHttpRequest.java @@ -0,0 +1,510 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListGlobalOperationsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListGlobalOperationsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListGlobalOperationsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListGlobalOperationsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListGlobalOperationsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListGlobalOperationsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListGlobalOperationsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListGlobalOperationsHttpRequest other) { + if (other == AggregatedListGlobalOperationsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListGlobalOperationsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListGlobalOperationsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListGlobalOperationsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListGlobalOperationsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListGlobalOperationsHttpRequest) { + AggregatedListGlobalOperationsHttpRequest that = + (AggregatedListGlobalOperationsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInstanceGroupManagersHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInstanceGroupManagersHttpRequest.java new file mode 100644 index 000000000000..076e196cfb8f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInstanceGroupManagersHttpRequest.java @@ -0,0 +1,510 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListInstanceGroupManagersHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListInstanceGroupManagersHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListInstanceGroupManagersHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListInstanceGroupManagersHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListInstanceGroupManagersHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListInstanceGroupManagersHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListInstanceGroupManagersHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListInstanceGroupManagersHttpRequest other) { + if (other == AggregatedListInstanceGroupManagersHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListInstanceGroupManagersHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListInstanceGroupManagersHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListInstanceGroupManagersHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListInstanceGroupManagersHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListInstanceGroupManagersHttpRequest) { + AggregatedListInstanceGroupManagersHttpRequest that = + (AggregatedListInstanceGroupManagersHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInstanceGroupsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInstanceGroupsHttpRequest.java new file mode 100644 index 000000000000..211639cfbe7c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInstanceGroupsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListInstanceGroupsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListInstanceGroupsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListInstanceGroupsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListInstanceGroupsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListInstanceGroupsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListInstanceGroupsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListInstanceGroupsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListInstanceGroupsHttpRequest other) { + if (other == AggregatedListInstanceGroupsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListInstanceGroupsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListInstanceGroupsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListInstanceGroupsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListInstanceGroupsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListInstanceGroupsHttpRequest) { + AggregatedListInstanceGroupsHttpRequest that = (AggregatedListInstanceGroupsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInstancesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInstancesHttpRequest.java new file mode 100644 index 000000000000..e281da33a595 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInstancesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListInstancesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListInstancesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListInstancesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListInstancesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListInstancesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListInstancesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListInstancesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListInstancesHttpRequest other) { + if (other == AggregatedListInstancesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListInstancesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListInstancesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListInstancesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListInstancesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListInstancesHttpRequest) { + AggregatedListInstancesHttpRequest that = (AggregatedListInstancesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInterconnectAttachmentsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInterconnectAttachmentsHttpRequest.java new file mode 100644 index 000000000000..286d3e0d2f94 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListInterconnectAttachmentsHttpRequest.java @@ -0,0 +1,511 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListInterconnectAttachmentsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListInterconnectAttachmentsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListInterconnectAttachmentsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListInterconnectAttachmentsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListInterconnectAttachmentsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListInterconnectAttachmentsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListInterconnectAttachmentsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListInterconnectAttachmentsHttpRequest other) { + if (other == AggregatedListInterconnectAttachmentsHttpRequest.getDefaultInstance()) + return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListInterconnectAttachmentsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListInterconnectAttachmentsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListInterconnectAttachmentsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListInterconnectAttachmentsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListInterconnectAttachmentsHttpRequest) { + AggregatedListInterconnectAttachmentsHttpRequest that = + (AggregatedListInterconnectAttachmentsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListMachineTypesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListMachineTypesHttpRequest.java new file mode 100644 index 000000000000..9c22653c070e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListMachineTypesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListMachineTypesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListMachineTypesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListMachineTypesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListMachineTypesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListMachineTypesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListMachineTypesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListMachineTypesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListMachineTypesHttpRequest other) { + if (other == AggregatedListMachineTypesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListMachineTypesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListMachineTypesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListMachineTypesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListMachineTypesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListMachineTypesHttpRequest) { + AggregatedListMachineTypesHttpRequest that = (AggregatedListMachineTypesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListRegionCommitmentsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListRegionCommitmentsHttpRequest.java new file mode 100644 index 000000000000..f6e9e5484105 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListRegionCommitmentsHttpRequest.java @@ -0,0 +1,510 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListRegionCommitmentsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListRegionCommitmentsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListRegionCommitmentsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListRegionCommitmentsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListRegionCommitmentsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListRegionCommitmentsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListRegionCommitmentsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListRegionCommitmentsHttpRequest other) { + if (other == AggregatedListRegionCommitmentsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListRegionCommitmentsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListRegionCommitmentsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListRegionCommitmentsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListRegionCommitmentsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListRegionCommitmentsHttpRequest) { + AggregatedListRegionCommitmentsHttpRequest that = + (AggregatedListRegionCommitmentsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListRoutersHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListRoutersHttpRequest.java new file mode 100644 index 000000000000..619e7fe65aaa --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListRoutersHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListRoutersHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListRoutersHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListRoutersHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListRoutersHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListRoutersHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListRoutersHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListRoutersHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListRoutersHttpRequest other) { + if (other == AggregatedListRoutersHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListRoutersHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListRoutersHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListRoutersHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListRoutersHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListRoutersHttpRequest) { + AggregatedListRoutersHttpRequest that = (AggregatedListRoutersHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListSubnetworksHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListSubnetworksHttpRequest.java new file mode 100644 index 000000000000..8a5bda15a8ef --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListSubnetworksHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListSubnetworksHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListSubnetworksHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListSubnetworksHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListSubnetworksHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListSubnetworksHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListSubnetworksHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListSubnetworksHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListSubnetworksHttpRequest other) { + if (other == AggregatedListSubnetworksHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListSubnetworksHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListSubnetworksHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListSubnetworksHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListSubnetworksHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListSubnetworksHttpRequest) { + AggregatedListSubnetworksHttpRequest that = (AggregatedListSubnetworksHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListTargetInstancesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListTargetInstancesHttpRequest.java new file mode 100644 index 000000000000..91c43d6c5927 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListTargetInstancesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListTargetInstancesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListTargetInstancesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListTargetInstancesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListTargetInstancesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListTargetInstancesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListTargetInstancesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListTargetInstancesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListTargetInstancesHttpRequest other) { + if (other == AggregatedListTargetInstancesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListTargetInstancesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListTargetInstancesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListTargetInstancesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListTargetInstancesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListTargetInstancesHttpRequest) { + AggregatedListTargetInstancesHttpRequest that = (AggregatedListTargetInstancesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListTargetPoolsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListTargetPoolsHttpRequest.java new file mode 100644 index 000000000000..3c548928adeb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListTargetPoolsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListTargetPoolsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListTargetPoolsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListTargetPoolsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListTargetPoolsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListTargetPoolsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListTargetPoolsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListTargetPoolsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListTargetPoolsHttpRequest other) { + if (other == AggregatedListTargetPoolsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListTargetPoolsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListTargetPoolsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListTargetPoolsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListTargetPoolsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListTargetPoolsHttpRequest) { + AggregatedListTargetPoolsHttpRequest that = (AggregatedListTargetPoolsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListTargetVpnGatewaysHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListTargetVpnGatewaysHttpRequest.java new file mode 100644 index 000000000000..164b5b92c225 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListTargetVpnGatewaysHttpRequest.java @@ -0,0 +1,510 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListTargetVpnGatewaysHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListTargetVpnGatewaysHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListTargetVpnGatewaysHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListTargetVpnGatewaysHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListTargetVpnGatewaysHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListTargetVpnGatewaysHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListTargetVpnGatewaysHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListTargetVpnGatewaysHttpRequest other) { + if (other == AggregatedListTargetVpnGatewaysHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListTargetVpnGatewaysHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListTargetVpnGatewaysHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListTargetVpnGatewaysHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListTargetVpnGatewaysHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListTargetVpnGatewaysHttpRequest) { + AggregatedListTargetVpnGatewaysHttpRequest that = + (AggregatedListTargetVpnGatewaysHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListVpnTunnelsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListVpnTunnelsHttpRequest.java new file mode 100644 index 000000000000..2cac8c858695 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AggregatedListVpnTunnelsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AggregatedListVpnTunnelsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private AggregatedListVpnTunnelsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private AggregatedListVpnTunnelsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AggregatedListVpnTunnelsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AggregatedListVpnTunnelsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AggregatedListVpnTunnelsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AggregatedListVpnTunnelsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AggregatedListVpnTunnelsHttpRequest other) { + if (other == AggregatedListVpnTunnelsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AggregatedListVpnTunnelsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AggregatedListVpnTunnelsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AggregatedListVpnTunnelsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AggregatedListVpnTunnelsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AggregatedListVpnTunnelsHttpRequest) { + AggregatedListVpnTunnelsHttpRequest that = (AggregatedListVpnTunnelsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AliasIpRange.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AliasIpRange.java new file mode 100644 index 000000000000..c4d1d59b1043 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AliasIpRange.java @@ -0,0 +1,175 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AliasIpRange implements ApiMessage { + private final String ipCidrRange; + private final String subnetworkRangeName; + + private AliasIpRange() { + this.ipCidrRange = null; + this.subnetworkRangeName = null; + } + + private AliasIpRange(String ipCidrRange, String subnetworkRangeName) { + this.ipCidrRange = ipCidrRange; + this.subnetworkRangeName = subnetworkRangeName; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("ipCidrRange")) { + return ipCidrRange; + } + if (fieldName.equals("subnetworkRangeName")) { + return subnetworkRangeName; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getIpCidrRange() { + return ipCidrRange; + } + + public String getSubnetworkRangeName() { + return subnetworkRangeName; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AliasIpRange prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AliasIpRange getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AliasIpRange DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AliasIpRange(); + } + + public static class Builder { + private String ipCidrRange; + private String subnetworkRangeName; + + Builder() {} + + public Builder mergeFrom(AliasIpRange other) { + if (other == AliasIpRange.getDefaultInstance()) return this; + if (other.getIpCidrRange() != null) { + this.ipCidrRange = other.ipCidrRange; + } + if (other.getSubnetworkRangeName() != null) { + this.subnetworkRangeName = other.subnetworkRangeName; + } + return this; + } + + Builder(AliasIpRange source) { + this.ipCidrRange = source.ipCidrRange; + this.subnetworkRangeName = source.subnetworkRangeName; + } + + public String getIpCidrRange() { + return ipCidrRange; + } + + public Builder setIpCidrRange(String ipCidrRange) { + this.ipCidrRange = ipCidrRange; + return this; + } + + public String getSubnetworkRangeName() { + return subnetworkRangeName; + } + + public Builder setSubnetworkRangeName(String subnetworkRangeName) { + this.subnetworkRangeName = subnetworkRangeName; + return this; + } + + public AliasIpRange build() { + + return new AliasIpRange(ipCidrRange, subnetworkRangeName); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setIpCidrRange(this.ipCidrRange); + newBuilder.setSubnetworkRangeName(this.subnetworkRangeName); + return newBuilder; + } + } + + @Override + public String toString() { + return "AliasIpRange{" + + "ipCidrRange=" + + ipCidrRange + + ", " + + "subnetworkRangeName=" + + subnetworkRangeName + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AliasIpRange) { + AliasIpRange that = (AliasIpRange) o; + return Objects.equals(this.ipCidrRange, that.getIpCidrRange()) + && Objects.equals(this.subnetworkRangeName, that.getSubnetworkRangeName()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(ipCidrRange, subnetworkRangeName); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Allowed.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Allowed.java new file mode 100644 index 000000000000..ed17969066a8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Allowed.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Allowed implements ApiMessage { + private final String iPProtocol; + private final List ports; + + private Allowed() { + this.iPProtocol = null; + this.ports = null; + } + + private Allowed(String iPProtocol, List ports) { + this.iPProtocol = iPProtocol; + this.ports = ports; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("iPProtocol")) { + return iPProtocol; + } + if (fieldName.equals("ports")) { + return ports; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getIPProtocol() { + return iPProtocol; + } + + public List getPortsList() { + return ports; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Allowed prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Allowed getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Allowed DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Allowed(); + } + + public static class Builder { + private String iPProtocol; + private List ports; + + Builder() {} + + public Builder mergeFrom(Allowed other) { + if (other == Allowed.getDefaultInstance()) return this; + if (other.getIPProtocol() != null) { + this.iPProtocol = other.iPProtocol; + } + if (other.getPortsList() != null) { + this.ports = other.ports; + } + return this; + } + + Builder(Allowed source) { + this.iPProtocol = source.iPProtocol; + this.ports = source.ports; + } + + public String getIPProtocol() { + return iPProtocol; + } + + public Builder setIPProtocol(String iPProtocol) { + this.iPProtocol = iPProtocol; + return this; + } + + public List getPortsList() { + return ports; + } + + public Builder addAllPorts(List ports) { + if (this.ports == null) { + this.ports = new ArrayList<>(ports.size()); + } + this.ports.addAll(ports); + return this; + } + + public Builder addPorts(String ports) { + this.ports.add(ports); + return this; + } + + public Allowed build() { + + return new Allowed(iPProtocol, ports); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setIPProtocol(this.iPProtocol); + newBuilder.addAllPorts(this.ports); + return newBuilder; + } + } + + @Override + public String toString() { + return "Allowed{" + "iPProtocol=" + iPProtocol + ", " + "ports=" + ports + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Allowed) { + Allowed that = (Allowed) o; + return Objects.equals(this.iPProtocol, that.getIPProtocol()) + && Objects.equals(this.ports, that.getPortsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(iPProtocol, ports); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AttachDiskInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AttachDiskInstanceHttpRequest.java new file mode 100644 index 000000000000..f6586f9fe210 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AttachDiskInstanceHttpRequest.java @@ -0,0 +1,477 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AttachDiskInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final AttachedDisk attachedDiskResource; + private final String callback; + private final String fields; + private final Boolean forceAttach; + private final String instance; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private AttachDiskInstanceHttpRequest() { + this.access_token = null; + this.attachedDiskResource = null; + this.callback = null; + this.fields = null; + this.forceAttach = null; + this.instance = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private AttachDiskInstanceHttpRequest( + String access_token, + AttachedDisk attachedDiskResource, + String callback, + String fields, + Boolean forceAttach, + String instance, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.attachedDiskResource = attachedDiskResource; + this.callback = callback; + this.fields = fields; + this.forceAttach = forceAttach; + this.instance = instance; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("attachedDiskResource")) { + return attachedDiskResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("forceAttach")) { + return forceAttach; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public AttachedDisk getApiMessageRequestBody() { + return attachedDiskResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public AttachedDisk getAttachedDiskResource() { + return attachedDiskResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public Boolean getForceAttach() { + return forceAttach; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AttachDiskInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AttachDiskInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AttachDiskInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AttachDiskInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private AttachedDisk attachedDiskResource; + private String callback; + private String fields; + private Boolean forceAttach; + private String instance; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(AttachDiskInstanceHttpRequest other) { + if (other == AttachDiskInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAttachedDiskResource() != null) { + this.attachedDiskResource = other.attachedDiskResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getForceAttach() != null) { + this.forceAttach = other.forceAttach; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(AttachDiskInstanceHttpRequest source) { + this.access_token = source.access_token; + this.attachedDiskResource = source.attachedDiskResource; + this.callback = source.callback; + this.fields = source.fields; + this.forceAttach = source.forceAttach; + this.instance = source.instance; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public AttachedDisk getAttachedDiskResource() { + return attachedDiskResource; + } + + public Builder setAttachedDiskResource(AttachedDisk attachedDiskResource) { + this.attachedDiskResource = attachedDiskResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public Boolean getForceAttach() { + return forceAttach; + } + + public Builder setForceAttach(Boolean forceAttach) { + this.forceAttach = forceAttach; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public AttachDiskInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new AttachDiskInstanceHttpRequest( + access_token, + attachedDiskResource, + callback, + fields, + forceAttach, + instance, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAttachedDiskResource(this.attachedDiskResource); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setForceAttach(this.forceAttach); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "AttachDiskInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "attachedDiskResource=" + + attachedDiskResource + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "forceAttach=" + + forceAttach + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AttachDiskInstanceHttpRequest) { + AttachDiskInstanceHttpRequest that = (AttachDiskInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.attachedDiskResource, that.getAttachedDiskResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.forceAttach, that.getForceAttach()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + attachedDiskResource, + callback, + fields, + forceAttach, + instance, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AttachedDisk.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AttachedDisk.java new file mode 100644 index 000000000000..13bc11b8ef17 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AttachedDisk.java @@ -0,0 +1,550 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AttachedDisk implements ApiMessage { + private final Boolean autoDelete; + private final Boolean boot; + private final String deviceName; + private final CustomerEncryptionKey diskEncryptionKey; + private final List guestOsFeatures; + private final Integer index; + private final AttachedDiskInitializeParams initializeParams; + private final String interface2; + private final String kind; + private final List licenses; + private final String mode; + private final String source; + private final String type; + + private AttachedDisk() { + this.autoDelete = null; + this.boot = null; + this.deviceName = null; + this.diskEncryptionKey = null; + this.guestOsFeatures = null; + this.index = null; + this.initializeParams = null; + this.interface2 = null; + this.kind = null; + this.licenses = null; + this.mode = null; + this.source = null; + this.type = null; + } + + private AttachedDisk( + Boolean autoDelete, + Boolean boot, + String deviceName, + CustomerEncryptionKey diskEncryptionKey, + List guestOsFeatures, + Integer index, + AttachedDiskInitializeParams initializeParams, + String interface2, + String kind, + List licenses, + String mode, + String source, + String type) { + this.autoDelete = autoDelete; + this.boot = boot; + this.deviceName = deviceName; + this.diskEncryptionKey = diskEncryptionKey; + this.guestOsFeatures = guestOsFeatures; + this.index = index; + this.initializeParams = initializeParams; + this.interface2 = interface2; + this.kind = kind; + this.licenses = licenses; + this.mode = mode; + this.source = source; + this.type = type; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("autoDelete")) { + return autoDelete; + } + if (fieldName.equals("boot")) { + return boot; + } + if (fieldName.equals("deviceName")) { + return deviceName; + } + if (fieldName.equals("diskEncryptionKey")) { + return diskEncryptionKey; + } + if (fieldName.equals("guestOsFeatures")) { + return guestOsFeatures; + } + if (fieldName.equals("index")) { + return index; + } + if (fieldName.equals("initializeParams")) { + return initializeParams; + } + if (fieldName.equals("interface2")) { + return interface2; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("licenses")) { + return licenses; + } + if (fieldName.equals("mode")) { + return mode; + } + if (fieldName.equals("source")) { + return source; + } + if (fieldName.equals("type")) { + return type; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getAutoDelete() { + return autoDelete; + } + + public Boolean getBoot() { + return boot; + } + + public String getDeviceName() { + return deviceName; + } + + public CustomerEncryptionKey getDiskEncryptionKey() { + return diskEncryptionKey; + } + + public List getGuestOsFeaturesList() { + return guestOsFeatures; + } + + public Integer getIndex() { + return index; + } + + public AttachedDiskInitializeParams getInitializeParams() { + return initializeParams; + } + + public String getInterface() { + return interface2; + } + + public String getKind() { + return kind; + } + + public List getLicensesList() { + return licenses; + } + + public String getMode() { + return mode; + } + + public String getSource() { + return source; + } + + public String getType() { + return type; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AttachedDisk prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AttachedDisk getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AttachedDisk DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AttachedDisk(); + } + + public static class Builder { + private Boolean autoDelete; + private Boolean boot; + private String deviceName; + private CustomerEncryptionKey diskEncryptionKey; + private List guestOsFeatures; + private Integer index; + private AttachedDiskInitializeParams initializeParams; + private String interface2; + private String kind; + private List licenses; + private String mode; + private String source; + private String type; + + Builder() {} + + public Builder mergeFrom(AttachedDisk other) { + if (other == AttachedDisk.getDefaultInstance()) return this; + if (other.getAutoDelete() != null) { + this.autoDelete = other.autoDelete; + } + if (other.getBoot() != null) { + this.boot = other.boot; + } + if (other.getDeviceName() != null) { + this.deviceName = other.deviceName; + } + if (other.getDiskEncryptionKey() != null) { + this.diskEncryptionKey = other.diskEncryptionKey; + } + if (other.getGuestOsFeaturesList() != null) { + this.guestOsFeatures = other.guestOsFeatures; + } + if (other.getIndex() != null) { + this.index = other.index; + } + if (other.getInitializeParams() != null) { + this.initializeParams = other.initializeParams; + } + if (other.getInterface() != null) { + this.interface2 = other.interface2; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getLicensesList() != null) { + this.licenses = other.licenses; + } + if (other.getMode() != null) { + this.mode = other.mode; + } + if (other.getSource() != null) { + this.source = other.source; + } + if (other.getType() != null) { + this.type = other.type; + } + return this; + } + + Builder(AttachedDisk source) { + this.autoDelete = source.autoDelete; + this.boot = source.boot; + this.deviceName = source.deviceName; + this.diskEncryptionKey = source.diskEncryptionKey; + this.guestOsFeatures = source.guestOsFeatures; + this.index = source.index; + this.initializeParams = source.initializeParams; + this.interface2 = source.interface2; + this.kind = source.kind; + this.licenses = source.licenses; + this.mode = source.mode; + this.source = source.source; + this.type = source.type; + } + + public Boolean getAutoDelete() { + return autoDelete; + } + + public Builder setAutoDelete(Boolean autoDelete) { + this.autoDelete = autoDelete; + return this; + } + + public Boolean getBoot() { + return boot; + } + + public Builder setBoot(Boolean boot) { + this.boot = boot; + return this; + } + + public String getDeviceName() { + return deviceName; + } + + public Builder setDeviceName(String deviceName) { + this.deviceName = deviceName; + return this; + } + + public CustomerEncryptionKey getDiskEncryptionKey() { + return diskEncryptionKey; + } + + public Builder setDiskEncryptionKey(CustomerEncryptionKey diskEncryptionKey) { + this.diskEncryptionKey = diskEncryptionKey; + return this; + } + + public List getGuestOsFeaturesList() { + return guestOsFeatures; + } + + public Builder addAllGuestOsFeatures(List guestOsFeatures) { + if (this.guestOsFeatures == null) { + this.guestOsFeatures = new ArrayList<>(guestOsFeatures.size()); + } + this.guestOsFeatures.addAll(guestOsFeatures); + return this; + } + + public Builder addGuestOsFeatures(GuestOsFeature guestOsFeatures) { + this.guestOsFeatures.add(guestOsFeatures); + return this; + } + + public Integer getIndex() { + return index; + } + + public Builder setIndex(Integer index) { + this.index = index; + return this; + } + + public AttachedDiskInitializeParams getInitializeParams() { + return initializeParams; + } + + public Builder setInitializeParams(AttachedDiskInitializeParams initializeParams) { + this.initializeParams = initializeParams; + return this; + } + + public String getInterface() { + return interface2; + } + + public Builder setInterface(String interface2) { + this.interface2 = interface2; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public List getLicensesList() { + return licenses; + } + + public Builder addAllLicenses(List licenses) { + if (this.licenses == null) { + this.licenses = new ArrayList<>(licenses.size()); + } + this.licenses.addAll(licenses); + return this; + } + + public Builder addLicenses(String licenses) { + this.licenses.add(licenses); + return this; + } + + public String getMode() { + return mode; + } + + public Builder setMode(String mode) { + this.mode = mode; + return this; + } + + public String getSource() { + return source; + } + + public Builder setSource(String source) { + this.source = source; + return this; + } + + public String getType() { + return type; + } + + public Builder setType(String type) { + this.type = type; + return this; + } + + public AttachedDisk build() { + + return new AttachedDisk( + autoDelete, + boot, + deviceName, + diskEncryptionKey, + guestOsFeatures, + index, + initializeParams, + interface2, + kind, + licenses, + mode, + source, + type); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAutoDelete(this.autoDelete); + newBuilder.setBoot(this.boot); + newBuilder.setDeviceName(this.deviceName); + newBuilder.setDiskEncryptionKey(this.diskEncryptionKey); + newBuilder.addAllGuestOsFeatures(this.guestOsFeatures); + newBuilder.setIndex(this.index); + newBuilder.setInitializeParams(this.initializeParams); + newBuilder.setInterface(this.interface2); + newBuilder.setKind(this.kind); + newBuilder.addAllLicenses(this.licenses); + newBuilder.setMode(this.mode); + newBuilder.setSource(this.source); + newBuilder.setType(this.type); + return newBuilder; + } + } + + @Override + public String toString() { + return "AttachedDisk{" + + "autoDelete=" + + autoDelete + + ", " + + "boot=" + + boot + + ", " + + "deviceName=" + + deviceName + + ", " + + "diskEncryptionKey=" + + diskEncryptionKey + + ", " + + "guestOsFeatures=" + + guestOsFeatures + + ", " + + "index=" + + index + + ", " + + "initializeParams=" + + initializeParams + + ", " + + "interface2=" + + interface2 + + ", " + + "kind=" + + kind + + ", " + + "licenses=" + + licenses + + ", " + + "mode=" + + mode + + ", " + + "source=" + + source + + ", " + + "type=" + + type + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AttachedDisk) { + AttachedDisk that = (AttachedDisk) o; + return Objects.equals(this.autoDelete, that.getAutoDelete()) + && Objects.equals(this.boot, that.getBoot()) + && Objects.equals(this.deviceName, that.getDeviceName()) + && Objects.equals(this.diskEncryptionKey, that.getDiskEncryptionKey()) + && Objects.equals(this.guestOsFeatures, that.getGuestOsFeaturesList()) + && Objects.equals(this.index, that.getIndex()) + && Objects.equals(this.initializeParams, that.getInitializeParams()) + && Objects.equals(this.interface2, that.getInterface()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.licenses, that.getLicensesList()) + && Objects.equals(this.mode, that.getMode()) + && Objects.equals(this.source, that.getSource()) + && Objects.equals(this.type, that.getType()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + autoDelete, + boot, + deviceName, + diskEncryptionKey, + guestOsFeatures, + index, + initializeParams, + interface2, + kind, + licenses, + mode, + source, + type); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AttachedDiskInitializeParams.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AttachedDiskInitializeParams.java new file mode 100644 index 000000000000..ca7015f26d13 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AttachedDiskInitializeParams.java @@ -0,0 +1,300 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AttachedDiskInitializeParams implements ApiMessage { + private final String diskName; + private final String diskSizeGb; + private final String diskType; + private final Map labels; + private final String sourceImage; + private final CustomerEncryptionKey sourceImageEncryptionKey; + + private AttachedDiskInitializeParams() { + this.diskName = null; + this.diskSizeGb = null; + this.diskType = null; + this.labels = null; + this.sourceImage = null; + this.sourceImageEncryptionKey = null; + } + + private AttachedDiskInitializeParams( + String diskName, + String diskSizeGb, + String diskType, + Map labels, + String sourceImage, + CustomerEncryptionKey sourceImageEncryptionKey) { + this.diskName = diskName; + this.diskSizeGb = diskSizeGb; + this.diskType = diskType; + this.labels = labels; + this.sourceImage = sourceImage; + this.sourceImageEncryptionKey = sourceImageEncryptionKey; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("diskName")) { + return diskName; + } + if (fieldName.equals("diskSizeGb")) { + return diskSizeGb; + } + if (fieldName.equals("diskType")) { + return diskType; + } + if (fieldName.equals("labels")) { + return labels; + } + if (fieldName.equals("sourceImage")) { + return sourceImage; + } + if (fieldName.equals("sourceImageEncryptionKey")) { + return sourceImageEncryptionKey; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getDiskName() { + return diskName; + } + + public String getDiskSizeGb() { + return diskSizeGb; + } + + public String getDiskType() { + return diskType; + } + + public Map getLabelsMap() { + return labels; + } + + public String getSourceImage() { + return sourceImage; + } + + public CustomerEncryptionKey getSourceImageEncryptionKey() { + return sourceImageEncryptionKey; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AttachedDiskInitializeParams prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AttachedDiskInitializeParams getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AttachedDiskInitializeParams DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AttachedDiskInitializeParams(); + } + + public static class Builder { + private String diskName; + private String diskSizeGb; + private String diskType; + private Map labels; + private String sourceImage; + private CustomerEncryptionKey sourceImageEncryptionKey; + + Builder() {} + + public Builder mergeFrom(AttachedDiskInitializeParams other) { + if (other == AttachedDiskInitializeParams.getDefaultInstance()) return this; + if (other.getDiskName() != null) { + this.diskName = other.diskName; + } + if (other.getDiskSizeGb() != null) { + this.diskSizeGb = other.diskSizeGb; + } + if (other.getDiskType() != null) { + this.diskType = other.diskType; + } + if (other.getLabelsMap() != null) { + this.labels = other.labels; + } + if (other.getSourceImage() != null) { + this.sourceImage = other.sourceImage; + } + if (other.getSourceImageEncryptionKey() != null) { + this.sourceImageEncryptionKey = other.sourceImageEncryptionKey; + } + return this; + } + + Builder(AttachedDiskInitializeParams source) { + this.diskName = source.diskName; + this.diskSizeGb = source.diskSizeGb; + this.diskType = source.diskType; + this.labels = source.labels; + this.sourceImage = source.sourceImage; + this.sourceImageEncryptionKey = source.sourceImageEncryptionKey; + } + + public String getDiskName() { + return diskName; + } + + public Builder setDiskName(String diskName) { + this.diskName = diskName; + return this; + } + + public String getDiskSizeGb() { + return diskSizeGb; + } + + public Builder setDiskSizeGb(String diskSizeGb) { + this.diskSizeGb = diskSizeGb; + return this; + } + + public String getDiskType() { + return diskType; + } + + public Builder setDiskType(String diskType) { + this.diskType = diskType; + return this; + } + + public Map getLabelsMap() { + return labels; + } + + public Builder putAllLabels(Map labels) { + this.labels = labels; + return this; + } + + public String getSourceImage() { + return sourceImage; + } + + public Builder setSourceImage(String sourceImage) { + this.sourceImage = sourceImage; + return this; + } + + public CustomerEncryptionKey getSourceImageEncryptionKey() { + return sourceImageEncryptionKey; + } + + public Builder setSourceImageEncryptionKey(CustomerEncryptionKey sourceImageEncryptionKey) { + this.sourceImageEncryptionKey = sourceImageEncryptionKey; + return this; + } + + public AttachedDiskInitializeParams build() { + + return new AttachedDiskInitializeParams( + diskName, diskSizeGb, diskType, labels, sourceImage, sourceImageEncryptionKey); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDiskName(this.diskName); + newBuilder.setDiskSizeGb(this.diskSizeGb); + newBuilder.setDiskType(this.diskType); + newBuilder.putAllLabels(this.labels); + newBuilder.setSourceImage(this.sourceImage); + newBuilder.setSourceImageEncryptionKey(this.sourceImageEncryptionKey); + return newBuilder; + } + } + + @Override + public String toString() { + return "AttachedDiskInitializeParams{" + + "diskName=" + + diskName + + ", " + + "diskSizeGb=" + + diskSizeGb + + ", " + + "diskType=" + + diskType + + ", " + + "labels=" + + labels + + ", " + + "sourceImage=" + + sourceImage + + ", " + + "sourceImageEncryptionKey=" + + sourceImageEncryptionKey + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AttachedDiskInitializeParams) { + AttachedDiskInitializeParams that = (AttachedDiskInitializeParams) o; + return Objects.equals(this.diskName, that.getDiskName()) + && Objects.equals(this.diskSizeGb, that.getDiskSizeGb()) + && Objects.equals(this.diskType, that.getDiskType()) + && Objects.equals(this.labels, that.getLabelsMap()) + && Objects.equals(this.sourceImage, that.getSourceImage()) + && Objects.equals(this.sourceImageEncryptionKey, that.getSourceImageEncryptionKey()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + diskName, diskSizeGb, diskType, labels, sourceImage, sourceImageEncryptionKey); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Autoscaler.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Autoscaler.java new file mode 100644 index 000000000000..4b73600d6412 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Autoscaler.java @@ -0,0 +1,510 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Autoscaler implements ApiMessage { + private final AutoscalingPolicy autoscalingPolicy; + private final String creationTimestamp; + private final String description; + private final String id; + private final String kind; + private final String name; + private final String region; + private final String selfLink; + private final String status; + private final List statusDetails; + private final String target; + private final String zone; + + private Autoscaler() { + this.autoscalingPolicy = null; + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.kind = null; + this.name = null; + this.region = null; + this.selfLink = null; + this.status = null; + this.statusDetails = null; + this.target = null; + this.zone = null; + } + + private Autoscaler( + AutoscalingPolicy autoscalingPolicy, + String creationTimestamp, + String description, + String id, + String kind, + String name, + String region, + String selfLink, + String status, + List statusDetails, + String target, + String zone) { + this.autoscalingPolicy = autoscalingPolicy; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.kind = kind; + this.name = name; + this.region = region; + this.selfLink = selfLink; + this.status = status; + this.statusDetails = statusDetails; + this.target = target; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("autoscalingPolicy")) { + return autoscalingPolicy; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("status")) { + return status; + } + if (fieldName.equals("statusDetails")) { + return statusDetails; + } + if (fieldName.equals("target")) { + return target; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public AutoscalingPolicy getAutoscalingPolicy() { + return autoscalingPolicy; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public String getStatus() { + return status; + } + + public List getStatusDetailsList() { + return statusDetails; + } + + public String getTarget() { + return target; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Autoscaler prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Autoscaler getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Autoscaler DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Autoscaler(); + } + + public static class Builder { + private AutoscalingPolicy autoscalingPolicy; + private String creationTimestamp; + private String description; + private String id; + private String kind; + private String name; + private String region; + private String selfLink; + private String status; + private List statusDetails; + private String target; + private String zone; + + Builder() {} + + public Builder mergeFrom(Autoscaler other) { + if (other == Autoscaler.getDefaultInstance()) return this; + if (other.getAutoscalingPolicy() != null) { + this.autoscalingPolicy = other.autoscalingPolicy; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getStatus() != null) { + this.status = other.status; + } + if (other.getStatusDetailsList() != null) { + this.statusDetails = other.statusDetails; + } + if (other.getTarget() != null) { + this.target = other.target; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(Autoscaler source) { + this.autoscalingPolicy = source.autoscalingPolicy; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.region = source.region; + this.selfLink = source.selfLink; + this.status = source.status; + this.statusDetails = source.statusDetails; + this.target = source.target; + this.zone = source.zone; + } + + public AutoscalingPolicy getAutoscalingPolicy() { + return autoscalingPolicy; + } + + public Builder setAutoscalingPolicy(AutoscalingPolicy autoscalingPolicy) { + this.autoscalingPolicy = autoscalingPolicy; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public List getStatusDetailsList() { + return statusDetails; + } + + public Builder addAllStatusDetails(List statusDetails) { + if (this.statusDetails == null) { + this.statusDetails = new ArrayList<>(statusDetails.size()); + } + this.statusDetails.addAll(statusDetails); + return this; + } + + public Builder addStatusDetails(AutoscalerStatusDetails statusDetails) { + this.statusDetails.add(statusDetails); + return this; + } + + public String getTarget() { + return target; + } + + public Builder setTarget(String target) { + this.target = target; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public Autoscaler build() { + + return new Autoscaler( + autoscalingPolicy, + creationTimestamp, + description, + id, + kind, + name, + region, + selfLink, + status, + statusDetails, + target, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAutoscalingPolicy(this.autoscalingPolicy); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setStatus(this.status); + newBuilder.addAllStatusDetails(this.statusDetails); + newBuilder.setTarget(this.target); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "Autoscaler{" + + "autoscalingPolicy=" + + autoscalingPolicy + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + ", " + + "status=" + + status + + ", " + + "statusDetails=" + + statusDetails + + ", " + + "target=" + + target + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Autoscaler) { + Autoscaler that = (Autoscaler) o; + return Objects.equals(this.autoscalingPolicy, that.getAutoscalingPolicy()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.status, that.getStatus()) + && Objects.equals(this.statusDetails, that.getStatusDetailsList()) + && Objects.equals(this.target, that.getTarget()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + autoscalingPolicy, + creationTimestamp, + description, + id, + kind, + name, + region, + selfLink, + status, + statusDetails, + target, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerAggregatedList.java new file mode 100644 index 000000000000..3e0ac9f3b606 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AutoscalerAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private AutoscalerAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private AutoscalerAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AutoscalerAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AutoscalerAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AutoscalerAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AutoscalerAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(AutoscalerAggregatedList other) { + if (other == AutoscalerAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(AutoscalerAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public AutoscalerAggregatedList build() { + + return new AutoscalerAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "AutoscalerAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AutoscalerAggregatedList) { + AutoscalerAggregatedList that = (AutoscalerAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerClient.java new file mode 100644 index 000000000000..6b15fc7cf416 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerClient.java @@ -0,0 +1,1199 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.AutoscalerStub; +import com.google.cloud.compute.v1.stub.AutoscalerStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+ *   ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
+ *   Operation response = autoscalerClient.deleteAutoscaler(autoscaler);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the autoscalerClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of AutoscalerSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * AutoscalerSettings autoscalerSettings =
+ *     AutoscalerSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * AutoscalerClient autoscalerClient =
+ *     AutoscalerClient.create(autoscalerSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * AutoscalerSettings autoscalerSettings =
+ *     AutoscalerSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * AutoscalerClient autoscalerClient =
+ *     AutoscalerClient.create(autoscalerSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AutoscalerClient implements BackgroundResource { + private final AutoscalerSettings settings; + private final AutoscalerStub stub; + + /** Constructs an instance of AutoscalerClient with default settings. */ + public static final AutoscalerClient create() throws IOException { + return create(AutoscalerSettings.newBuilder().build()); + } + + /** + * Constructs an instance of AutoscalerClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final AutoscalerClient create(AutoscalerSettings settings) throws IOException { + return new AutoscalerClient(settings); + } + + /** + * Constructs an instance of AutoscalerClient, using the given stub for making calls. This is for + * advanced usage - prefer to use AutoscalerSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final AutoscalerClient create(AutoscalerStub stub) { + return new AutoscalerClient(stub); + } + + /** + * Constructs an instance of AutoscalerClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected AutoscalerClient(AutoscalerSettings settings) throws IOException { + this.settings = settings; + this.stub = ((AutoscalerStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected AutoscalerClient(AutoscalerStub stub) { + this.settings = null; + this.stub = stub; + } + + public final AutoscalerSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AutoscalerStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of autoscalers. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (AutoscalersScopedList element : autoscalerClient.aggregatedListAutoscalers(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListAutoscalersPagedResponse aggregatedListAutoscalers( + ProjectName project) { + AggregatedListAutoscalersHttpRequest request = + AggregatedListAutoscalersHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListAutoscalers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of autoscalers. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (AutoscalersScopedList element : autoscalerClient.aggregatedListAutoscalers(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListAutoscalersPagedResponse aggregatedListAutoscalers(String project) { + AggregatedListAutoscalersHttpRequest request = + AggregatedListAutoscalersHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListAutoscalers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of autoscalers. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListAutoscalersHttpRequest request = AggregatedListAutoscalersHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (AutoscalersScopedList element : autoscalerClient.aggregatedListAutoscalers(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListAutoscalersPagedResponse aggregatedListAutoscalers( + AggregatedListAutoscalersHttpRequest request) { + return aggregatedListAutoscalersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of autoscalers. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListAutoscalersHttpRequest request = AggregatedListAutoscalersHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListAutoscalersPagedResponse> future = autoscalerClient.aggregatedListAutoscalersPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (AutoscalersScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListAutoscalersHttpRequest, AggregatedListAutoscalersPagedResponse> + aggregatedListAutoscalersPagedCallable() { + return stub.aggregatedListAutoscalersPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of autoscalers. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListAutoscalersHttpRequest request = AggregatedListAutoscalersHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     AutoscalerAggregatedList response = autoscalerClient.aggregatedListAutoscalersCallable().call(request);
+   *     for (AutoscalersScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListAutoscalersCallable() { + return stub.aggregatedListAutoscalersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified autoscaler. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
+   *   Operation response = autoscalerClient.deleteAutoscaler(autoscaler);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteAutoscaler(ProjectZoneAutoscalerName autoscaler) { + + DeleteAutoscalerHttpRequest request = + DeleteAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler == null ? null : autoscaler.toString()) + .build(); + return deleteAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified autoscaler. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
+   *   Operation response = autoscalerClient.deleteAutoscaler(autoscaler.toString());
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteAutoscaler(String autoscaler) { + + DeleteAutoscalerHttpRequest request = + DeleteAutoscalerHttpRequest.newBuilder().setAutoscaler(autoscaler).build(); + return deleteAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified autoscaler. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
+   *   DeleteAutoscalerHttpRequest request = DeleteAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler.toString())
+   *     .build();
+   *   Operation response = autoscalerClient.deleteAutoscaler(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteAutoscaler(DeleteAutoscalerHttpRequest request) { + return deleteAutoscalerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified autoscaler. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
+   *   DeleteAutoscalerHttpRequest request = DeleteAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = autoscalerClient.deleteAutoscalerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteAutoscalerCallable() { + return stub.deleteAutoscalerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified autoscaler resource. Gets a list of available autoscalers by making a + * list() request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
+   *   Autoscaler response = autoscalerClient.getAutoscaler(autoscaler);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Autoscaler getAutoscaler(ProjectZoneAutoscalerName autoscaler) { + + GetAutoscalerHttpRequest request = + GetAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler == null ? null : autoscaler.toString()) + .build(); + return getAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified autoscaler resource. Gets a list of available autoscalers by making a + * list() request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
+   *   Autoscaler response = autoscalerClient.getAutoscaler(autoscaler.toString());
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Autoscaler getAutoscaler(String autoscaler) { + + GetAutoscalerHttpRequest request = + GetAutoscalerHttpRequest.newBuilder().setAutoscaler(autoscaler).build(); + return getAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified autoscaler resource. Gets a list of available autoscalers by making a + * list() request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
+   *   GetAutoscalerHttpRequest request = GetAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler.toString())
+   *     .build();
+   *   Autoscaler response = autoscalerClient.getAutoscaler(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Autoscaler getAutoscaler(GetAutoscalerHttpRequest request) { + return getAutoscalerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified autoscaler resource. Gets a list of available autoscalers by making a + * list() request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
+   *   GetAutoscalerHttpRequest request = GetAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler.toString())
+   *     .build();
+   *   ApiFuture<Autoscaler> future = autoscalerClient.getAutoscalerCallable().futureCall(request);
+   *   // Do something
+   *   Autoscaler response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getAutoscalerCallable() { + return stub.getAutoscalerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = autoscalerClient.insertAutoscaler(zone, autoscalerResource);
+   * }
+   * 
+ * + * @param zone Name of the zone for this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertAutoscaler(ProjectZoneName zone, Autoscaler autoscalerResource) { + + InsertAutoscalerHttpRequest request = + InsertAutoscalerHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .setAutoscalerResource(autoscalerResource) + .build(); + return insertAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = autoscalerClient.insertAutoscaler(zone.toString(), autoscalerResource);
+   * }
+   * 
+ * + * @param zone Name of the zone for this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertAutoscaler(String zone, Autoscaler autoscalerResource) { + + InsertAutoscalerHttpRequest request = + InsertAutoscalerHttpRequest.newBuilder() + .setZone(zone) + .setAutoscalerResource(autoscalerResource) + .build(); + return insertAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   InsertAutoscalerHttpRequest request = InsertAutoscalerHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   Operation response = autoscalerClient.insertAutoscaler(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertAutoscaler(InsertAutoscalerHttpRequest request) { + return insertAutoscalerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   InsertAutoscalerHttpRequest request = InsertAutoscalerHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   ApiFuture<Operation> future = autoscalerClient.insertAutoscalerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertAutoscalerCallable() { + return stub.insertAutoscalerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of autoscalers contained within the specified zone. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (Autoscaler element : autoscalerClient.listAutoscalers(zone).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone Name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListAutoscalersPagedResponse listAutoscalers(ProjectZoneName zone) { + ListAutoscalersHttpRequest request = + ListAutoscalersHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .build(); + return listAutoscalers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of autoscalers contained within the specified zone. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (Autoscaler element : autoscalerClient.listAutoscalers(zone.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone Name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListAutoscalersPagedResponse listAutoscalers(String zone) { + ListAutoscalersHttpRequest request = + ListAutoscalersHttpRequest.newBuilder().setZone(zone).build(); + return listAutoscalers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of autoscalers contained within the specified zone. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListAutoscalersHttpRequest request = ListAutoscalersHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   for (Autoscaler element : autoscalerClient.listAutoscalers(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListAutoscalersPagedResponse listAutoscalers(ListAutoscalersHttpRequest request) { + return listAutoscalersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of autoscalers contained within the specified zone. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListAutoscalersHttpRequest request = ListAutoscalersHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   ApiFuture<ListAutoscalersPagedResponse> future = autoscalerClient.listAutoscalersPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Autoscaler element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listAutoscalersPagedCallable() { + return stub.listAutoscalersPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of autoscalers contained within the specified zone. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListAutoscalersHttpRequest request = ListAutoscalersHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   while (true) {
+   *     AutoscalerList response = autoscalerClient.listAutoscalersCallable().call(request);
+   *     for (Autoscaler element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listAutoscalersCallable() { + return stub.listAutoscalersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. This + * method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = autoscalerClient.patchAutoscaler(autoscaler, zone, autoscalerResource);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to patch. + * @param zone Name of the zone for this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchAutoscaler( + String autoscaler, ProjectZoneName zone, Autoscaler autoscalerResource) { + + PatchAutoscalerHttpRequest request = + PatchAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler) + .setZone(zone == null ? null : zone.toString()) + .setAutoscalerResource(autoscalerResource) + .build(); + return patchAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. This + * method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = autoscalerClient.patchAutoscaler(autoscaler, zone.toString(), autoscalerResource);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to patch. + * @param zone Name of the zone for this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchAutoscaler( + String autoscaler, String zone, Autoscaler autoscalerResource) { + + PatchAutoscalerHttpRequest request = + PatchAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler) + .setZone(zone) + .setAutoscalerResource(autoscalerResource) + .build(); + return patchAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. This + * method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   PatchAutoscalerHttpRequest request = PatchAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler)
+   *     .setZone(zone.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   Operation response = autoscalerClient.patchAutoscaler(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchAutoscaler(PatchAutoscalerHttpRequest request) { + return patchAutoscalerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. This + * method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   PatchAutoscalerHttpRequest request = PatchAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler)
+   *     .setZone(zone.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   ApiFuture<Operation> future = autoscalerClient.patchAutoscalerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable patchAutoscalerCallable() { + return stub.patchAutoscalerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = autoscalerClient.updateAutoscaler(autoscaler, zone, autoscalerResource);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to update. + * @param zone Name of the zone for this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateAutoscaler( + String autoscaler, ProjectZoneName zone, Autoscaler autoscalerResource) { + + UpdateAutoscalerHttpRequest request = + UpdateAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler) + .setZone(zone == null ? null : zone.toString()) + .setAutoscalerResource(autoscalerResource) + .build(); + return updateAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = autoscalerClient.updateAutoscaler(autoscaler, zone.toString(), autoscalerResource);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to update. + * @param zone Name of the zone for this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateAutoscaler( + String autoscaler, String zone, Autoscaler autoscalerResource) { + + UpdateAutoscalerHttpRequest request = + UpdateAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler) + .setZone(zone) + .setAutoscalerResource(autoscalerResource) + .build(); + return updateAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   UpdateAutoscalerHttpRequest request = UpdateAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler)
+   *     .setZone(zone.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   Operation response = autoscalerClient.updateAutoscaler(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateAutoscaler(UpdateAutoscalerHttpRequest request) { + return updateAutoscalerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   UpdateAutoscalerHttpRequest request = UpdateAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler)
+   *     .setZone(zone.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   ApiFuture<Operation> future = autoscalerClient.updateAutoscalerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable updateAutoscalerCallable() { + return stub.updateAutoscalerCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListAutoscalersPagedResponse + extends AbstractPagedListResponse< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, AutoscalersScopedList, + AggregatedListAutoscalersPage, AggregatedListAutoscalersFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AutoscalersScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListAutoscalersPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public AggregatedListAutoscalersPagedResponse apply( + AggregatedListAutoscalersPage input) { + return new AggregatedListAutoscalersPagedResponse(input); + } + }); + } + + private AggregatedListAutoscalersPagedResponse(AggregatedListAutoscalersPage page) { + super(page, AggregatedListAutoscalersFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListAutoscalersPage + extends AbstractPage< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, AutoscalersScopedList, + AggregatedListAutoscalersPage> { + + private AggregatedListAutoscalersPage( + PageContext< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AutoscalersScopedList> + context, + AutoscalerAggregatedList response) { + super(context, response); + } + + private static AggregatedListAutoscalersPage createEmptyPage() { + return new AggregatedListAutoscalersPage(null, null); + } + + @Override + protected AggregatedListAutoscalersPage createPage( + PageContext< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AutoscalersScopedList> + context, + AutoscalerAggregatedList response) { + return new AggregatedListAutoscalersPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AutoscalersScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListAutoscalersFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, AutoscalersScopedList, + AggregatedListAutoscalersPage, AggregatedListAutoscalersFixedSizeCollection> { + + private AggregatedListAutoscalersFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListAutoscalersFixedSizeCollection createEmptyCollection() { + return new AggregatedListAutoscalersFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListAutoscalersFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListAutoscalersFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListAutoscalersPagedResponse + extends AbstractPagedListResponse< + ListAutoscalersHttpRequest, AutoscalerList, Autoscaler, ListAutoscalersPage, + ListAutoscalersFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListAutoscalersPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListAutoscalersPagedResponse apply(ListAutoscalersPage input) { + return new ListAutoscalersPagedResponse(input); + } + }); + } + + private ListAutoscalersPagedResponse(ListAutoscalersPage page) { + super(page, ListAutoscalersFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListAutoscalersPage + extends AbstractPage< + ListAutoscalersHttpRequest, AutoscalerList, Autoscaler, ListAutoscalersPage> { + + private ListAutoscalersPage( + PageContext context, + AutoscalerList response) { + super(context, response); + } + + private static ListAutoscalersPage createEmptyPage() { + return new ListAutoscalersPage(null, null); + } + + @Override + protected ListAutoscalersPage createPage( + PageContext context, + AutoscalerList response) { + return new ListAutoscalersPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListAutoscalersFixedSizeCollection + extends AbstractFixedSizeCollection< + ListAutoscalersHttpRequest, AutoscalerList, Autoscaler, ListAutoscalersPage, + ListAutoscalersFixedSizeCollection> { + + private ListAutoscalersFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListAutoscalersFixedSizeCollection createEmptyCollection() { + return new ListAutoscalersFixedSizeCollection(null, 0); + } + + @Override + protected ListAutoscalersFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListAutoscalersFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerList.java new file mode 100644 index 000000000000..ebf938b369cb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AutoscalerList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private AutoscalerList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private AutoscalerList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AutoscalerList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AutoscalerList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AutoscalerList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AutoscalerList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(AutoscalerList other) { + if (other == AutoscalerList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(AutoscalerList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Autoscaler items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public AutoscalerList build() { + + return new AutoscalerList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "AutoscalerList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AutoscalerList) { + AutoscalerList that = (AutoscalerList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerSettings.java new file mode 100644 index 000000000000..8ece391a0c68 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerSettings.java @@ -0,0 +1,256 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.AutoscalerClient.AggregatedListAutoscalersPagedResponse; +import static com.google.cloud.compute.v1.AutoscalerClient.ListAutoscalersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.AutoscalerStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link AutoscalerClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteAutoscaler to 30 seconds: + * + *

+ * 
+ * AutoscalerSettings.Builder autoscalerSettingsBuilder =
+ *     AutoscalerSettings.newBuilder();
+ * autoscalerSettingsBuilder.deleteAutoscalerSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * AutoscalerSettings autoscalerSettings = autoscalerSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AutoscalerSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListAutoscalers. */ + public PagedCallSettings< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AggregatedListAutoscalersPagedResponse> + aggregatedListAutoscalersSettings() { + return ((AutoscalerStubSettings) getStubSettings()).aggregatedListAutoscalersSettings(); + } + + /** Returns the object with the settings used for calls to deleteAutoscaler. */ + public UnaryCallSettings deleteAutoscalerSettings() { + return ((AutoscalerStubSettings) getStubSettings()).deleteAutoscalerSettings(); + } + + /** Returns the object with the settings used for calls to getAutoscaler. */ + public UnaryCallSettings getAutoscalerSettings() { + return ((AutoscalerStubSettings) getStubSettings()).getAutoscalerSettings(); + } + + /** Returns the object with the settings used for calls to insertAutoscaler. */ + public UnaryCallSettings insertAutoscalerSettings() { + return ((AutoscalerStubSettings) getStubSettings()).insertAutoscalerSettings(); + } + + /** Returns the object with the settings used for calls to listAutoscalers. */ + public PagedCallSettings + listAutoscalersSettings() { + return ((AutoscalerStubSettings) getStubSettings()).listAutoscalersSettings(); + } + + /** Returns the object with the settings used for calls to patchAutoscaler. */ + public UnaryCallSettings patchAutoscalerSettings() { + return ((AutoscalerStubSettings) getStubSettings()).patchAutoscalerSettings(); + } + + /** Returns the object with the settings used for calls to updateAutoscaler. */ + public UnaryCallSettings updateAutoscalerSettings() { + return ((AutoscalerStubSettings) getStubSettings()).updateAutoscalerSettings(); + } + + public static final AutoscalerSettings create(AutoscalerStubSettings stub) throws IOException { + return new AutoscalerSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return AutoscalerStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return AutoscalerStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return AutoscalerStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return AutoscalerStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return AutoscalerStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return AutoscalerStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return AutoscalerStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return AutoscalerStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected AutoscalerSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for AutoscalerSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(AutoscalerStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(AutoscalerStubSettings.newBuilder()); + } + + protected Builder(AutoscalerSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(AutoscalerStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public AutoscalerStubSettings.Builder getStubSettingsBuilder() { + return ((AutoscalerStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListAutoscalers. */ + public PagedCallSettings.Builder< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AggregatedListAutoscalersPagedResponse> + aggregatedListAutoscalersSettings() { + return getStubSettingsBuilder().aggregatedListAutoscalersSettings(); + } + + /** Returns the builder for the settings used for calls to deleteAutoscaler. */ + public UnaryCallSettings.Builder + deleteAutoscalerSettings() { + return getStubSettingsBuilder().deleteAutoscalerSettings(); + } + + /** Returns the builder for the settings used for calls to getAutoscaler. */ + public UnaryCallSettings.Builder getAutoscalerSettings() { + return getStubSettingsBuilder().getAutoscalerSettings(); + } + + /** Returns the builder for the settings used for calls to insertAutoscaler. */ + public UnaryCallSettings.Builder + insertAutoscalerSettings() { + return getStubSettingsBuilder().insertAutoscalerSettings(); + } + + /** Returns the builder for the settings used for calls to listAutoscalers. */ + public PagedCallSettings.Builder< + ListAutoscalersHttpRequest, AutoscalerList, ListAutoscalersPagedResponse> + listAutoscalersSettings() { + return getStubSettingsBuilder().listAutoscalersSettings(); + } + + /** Returns the builder for the settings used for calls to patchAutoscaler. */ + public UnaryCallSettings.Builder + patchAutoscalerSettings() { + return getStubSettingsBuilder().patchAutoscalerSettings(); + } + + /** Returns the builder for the settings used for calls to updateAutoscaler. */ + public UnaryCallSettings.Builder + updateAutoscalerSettings() { + return getStubSettingsBuilder().updateAutoscalerSettings(); + } + + @Override + public AutoscalerSettings build() throws IOException { + return new AutoscalerSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerStatusDetails.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerStatusDetails.java new file mode 100644 index 000000000000..23faa574e2d4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerStatusDetails.java @@ -0,0 +1,169 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AutoscalerStatusDetails implements ApiMessage { + private final String message; + private final String type; + + private AutoscalerStatusDetails() { + this.message = null; + this.type = null; + } + + private AutoscalerStatusDetails(String message, String type) { + this.message = message; + this.type = type; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("message")) { + return message; + } + if (fieldName.equals("type")) { + return type; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getMessage() { + return message; + } + + public String getType() { + return type; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AutoscalerStatusDetails prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AutoscalerStatusDetails getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AutoscalerStatusDetails DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AutoscalerStatusDetails(); + } + + public static class Builder { + private String message; + private String type; + + Builder() {} + + public Builder mergeFrom(AutoscalerStatusDetails other) { + if (other == AutoscalerStatusDetails.getDefaultInstance()) return this; + if (other.getMessage() != null) { + this.message = other.message; + } + if (other.getType() != null) { + this.type = other.type; + } + return this; + } + + Builder(AutoscalerStatusDetails source) { + this.message = source.message; + this.type = source.type; + } + + public String getMessage() { + return message; + } + + public Builder setMessage(String message) { + this.message = message; + return this; + } + + public String getType() { + return type; + } + + public Builder setType(String type) { + this.type = type; + return this; + } + + public AutoscalerStatusDetails build() { + + return new AutoscalerStatusDetails(message, type); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setMessage(this.message); + newBuilder.setType(this.type); + return newBuilder; + } + } + + @Override + public String toString() { + return "AutoscalerStatusDetails{" + "message=" + message + ", " + "type=" + type + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AutoscalerStatusDetails) { + AutoscalerStatusDetails that = (AutoscalerStatusDetails) o; + return Objects.equals(this.message, that.getMessage()) + && Objects.equals(this.type, that.getType()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(message, type); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalersScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalersScopedList.java new file mode 100644 index 000000000000..c8a2cc70631a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalersScopedList.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AutoscalersScopedList implements ApiMessage { + private final List autoscalers; + private final Warning warning; + + private AutoscalersScopedList() { + this.autoscalers = null; + this.warning = null; + } + + private AutoscalersScopedList(List autoscalers, Warning warning) { + this.autoscalers = autoscalers; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("autoscalers")) { + return autoscalers; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getAutoscalersList() { + return autoscalers; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AutoscalersScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AutoscalersScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AutoscalersScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AutoscalersScopedList(); + } + + public static class Builder { + private List autoscalers; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(AutoscalersScopedList other) { + if (other == AutoscalersScopedList.getDefaultInstance()) return this; + if (other.getAutoscalersList() != null) { + this.autoscalers = other.autoscalers; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(AutoscalersScopedList source) { + this.autoscalers = source.autoscalers; + this.warning = source.warning; + } + + public List getAutoscalersList() { + return autoscalers; + } + + public Builder addAllAutoscalers(List autoscalers) { + if (this.autoscalers == null) { + this.autoscalers = new ArrayList<>(autoscalers.size()); + } + this.autoscalers.addAll(autoscalers); + return this; + } + + public Builder addAutoscalers(Autoscaler autoscalers) { + this.autoscalers.add(autoscalers); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public AutoscalersScopedList build() { + + return new AutoscalersScopedList(autoscalers, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllAutoscalers(this.autoscalers); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "AutoscalersScopedList{" + + "autoscalers=" + + autoscalers + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AutoscalersScopedList) { + AutoscalersScopedList that = (AutoscalersScopedList) o; + return Objects.equals(this.autoscalers, that.getAutoscalersList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(autoscalers, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicy.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicy.java new file mode 100644 index 000000000000..9a8c18371125 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicy.java @@ -0,0 +1,321 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AutoscalingPolicy implements ApiMessage { + private final Integer coolDownPeriodSec; + private final AutoscalingPolicyCpuUtilization cpuUtilization; + private final List customMetricUtilizations; + private final AutoscalingPolicyLoadBalancingUtilization loadBalancingUtilization; + private final Integer maxNumReplicas; + private final Integer minNumReplicas; + + private AutoscalingPolicy() { + this.coolDownPeriodSec = null; + this.cpuUtilization = null; + this.customMetricUtilizations = null; + this.loadBalancingUtilization = null; + this.maxNumReplicas = null; + this.minNumReplicas = null; + } + + private AutoscalingPolicy( + Integer coolDownPeriodSec, + AutoscalingPolicyCpuUtilization cpuUtilization, + List customMetricUtilizations, + AutoscalingPolicyLoadBalancingUtilization loadBalancingUtilization, + Integer maxNumReplicas, + Integer minNumReplicas) { + this.coolDownPeriodSec = coolDownPeriodSec; + this.cpuUtilization = cpuUtilization; + this.customMetricUtilizations = customMetricUtilizations; + this.loadBalancingUtilization = loadBalancingUtilization; + this.maxNumReplicas = maxNumReplicas; + this.minNumReplicas = minNumReplicas; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("coolDownPeriodSec")) { + return coolDownPeriodSec; + } + if (fieldName.equals("cpuUtilization")) { + return cpuUtilization; + } + if (fieldName.equals("customMetricUtilizations")) { + return customMetricUtilizations; + } + if (fieldName.equals("loadBalancingUtilization")) { + return loadBalancingUtilization; + } + if (fieldName.equals("maxNumReplicas")) { + return maxNumReplicas; + } + if (fieldName.equals("minNumReplicas")) { + return minNumReplicas; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getCoolDownPeriodSec() { + return coolDownPeriodSec; + } + + public AutoscalingPolicyCpuUtilization getCpuUtilization() { + return cpuUtilization; + } + + public List getCustomMetricUtilizationsList() { + return customMetricUtilizations; + } + + public AutoscalingPolicyLoadBalancingUtilization getLoadBalancingUtilization() { + return loadBalancingUtilization; + } + + public Integer getMaxNumReplicas() { + return maxNumReplicas; + } + + public Integer getMinNumReplicas() { + return minNumReplicas; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AutoscalingPolicy prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AutoscalingPolicy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AutoscalingPolicy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AutoscalingPolicy(); + } + + public static class Builder { + private Integer coolDownPeriodSec; + private AutoscalingPolicyCpuUtilization cpuUtilization; + private List customMetricUtilizations; + private AutoscalingPolicyLoadBalancingUtilization loadBalancingUtilization; + private Integer maxNumReplicas; + private Integer minNumReplicas; + + Builder() {} + + public Builder mergeFrom(AutoscalingPolicy other) { + if (other == AutoscalingPolicy.getDefaultInstance()) return this; + if (other.getCoolDownPeriodSec() != null) { + this.coolDownPeriodSec = other.coolDownPeriodSec; + } + if (other.getCpuUtilization() != null) { + this.cpuUtilization = other.cpuUtilization; + } + if (other.getCustomMetricUtilizationsList() != null) { + this.customMetricUtilizations = other.customMetricUtilizations; + } + if (other.getLoadBalancingUtilization() != null) { + this.loadBalancingUtilization = other.loadBalancingUtilization; + } + if (other.getMaxNumReplicas() != null) { + this.maxNumReplicas = other.maxNumReplicas; + } + if (other.getMinNumReplicas() != null) { + this.minNumReplicas = other.minNumReplicas; + } + return this; + } + + Builder(AutoscalingPolicy source) { + this.coolDownPeriodSec = source.coolDownPeriodSec; + this.cpuUtilization = source.cpuUtilization; + this.customMetricUtilizations = source.customMetricUtilizations; + this.loadBalancingUtilization = source.loadBalancingUtilization; + this.maxNumReplicas = source.maxNumReplicas; + this.minNumReplicas = source.minNumReplicas; + } + + public Integer getCoolDownPeriodSec() { + return coolDownPeriodSec; + } + + public Builder setCoolDownPeriodSec(Integer coolDownPeriodSec) { + this.coolDownPeriodSec = coolDownPeriodSec; + return this; + } + + public AutoscalingPolicyCpuUtilization getCpuUtilization() { + return cpuUtilization; + } + + public Builder setCpuUtilization(AutoscalingPolicyCpuUtilization cpuUtilization) { + this.cpuUtilization = cpuUtilization; + return this; + } + + public List getCustomMetricUtilizationsList() { + return customMetricUtilizations; + } + + public Builder addAllCustomMetricUtilizations( + List customMetricUtilizations) { + if (this.customMetricUtilizations == null) { + this.customMetricUtilizations = new ArrayList<>(customMetricUtilizations.size()); + } + this.customMetricUtilizations.addAll(customMetricUtilizations); + return this; + } + + public Builder addCustomMetricUtilizations( + AutoscalingPolicyCustomMetricUtilization customMetricUtilizations) { + this.customMetricUtilizations.add(customMetricUtilizations); + return this; + } + + public AutoscalingPolicyLoadBalancingUtilization getLoadBalancingUtilization() { + return loadBalancingUtilization; + } + + public Builder setLoadBalancingUtilization( + AutoscalingPolicyLoadBalancingUtilization loadBalancingUtilization) { + this.loadBalancingUtilization = loadBalancingUtilization; + return this; + } + + public Integer getMaxNumReplicas() { + return maxNumReplicas; + } + + public Builder setMaxNumReplicas(Integer maxNumReplicas) { + this.maxNumReplicas = maxNumReplicas; + return this; + } + + public Integer getMinNumReplicas() { + return minNumReplicas; + } + + public Builder setMinNumReplicas(Integer minNumReplicas) { + this.minNumReplicas = minNumReplicas; + return this; + } + + public AutoscalingPolicy build() { + + return new AutoscalingPolicy( + coolDownPeriodSec, + cpuUtilization, + customMetricUtilizations, + loadBalancingUtilization, + maxNumReplicas, + minNumReplicas); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCoolDownPeriodSec(this.coolDownPeriodSec); + newBuilder.setCpuUtilization(this.cpuUtilization); + newBuilder.addAllCustomMetricUtilizations(this.customMetricUtilizations); + newBuilder.setLoadBalancingUtilization(this.loadBalancingUtilization); + newBuilder.setMaxNumReplicas(this.maxNumReplicas); + newBuilder.setMinNumReplicas(this.minNumReplicas); + return newBuilder; + } + } + + @Override + public String toString() { + return "AutoscalingPolicy{" + + "coolDownPeriodSec=" + + coolDownPeriodSec + + ", " + + "cpuUtilization=" + + cpuUtilization + + ", " + + "customMetricUtilizations=" + + customMetricUtilizations + + ", " + + "loadBalancingUtilization=" + + loadBalancingUtilization + + ", " + + "maxNumReplicas=" + + maxNumReplicas + + ", " + + "minNumReplicas=" + + minNumReplicas + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AutoscalingPolicy) { + AutoscalingPolicy that = (AutoscalingPolicy) o; + return Objects.equals(this.coolDownPeriodSec, that.getCoolDownPeriodSec()) + && Objects.equals(this.cpuUtilization, that.getCpuUtilization()) + && Objects.equals(this.customMetricUtilizations, that.getCustomMetricUtilizationsList()) + && Objects.equals(this.loadBalancingUtilization, that.getLoadBalancingUtilization()) + && Objects.equals(this.maxNumReplicas, that.getMaxNumReplicas()) + && Objects.equals(this.minNumReplicas, that.getMinNumReplicas()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + coolDownPeriodSec, + cpuUtilization, + customMetricUtilizations, + loadBalancingUtilization, + maxNumReplicas, + minNumReplicas); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicyCpuUtilization.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicyCpuUtilization.java new file mode 100644 index 000000000000..5d195b49d90e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicyCpuUtilization.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AutoscalingPolicyCpuUtilization implements ApiMessage { + private final Double utilizationTarget; + + private AutoscalingPolicyCpuUtilization() { + this.utilizationTarget = null; + } + + private AutoscalingPolicyCpuUtilization(Double utilizationTarget) { + this.utilizationTarget = utilizationTarget; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("utilizationTarget")) { + return utilizationTarget; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Double getUtilizationTarget() { + return utilizationTarget; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AutoscalingPolicyCpuUtilization prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AutoscalingPolicyCpuUtilization getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AutoscalingPolicyCpuUtilization DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AutoscalingPolicyCpuUtilization(); + } + + public static class Builder { + private Double utilizationTarget; + + Builder() {} + + public Builder mergeFrom(AutoscalingPolicyCpuUtilization other) { + if (other == AutoscalingPolicyCpuUtilization.getDefaultInstance()) return this; + if (other.getUtilizationTarget() != null) { + this.utilizationTarget = other.utilizationTarget; + } + return this; + } + + Builder(AutoscalingPolicyCpuUtilization source) { + this.utilizationTarget = source.utilizationTarget; + } + + public Double getUtilizationTarget() { + return utilizationTarget; + } + + public Builder setUtilizationTarget(Double utilizationTarget) { + this.utilizationTarget = utilizationTarget; + return this; + } + + public AutoscalingPolicyCpuUtilization build() { + return new AutoscalingPolicyCpuUtilization(utilizationTarget); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setUtilizationTarget(this.utilizationTarget); + return newBuilder; + } + } + + @Override + public String toString() { + return "AutoscalingPolicyCpuUtilization{" + "utilizationTarget=" + utilizationTarget + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AutoscalingPolicyCpuUtilization) { + AutoscalingPolicyCpuUtilization that = (AutoscalingPolicyCpuUtilization) o; + return Objects.equals(this.utilizationTarget, that.getUtilizationTarget()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(utilizationTarget); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicyCustomMetricUtilization.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicyCustomMetricUtilization.java new file mode 100644 index 000000000000..2098a3495b66 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicyCustomMetricUtilization.java @@ -0,0 +1,206 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AutoscalingPolicyCustomMetricUtilization implements ApiMessage { + private final String metric; + private final Double utilizationTarget; + private final String utilizationTargetType; + + private AutoscalingPolicyCustomMetricUtilization() { + this.metric = null; + this.utilizationTarget = null; + this.utilizationTargetType = null; + } + + private AutoscalingPolicyCustomMetricUtilization( + String metric, Double utilizationTarget, String utilizationTargetType) { + this.metric = metric; + this.utilizationTarget = utilizationTarget; + this.utilizationTargetType = utilizationTargetType; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("metric")) { + return metric; + } + if (fieldName.equals("utilizationTarget")) { + return utilizationTarget; + } + if (fieldName.equals("utilizationTargetType")) { + return utilizationTargetType; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getMetric() { + return metric; + } + + public Double getUtilizationTarget() { + return utilizationTarget; + } + + public String getUtilizationTargetType() { + return utilizationTargetType; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AutoscalingPolicyCustomMetricUtilization prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AutoscalingPolicyCustomMetricUtilization getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AutoscalingPolicyCustomMetricUtilization DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AutoscalingPolicyCustomMetricUtilization(); + } + + public static class Builder { + private String metric; + private Double utilizationTarget; + private String utilizationTargetType; + + Builder() {} + + public Builder mergeFrom(AutoscalingPolicyCustomMetricUtilization other) { + if (other == AutoscalingPolicyCustomMetricUtilization.getDefaultInstance()) return this; + if (other.getMetric() != null) { + this.metric = other.metric; + } + if (other.getUtilizationTarget() != null) { + this.utilizationTarget = other.utilizationTarget; + } + if (other.getUtilizationTargetType() != null) { + this.utilizationTargetType = other.utilizationTargetType; + } + return this; + } + + Builder(AutoscalingPolicyCustomMetricUtilization source) { + this.metric = source.metric; + this.utilizationTarget = source.utilizationTarget; + this.utilizationTargetType = source.utilizationTargetType; + } + + public String getMetric() { + return metric; + } + + public Builder setMetric(String metric) { + this.metric = metric; + return this; + } + + public Double getUtilizationTarget() { + return utilizationTarget; + } + + public Builder setUtilizationTarget(Double utilizationTarget) { + this.utilizationTarget = utilizationTarget; + return this; + } + + public String getUtilizationTargetType() { + return utilizationTargetType; + } + + public Builder setUtilizationTargetType(String utilizationTargetType) { + this.utilizationTargetType = utilizationTargetType; + return this; + } + + public AutoscalingPolicyCustomMetricUtilization build() { + + return new AutoscalingPolicyCustomMetricUtilization( + metric, utilizationTarget, utilizationTargetType); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setMetric(this.metric); + newBuilder.setUtilizationTarget(this.utilizationTarget); + newBuilder.setUtilizationTargetType(this.utilizationTargetType); + return newBuilder; + } + } + + @Override + public String toString() { + return "AutoscalingPolicyCustomMetricUtilization{" + + "metric=" + + metric + + ", " + + "utilizationTarget=" + + utilizationTarget + + ", " + + "utilizationTargetType=" + + utilizationTargetType + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AutoscalingPolicyCustomMetricUtilization) { + AutoscalingPolicyCustomMetricUtilization that = (AutoscalingPolicyCustomMetricUtilization) o; + return Objects.equals(this.metric, that.getMetric()) + && Objects.equals(this.utilizationTarget, that.getUtilizationTarget()) + && Objects.equals(this.utilizationTargetType, that.getUtilizationTargetType()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(metric, utilizationTarget, utilizationTargetType); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicyLoadBalancingUtilization.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicyLoadBalancingUtilization.java new file mode 100644 index 000000000000..e7b3fa592d42 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalingPolicyLoadBalancingUtilization.java @@ -0,0 +1,146 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class AutoscalingPolicyLoadBalancingUtilization implements ApiMessage { + private final Double utilizationTarget; + + private AutoscalingPolicyLoadBalancingUtilization() { + this.utilizationTarget = null; + } + + private AutoscalingPolicyLoadBalancingUtilization(Double utilizationTarget) { + this.utilizationTarget = utilizationTarget; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("utilizationTarget")) { + return utilizationTarget; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Double getUtilizationTarget() { + return utilizationTarget; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(AutoscalingPolicyLoadBalancingUtilization prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static AutoscalingPolicyLoadBalancingUtilization getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final AutoscalingPolicyLoadBalancingUtilization DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new AutoscalingPolicyLoadBalancingUtilization(); + } + + public static class Builder { + private Double utilizationTarget; + + Builder() {} + + public Builder mergeFrom(AutoscalingPolicyLoadBalancingUtilization other) { + if (other == AutoscalingPolicyLoadBalancingUtilization.getDefaultInstance()) return this; + if (other.getUtilizationTarget() != null) { + this.utilizationTarget = other.utilizationTarget; + } + return this; + } + + Builder(AutoscalingPolicyLoadBalancingUtilization source) { + this.utilizationTarget = source.utilizationTarget; + } + + public Double getUtilizationTarget() { + return utilizationTarget; + } + + public Builder setUtilizationTarget(Double utilizationTarget) { + this.utilizationTarget = utilizationTarget; + return this; + } + + public AutoscalingPolicyLoadBalancingUtilization build() { + return new AutoscalingPolicyLoadBalancingUtilization(utilizationTarget); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setUtilizationTarget(this.utilizationTarget); + return newBuilder; + } + } + + @Override + public String toString() { + return "AutoscalingPolicyLoadBalancingUtilization{" + + "utilizationTarget=" + + utilizationTarget + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof AutoscalingPolicyLoadBalancingUtilization) { + AutoscalingPolicyLoadBalancingUtilization that = + (AutoscalingPolicyLoadBalancingUtilization) o; + return Objects.equals(this.utilizationTarget, that.getUtilizationTarget()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(utilizationTarget); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Backend.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Backend.java new file mode 100644 index 000000000000..07e1da2dc268 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Backend.java @@ -0,0 +1,405 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Backend implements ApiMessage { + private final String balancingMode; + private final Float capacityScaler; + private final String description; + private final String group; + private final Integer maxConnections; + private final Integer maxConnectionsPerInstance; + private final Integer maxRate; + private final Float maxRatePerInstance; + private final Float maxUtilization; + + private Backend() { + this.balancingMode = null; + this.capacityScaler = null; + this.description = null; + this.group = null; + this.maxConnections = null; + this.maxConnectionsPerInstance = null; + this.maxRate = null; + this.maxRatePerInstance = null; + this.maxUtilization = null; + } + + private Backend( + String balancingMode, + Float capacityScaler, + String description, + String group, + Integer maxConnections, + Integer maxConnectionsPerInstance, + Integer maxRate, + Float maxRatePerInstance, + Float maxUtilization) { + this.balancingMode = balancingMode; + this.capacityScaler = capacityScaler; + this.description = description; + this.group = group; + this.maxConnections = maxConnections; + this.maxConnectionsPerInstance = maxConnectionsPerInstance; + this.maxRate = maxRate; + this.maxRatePerInstance = maxRatePerInstance; + this.maxUtilization = maxUtilization; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("balancingMode")) { + return balancingMode; + } + if (fieldName.equals("capacityScaler")) { + return capacityScaler; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("group")) { + return group; + } + if (fieldName.equals("maxConnections")) { + return maxConnections; + } + if (fieldName.equals("maxConnectionsPerInstance")) { + return maxConnectionsPerInstance; + } + if (fieldName.equals("maxRate")) { + return maxRate; + } + if (fieldName.equals("maxRatePerInstance")) { + return maxRatePerInstance; + } + if (fieldName.equals("maxUtilization")) { + return maxUtilization; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getBalancingMode() { + return balancingMode; + } + + public Float getCapacityScaler() { + return capacityScaler; + } + + public String getDescription() { + return description; + } + + public String getGroup() { + return group; + } + + public Integer getMaxConnections() { + return maxConnections; + } + + public Integer getMaxConnectionsPerInstance() { + return maxConnectionsPerInstance; + } + + public Integer getMaxRate() { + return maxRate; + } + + public Float getMaxRatePerInstance() { + return maxRatePerInstance; + } + + public Float getMaxUtilization() { + return maxUtilization; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Backend prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Backend getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Backend DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Backend(); + } + + public static class Builder { + private String balancingMode; + private Float capacityScaler; + private String description; + private String group; + private Integer maxConnections; + private Integer maxConnectionsPerInstance; + private Integer maxRate; + private Float maxRatePerInstance; + private Float maxUtilization; + + Builder() {} + + public Builder mergeFrom(Backend other) { + if (other == Backend.getDefaultInstance()) return this; + if (other.getBalancingMode() != null) { + this.balancingMode = other.balancingMode; + } + if (other.getCapacityScaler() != null) { + this.capacityScaler = other.capacityScaler; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getGroup() != null) { + this.group = other.group; + } + if (other.getMaxConnections() != null) { + this.maxConnections = other.maxConnections; + } + if (other.getMaxConnectionsPerInstance() != null) { + this.maxConnectionsPerInstance = other.maxConnectionsPerInstance; + } + if (other.getMaxRate() != null) { + this.maxRate = other.maxRate; + } + if (other.getMaxRatePerInstance() != null) { + this.maxRatePerInstance = other.maxRatePerInstance; + } + if (other.getMaxUtilization() != null) { + this.maxUtilization = other.maxUtilization; + } + return this; + } + + Builder(Backend source) { + this.balancingMode = source.balancingMode; + this.capacityScaler = source.capacityScaler; + this.description = source.description; + this.group = source.group; + this.maxConnections = source.maxConnections; + this.maxConnectionsPerInstance = source.maxConnectionsPerInstance; + this.maxRate = source.maxRate; + this.maxRatePerInstance = source.maxRatePerInstance; + this.maxUtilization = source.maxUtilization; + } + + public String getBalancingMode() { + return balancingMode; + } + + public Builder setBalancingMode(String balancingMode) { + this.balancingMode = balancingMode; + return this; + } + + public Float getCapacityScaler() { + return capacityScaler; + } + + public Builder setCapacityScaler(Float capacityScaler) { + this.capacityScaler = capacityScaler; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getGroup() { + return group; + } + + public Builder setGroup(String group) { + this.group = group; + return this; + } + + public Integer getMaxConnections() { + return maxConnections; + } + + public Builder setMaxConnections(Integer maxConnections) { + this.maxConnections = maxConnections; + return this; + } + + public Integer getMaxConnectionsPerInstance() { + return maxConnectionsPerInstance; + } + + public Builder setMaxConnectionsPerInstance(Integer maxConnectionsPerInstance) { + this.maxConnectionsPerInstance = maxConnectionsPerInstance; + return this; + } + + public Integer getMaxRate() { + return maxRate; + } + + public Builder setMaxRate(Integer maxRate) { + this.maxRate = maxRate; + return this; + } + + public Float getMaxRatePerInstance() { + return maxRatePerInstance; + } + + public Builder setMaxRatePerInstance(Float maxRatePerInstance) { + this.maxRatePerInstance = maxRatePerInstance; + return this; + } + + public Float getMaxUtilization() { + return maxUtilization; + } + + public Builder setMaxUtilization(Float maxUtilization) { + this.maxUtilization = maxUtilization; + return this; + } + + public Backend build() { + + return new Backend( + balancingMode, + capacityScaler, + description, + group, + maxConnections, + maxConnectionsPerInstance, + maxRate, + maxRatePerInstance, + maxUtilization); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setBalancingMode(this.balancingMode); + newBuilder.setCapacityScaler(this.capacityScaler); + newBuilder.setDescription(this.description); + newBuilder.setGroup(this.group); + newBuilder.setMaxConnections(this.maxConnections); + newBuilder.setMaxConnectionsPerInstance(this.maxConnectionsPerInstance); + newBuilder.setMaxRate(this.maxRate); + newBuilder.setMaxRatePerInstance(this.maxRatePerInstance); + newBuilder.setMaxUtilization(this.maxUtilization); + return newBuilder; + } + } + + @Override + public String toString() { + return "Backend{" + + "balancingMode=" + + balancingMode + + ", " + + "capacityScaler=" + + capacityScaler + + ", " + + "description=" + + description + + ", " + + "group=" + + group + + ", " + + "maxConnections=" + + maxConnections + + ", " + + "maxConnectionsPerInstance=" + + maxConnectionsPerInstance + + ", " + + "maxRate=" + + maxRate + + ", " + + "maxRatePerInstance=" + + maxRatePerInstance + + ", " + + "maxUtilization=" + + maxUtilization + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Backend) { + Backend that = (Backend) o; + return Objects.equals(this.balancingMode, that.getBalancingMode()) + && Objects.equals(this.capacityScaler, that.getCapacityScaler()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.group, that.getGroup()) + && Objects.equals(this.maxConnections, that.getMaxConnections()) + && Objects.equals(this.maxConnectionsPerInstance, that.getMaxConnectionsPerInstance()) + && Objects.equals(this.maxRate, that.getMaxRate()) + && Objects.equals(this.maxRatePerInstance, that.getMaxRatePerInstance()) + && Objects.equals(this.maxUtilization, that.getMaxUtilization()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + balancingMode, + capacityScaler, + description, + group, + maxConnections, + maxConnectionsPerInstance, + maxRate, + maxRatePerInstance, + maxUtilization); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucket.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucket.java new file mode 100644 index 000000000000..31d2b09925c8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucket.java @@ -0,0 +1,359 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class BackendBucket implements ApiMessage { + private final String bucketName; + private final String creationTimestamp; + private final String description; + private final Boolean enableCdn; + private final String id; + private final String kind; + private final String name; + private final String selfLink; + + private BackendBucket() { + this.bucketName = null; + this.creationTimestamp = null; + this.description = null; + this.enableCdn = null; + this.id = null; + this.kind = null; + this.name = null; + this.selfLink = null; + } + + private BackendBucket( + String bucketName, + String creationTimestamp, + String description, + Boolean enableCdn, + String id, + String kind, + String name, + String selfLink) { + this.bucketName = bucketName; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.enableCdn = enableCdn; + this.id = id; + this.kind = kind; + this.name = name; + this.selfLink = selfLink; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("bucketName")) { + return bucketName; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("enableCdn")) { + return enableCdn; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getBucketName() { + return bucketName; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public Boolean getEnableCdn() { + return enableCdn; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getSelfLink() { + return selfLink; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(BackendBucket prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static BackendBucket getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final BackendBucket DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new BackendBucket(); + } + + public static class Builder { + private String bucketName; + private String creationTimestamp; + private String description; + private Boolean enableCdn; + private String id; + private String kind; + private String name; + private String selfLink; + + Builder() {} + + public Builder mergeFrom(BackendBucket other) { + if (other == BackendBucket.getDefaultInstance()) return this; + if (other.getBucketName() != null) { + this.bucketName = other.bucketName; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getEnableCdn() != null) { + this.enableCdn = other.enableCdn; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + return this; + } + + Builder(BackendBucket source) { + this.bucketName = source.bucketName; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.enableCdn = source.enableCdn; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.selfLink = source.selfLink; + } + + public String getBucketName() { + return bucketName; + } + + public Builder setBucketName(String bucketName) { + this.bucketName = bucketName; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public Boolean getEnableCdn() { + return enableCdn; + } + + public Builder setEnableCdn(Boolean enableCdn) { + this.enableCdn = enableCdn; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public BackendBucket build() { + + return new BackendBucket( + bucketName, creationTimestamp, description, enableCdn, id, kind, name, selfLink); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setBucketName(this.bucketName); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setEnableCdn(this.enableCdn); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setSelfLink(this.selfLink); + return newBuilder; + } + } + + @Override + public String toString() { + return "BackendBucket{" + + "bucketName=" + + bucketName + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "enableCdn=" + + enableCdn + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "selfLink=" + + selfLink + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BackendBucket) { + BackendBucket that = (BackendBucket) o; + return Objects.equals(this.bucketName, that.getBucketName()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.enableCdn, that.getEnableCdn()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.selfLink, that.getSelfLink()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + bucketName, creationTimestamp, description, enableCdn, id, kind, name, selfLink); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketClient.java new file mode 100644 index 000000000000..2704697a98bb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketClient.java @@ -0,0 +1,946 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.BackendBucketStub; +import com.google.cloud.compute.v1.stub.BackendBucketStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+ *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+ *   Operation response = backendBucketClient.deleteBackendBucket(backendBucket);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the backendBucketClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of BackendBucketSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * BackendBucketSettings backendBucketSettings =
+ *     BackendBucketSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * BackendBucketClient backendBucketClient =
+ *     BackendBucketClient.create(backendBucketSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * BackendBucketSettings backendBucketSettings =
+ *     BackendBucketSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * BackendBucketClient backendBucketClient =
+ *     BackendBucketClient.create(backendBucketSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BackendBucketClient implements BackgroundResource { + private final BackendBucketSettings settings; + private final BackendBucketStub stub; + + /** Constructs an instance of BackendBucketClient with default settings. */ + public static final BackendBucketClient create() throws IOException { + return create(BackendBucketSettings.newBuilder().build()); + } + + /** + * Constructs an instance of BackendBucketClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final BackendBucketClient create(BackendBucketSettings settings) + throws IOException { + return new BackendBucketClient(settings); + } + + /** + * Constructs an instance of BackendBucketClient, using the given stub for making calls. This is + * for advanced usage - prefer to use BackendBucketSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final BackendBucketClient create(BackendBucketStub stub) { + return new BackendBucketClient(stub); + } + + /** + * Constructs an instance of BackendBucketClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected BackendBucketClient(BackendBucketSettings settings) throws IOException { + this.settings = settings; + this.stub = ((BackendBucketStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected BackendBucketClient(BackendBucketStub stub) { + this.settings = null; + this.stub = stub; + } + + public final BackendBucketSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public BackendBucketStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified BackendBucket resource. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   Operation response = backendBucketClient.deleteBackendBucket(backendBucket);
+   * }
+   * 
+ * + * @param backendBucket Name of the BackendBucket resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteBackendBucket(ProjectGlobalBackendBucketName backendBucket) { + + DeleteBackendBucketHttpRequest request = + DeleteBackendBucketHttpRequest.newBuilder() + .setBackendBucket(backendBucket == null ? null : backendBucket.toString()) + .build(); + return deleteBackendBucket(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified BackendBucket resource. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   Operation response = backendBucketClient.deleteBackendBucket(backendBucket.toString());
+   * }
+   * 
+ * + * @param backendBucket Name of the BackendBucket resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteBackendBucket(String backendBucket) { + + DeleteBackendBucketHttpRequest request = + DeleteBackendBucketHttpRequest.newBuilder().setBackendBucket(backendBucket).build(); + return deleteBackendBucket(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified BackendBucket resource. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   DeleteBackendBucketHttpRequest request = DeleteBackendBucketHttpRequest.newBuilder()
+   *     .setBackendBucket(backendBucket.toString())
+   *     .build();
+   *   Operation response = backendBucketClient.deleteBackendBucket(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteBackendBucket(DeleteBackendBucketHttpRequest request) { + return deleteBackendBucketCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified BackendBucket resource. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   DeleteBackendBucketHttpRequest request = DeleteBackendBucketHttpRequest.newBuilder()
+   *     .setBackendBucket(backendBucket.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = backendBucketClient.deleteBackendBucketCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteBackendBucketCallable() { + return stub.deleteBackendBucketCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified BackendBucket resource. Gets a list of available backend buckets by + * making a list() request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   BackendBucket response = backendBucketClient.getBackendBucket(backendBucket);
+   * }
+   * 
+ * + * @param backendBucket Name of the BackendBucket resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendBucket getBackendBucket(ProjectGlobalBackendBucketName backendBucket) { + + GetBackendBucketHttpRequest request = + GetBackendBucketHttpRequest.newBuilder() + .setBackendBucket(backendBucket == null ? null : backendBucket.toString()) + .build(); + return getBackendBucket(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified BackendBucket resource. Gets a list of available backend buckets by + * making a list() request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   BackendBucket response = backendBucketClient.getBackendBucket(backendBucket.toString());
+   * }
+   * 
+ * + * @param backendBucket Name of the BackendBucket resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendBucket getBackendBucket(String backendBucket) { + + GetBackendBucketHttpRequest request = + GetBackendBucketHttpRequest.newBuilder().setBackendBucket(backendBucket).build(); + return getBackendBucket(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified BackendBucket resource. Gets a list of available backend buckets by + * making a list() request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   GetBackendBucketHttpRequest request = GetBackendBucketHttpRequest.newBuilder()
+   *     .setBackendBucket(backendBucket.toString())
+   *     .build();
+   *   BackendBucket response = backendBucketClient.getBackendBucket(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendBucket getBackendBucket(GetBackendBucketHttpRequest request) { + return getBackendBucketCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified BackendBucket resource. Gets a list of available backend buckets by + * making a list() request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   GetBackendBucketHttpRequest request = GetBackendBucketHttpRequest.newBuilder()
+   *     .setBackendBucket(backendBucket.toString())
+   *     .build();
+   *   ApiFuture<BackendBucket> future = backendBucketClient.getBackendBucketCallable().futureCall(request);
+   *   // Do something
+   *   BackendBucket response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getBackendBucketCallable() { + return stub.getBackendBucketCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a BackendBucket resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   Operation response = backendBucketClient.insertBackendBucket(project, backendBucketResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param backendBucketResource A BackendBucket resource. This resource defines a Cloud Storage + * bucket. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertBackendBucket( + ProjectName project, BackendBucket backendBucketResource) { + + InsertBackendBucketHttpRequest request = + InsertBackendBucketHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setBackendBucketResource(backendBucketResource) + .build(); + return insertBackendBucket(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a BackendBucket resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   Operation response = backendBucketClient.insertBackendBucket(project.toString(), backendBucketResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param backendBucketResource A BackendBucket resource. This resource defines a Cloud Storage + * bucket. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertBackendBucket(String project, BackendBucket backendBucketResource) { + + InsertBackendBucketHttpRequest request = + InsertBackendBucketHttpRequest.newBuilder() + .setProject(project) + .setBackendBucketResource(backendBucketResource) + .build(); + return insertBackendBucket(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a BackendBucket resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   InsertBackendBucketHttpRequest request = InsertBackendBucketHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setBackendBucketResource(backendBucketResource)
+   *     .build();
+   *   Operation response = backendBucketClient.insertBackendBucket(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertBackendBucket(InsertBackendBucketHttpRequest request) { + return insertBackendBucketCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a BackendBucket resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   InsertBackendBucketHttpRequest request = InsertBackendBucketHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setBackendBucketResource(backendBucketResource)
+   *     .build();
+   *   ApiFuture<Operation> future = backendBucketClient.insertBackendBucketCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertBackendBucketCallable() { + return stub.insertBackendBucketCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of BackendBucket resources available to the specified project. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (BackendBucket element : backendBucketClient.listBackendBuckets(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListBackendBucketsPagedResponse listBackendBuckets(ProjectName project) { + ListBackendBucketsHttpRequest request = + ListBackendBucketsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listBackendBuckets(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of BackendBucket resources available to the specified project. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (BackendBucket element : backendBucketClient.listBackendBuckets(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListBackendBucketsPagedResponse listBackendBuckets(String project) { + ListBackendBucketsHttpRequest request = + ListBackendBucketsHttpRequest.newBuilder().setProject(project).build(); + return listBackendBuckets(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of BackendBucket resources available to the specified project. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListBackendBucketsHttpRequest request = ListBackendBucketsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (BackendBucket element : backendBucketClient.listBackendBuckets(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListBackendBucketsPagedResponse listBackendBuckets( + ListBackendBucketsHttpRequest request) { + return listBackendBucketsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of BackendBucket resources available to the specified project. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListBackendBucketsHttpRequest request = ListBackendBucketsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListBackendBucketsPagedResponse> future = backendBucketClient.listBackendBucketsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (BackendBucket element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listBackendBucketsPagedCallable() { + return stub.listBackendBucketsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of BackendBucket resources available to the specified project. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListBackendBucketsHttpRequest request = ListBackendBucketsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     BackendBucketList response = backendBucketClient.listBackendBucketsCallable().call(request);
+   *     for (BackendBucket element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listBackendBucketsCallable() { + return stub.listBackendBucketsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendBucket resource with the data included in the request. This method + * supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   Operation response = backendBucketClient.patchBackendBucket(backendBucket, backendBucketResource);
+   * }
+   * 
+ * + * @param backendBucket Name of the BackendBucket resource to patch. + * @param backendBucketResource A BackendBucket resource. This resource defines a Cloud Storage + * bucket. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchBackendBucket( + ProjectGlobalBackendBucketName backendBucket, BackendBucket backendBucketResource) { + + PatchBackendBucketHttpRequest request = + PatchBackendBucketHttpRequest.newBuilder() + .setBackendBucket(backendBucket == null ? null : backendBucket.toString()) + .setBackendBucketResource(backendBucketResource) + .build(); + return patchBackendBucket(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendBucket resource with the data included in the request. This method + * supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   Operation response = backendBucketClient.patchBackendBucket(backendBucket.toString(), backendBucketResource);
+   * }
+   * 
+ * + * @param backendBucket Name of the BackendBucket resource to patch. + * @param backendBucketResource A BackendBucket resource. This resource defines a Cloud Storage + * bucket. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchBackendBucket( + String backendBucket, BackendBucket backendBucketResource) { + + PatchBackendBucketHttpRequest request = + PatchBackendBucketHttpRequest.newBuilder() + .setBackendBucket(backendBucket) + .setBackendBucketResource(backendBucketResource) + .build(); + return patchBackendBucket(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendBucket resource with the data included in the request. This method + * supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   PatchBackendBucketHttpRequest request = PatchBackendBucketHttpRequest.newBuilder()
+   *     .setBackendBucket(backendBucket.toString())
+   *     .setBackendBucketResource(backendBucketResource)
+   *     .build();
+   *   Operation response = backendBucketClient.patchBackendBucket(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchBackendBucket(PatchBackendBucketHttpRequest request) { + return patchBackendBucketCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendBucket resource with the data included in the request. This method + * supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   PatchBackendBucketHttpRequest request = PatchBackendBucketHttpRequest.newBuilder()
+   *     .setBackendBucket(backendBucket.toString())
+   *     .setBackendBucketResource(backendBucketResource)
+   *     .build();
+   *   ApiFuture<Operation> future = backendBucketClient.patchBackendBucketCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + patchBackendBucketCallable() { + return stub.patchBackendBucketCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendBucket resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   Operation response = backendBucketClient.updateBackendBucket(backendBucket, backendBucketResource);
+   * }
+   * 
+ * + * @param backendBucket Name of the BackendBucket resource to update. + * @param backendBucketResource A BackendBucket resource. This resource defines a Cloud Storage + * bucket. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateBackendBucket( + ProjectGlobalBackendBucketName backendBucket, BackendBucket backendBucketResource) { + + UpdateBackendBucketHttpRequest request = + UpdateBackendBucketHttpRequest.newBuilder() + .setBackendBucket(backendBucket == null ? null : backendBucket.toString()) + .setBackendBucketResource(backendBucketResource) + .build(); + return updateBackendBucket(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendBucket resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   Operation response = backendBucketClient.updateBackendBucket(backendBucket.toString(), backendBucketResource);
+   * }
+   * 
+ * + * @param backendBucket Name of the BackendBucket resource to update. + * @param backendBucketResource A BackendBucket resource. This resource defines a Cloud Storage + * bucket. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateBackendBucket( + String backendBucket, BackendBucket backendBucketResource) { + + UpdateBackendBucketHttpRequest request = + UpdateBackendBucketHttpRequest.newBuilder() + .setBackendBucket(backendBucket) + .setBackendBucketResource(backendBucketResource) + .build(); + return updateBackendBucket(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendBucket resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   UpdateBackendBucketHttpRequest request = UpdateBackendBucketHttpRequest.newBuilder()
+   *     .setBackendBucket(backendBucket.toString())
+   *     .setBackendBucketResource(backendBucketResource)
+   *     .build();
+   *   Operation response = backendBucketClient.updateBackendBucket(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateBackendBucket(UpdateBackendBucketHttpRequest request) { + return updateBackendBucketCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendBucket resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+   *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+   *   BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
+   *   UpdateBackendBucketHttpRequest request = UpdateBackendBucketHttpRequest.newBuilder()
+   *     .setBackendBucket(backendBucket.toString())
+   *     .setBackendBucketResource(backendBucketResource)
+   *     .build();
+   *   ApiFuture<Operation> future = backendBucketClient.updateBackendBucketCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + updateBackendBucketCallable() { + return stub.updateBackendBucketCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListBackendBucketsPagedResponse + extends AbstractPagedListResponse< + ListBackendBucketsHttpRequest, BackendBucketList, BackendBucket, ListBackendBucketsPage, + ListBackendBucketsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListBackendBucketsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListBackendBucketsPagedResponse apply(ListBackendBucketsPage input) { + return new ListBackendBucketsPagedResponse(input); + } + }); + } + + private ListBackendBucketsPagedResponse(ListBackendBucketsPage page) { + super(page, ListBackendBucketsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListBackendBucketsPage + extends AbstractPage< + ListBackendBucketsHttpRequest, BackendBucketList, BackendBucket, ListBackendBucketsPage> { + + private ListBackendBucketsPage( + PageContext context, + BackendBucketList response) { + super(context, response); + } + + private static ListBackendBucketsPage createEmptyPage() { + return new ListBackendBucketsPage(null, null); + } + + @Override + protected ListBackendBucketsPage createPage( + PageContext context, + BackendBucketList response) { + return new ListBackendBucketsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListBackendBucketsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListBackendBucketsHttpRequest, BackendBucketList, BackendBucket, ListBackendBucketsPage, + ListBackendBucketsFixedSizeCollection> { + + private ListBackendBucketsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListBackendBucketsFixedSizeCollection createEmptyCollection() { + return new ListBackendBucketsFixedSizeCollection(null, 0); + } + + @Override + protected ListBackendBucketsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListBackendBucketsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketList.java new file mode 100644 index 000000000000..c291cf9ca2cb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class BackendBucketList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private BackendBucketList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private BackendBucketList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(BackendBucketList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static BackendBucketList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final BackendBucketList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new BackendBucketList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(BackendBucketList other) { + if (other == BackendBucketList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(BackendBucketList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(BackendBucket items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public BackendBucketList build() { + + return new BackendBucketList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "BackendBucketList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BackendBucketList) { + BackendBucketList that = (BackendBucketList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketSettings.java new file mode 100644 index 000000000000..1e47fbf5864d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketSettings.java @@ -0,0 +1,245 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.BackendBucketClient.ListBackendBucketsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.BackendBucketStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link BackendBucketClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteBackendBucket to 30 seconds: + * + *

+ * 
+ * BackendBucketSettings.Builder backendBucketSettingsBuilder =
+ *     BackendBucketSettings.newBuilder();
+ * backendBucketSettingsBuilder.deleteBackendBucketSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * BackendBucketSettings backendBucketSettings = backendBucketSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BackendBucketSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteBackendBucket. */ + public UnaryCallSettings + deleteBackendBucketSettings() { + return ((BackendBucketStubSettings) getStubSettings()).deleteBackendBucketSettings(); + } + + /** Returns the object with the settings used for calls to getBackendBucket. */ + public UnaryCallSettings getBackendBucketSettings() { + return ((BackendBucketStubSettings) getStubSettings()).getBackendBucketSettings(); + } + + /** Returns the object with the settings used for calls to insertBackendBucket. */ + public UnaryCallSettings + insertBackendBucketSettings() { + return ((BackendBucketStubSettings) getStubSettings()).insertBackendBucketSettings(); + } + + /** Returns the object with the settings used for calls to listBackendBuckets. */ + public PagedCallSettings< + ListBackendBucketsHttpRequest, BackendBucketList, ListBackendBucketsPagedResponse> + listBackendBucketsSettings() { + return ((BackendBucketStubSettings) getStubSettings()).listBackendBucketsSettings(); + } + + /** Returns the object with the settings used for calls to patchBackendBucket. */ + public UnaryCallSettings patchBackendBucketSettings() { + return ((BackendBucketStubSettings) getStubSettings()).patchBackendBucketSettings(); + } + + /** Returns the object with the settings used for calls to updateBackendBucket. */ + public UnaryCallSettings + updateBackendBucketSettings() { + return ((BackendBucketStubSettings) getStubSettings()).updateBackendBucketSettings(); + } + + public static final BackendBucketSettings create(BackendBucketStubSettings stub) + throws IOException { + return new BackendBucketSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return BackendBucketStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return BackendBucketStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return BackendBucketStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return BackendBucketStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return BackendBucketStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return BackendBucketStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return BackendBucketStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return BackendBucketStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected BackendBucketSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for BackendBucketSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(BackendBucketStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(BackendBucketStubSettings.newBuilder()); + } + + protected Builder(BackendBucketSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(BackendBucketStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public BackendBucketStubSettings.Builder getStubSettingsBuilder() { + return ((BackendBucketStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteBackendBucket. */ + public UnaryCallSettings.Builder + deleteBackendBucketSettings() { + return getStubSettingsBuilder().deleteBackendBucketSettings(); + } + + /** Returns the builder for the settings used for calls to getBackendBucket. */ + public UnaryCallSettings.Builder + getBackendBucketSettings() { + return getStubSettingsBuilder().getBackendBucketSettings(); + } + + /** Returns the builder for the settings used for calls to insertBackendBucket. */ + public UnaryCallSettings.Builder + insertBackendBucketSettings() { + return getStubSettingsBuilder().insertBackendBucketSettings(); + } + + /** Returns the builder for the settings used for calls to listBackendBuckets. */ + public PagedCallSettings.Builder< + ListBackendBucketsHttpRequest, BackendBucketList, ListBackendBucketsPagedResponse> + listBackendBucketsSettings() { + return getStubSettingsBuilder().listBackendBucketsSettings(); + } + + /** Returns the builder for the settings used for calls to patchBackendBucket. */ + public UnaryCallSettings.Builder + patchBackendBucketSettings() { + return getStubSettingsBuilder().patchBackendBucketSettings(); + } + + /** Returns the builder for the settings used for calls to updateBackendBucket. */ + public UnaryCallSettings.Builder + updateBackendBucketSettings() { + return getStubSettingsBuilder().updateBackendBucketSettings(); + } + + @Override + public BackendBucketSettings build() throws IOException { + return new BackendBucketSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendService.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendService.java new file mode 100644 index 000000000000..7b0d8a5b5971 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendService.java @@ -0,0 +1,806 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class BackendService implements ApiMessage { + private final Integer affinityCookieTtlSec; + private final List backends; + private final BackendServiceCdnPolicy cdnPolicy; + private final ConnectionDraining connectionDraining; + private final String creationTimestamp; + private final String description; + private final Boolean enableCDN; + private final String fingerprint; + private final List healthChecks; + private final BackendServiceIAP iap; + private final String id; + private final String kind; + private final String loadBalancingScheme; + private final String name; + private final Integer port; + private final String portName; + private final String protocol; + private final String region; + private final String selfLink; + private final String sessionAffinity; + private final Integer timeoutSec; + + private BackendService() { + this.affinityCookieTtlSec = null; + this.backends = null; + this.cdnPolicy = null; + this.connectionDraining = null; + this.creationTimestamp = null; + this.description = null; + this.enableCDN = null; + this.fingerprint = null; + this.healthChecks = null; + this.iap = null; + this.id = null; + this.kind = null; + this.loadBalancingScheme = null; + this.name = null; + this.port = null; + this.portName = null; + this.protocol = null; + this.region = null; + this.selfLink = null; + this.sessionAffinity = null; + this.timeoutSec = null; + } + + private BackendService( + Integer affinityCookieTtlSec, + List backends, + BackendServiceCdnPolicy cdnPolicy, + ConnectionDraining connectionDraining, + String creationTimestamp, + String description, + Boolean enableCDN, + String fingerprint, + List healthChecks, + BackendServiceIAP iap, + String id, + String kind, + String loadBalancingScheme, + String name, + Integer port, + String portName, + String protocol, + String region, + String selfLink, + String sessionAffinity, + Integer timeoutSec) { + this.affinityCookieTtlSec = affinityCookieTtlSec; + this.backends = backends; + this.cdnPolicy = cdnPolicy; + this.connectionDraining = connectionDraining; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.enableCDN = enableCDN; + this.fingerprint = fingerprint; + this.healthChecks = healthChecks; + this.iap = iap; + this.id = id; + this.kind = kind; + this.loadBalancingScheme = loadBalancingScheme; + this.name = name; + this.port = port; + this.portName = portName; + this.protocol = protocol; + this.region = region; + this.selfLink = selfLink; + this.sessionAffinity = sessionAffinity; + this.timeoutSec = timeoutSec; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("affinityCookieTtlSec")) { + return affinityCookieTtlSec; + } + if (fieldName.equals("backends")) { + return backends; + } + if (fieldName.equals("cdnPolicy")) { + return cdnPolicy; + } + if (fieldName.equals("connectionDraining")) { + return connectionDraining; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("enableCDN")) { + return enableCDN; + } + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("healthChecks")) { + return healthChecks; + } + if (fieldName.equals("iap")) { + return iap; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("loadBalancingScheme")) { + return loadBalancingScheme; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("port")) { + return port; + } + if (fieldName.equals("portName")) { + return portName; + } + if (fieldName.equals("protocol")) { + return protocol; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("sessionAffinity")) { + return sessionAffinity; + } + if (fieldName.equals("timeoutSec")) { + return timeoutSec; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getAffinityCookieTtlSec() { + return affinityCookieTtlSec; + } + + public List getBackendsList() { + return backends; + } + + public BackendServiceCdnPolicy getCdnPolicy() { + return cdnPolicy; + } + + public ConnectionDraining getConnectionDraining() { + return connectionDraining; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public Boolean getEnableCDN() { + return enableCDN; + } + + public String getFingerprint() { + return fingerprint; + } + + public List getHealthChecksList() { + return healthChecks; + } + + public BackendServiceIAP getIap() { + return iap; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getLoadBalancingScheme() { + return loadBalancingScheme; + } + + public String getName() { + return name; + } + + public Integer getPort() { + return port; + } + + public String getPortName() { + return portName; + } + + public String getProtocol() { + return protocol; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public String getSessionAffinity() { + return sessionAffinity; + } + + public Integer getTimeoutSec() { + return timeoutSec; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(BackendService prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static BackendService getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final BackendService DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new BackendService(); + } + + public static class Builder { + private Integer affinityCookieTtlSec; + private List backends; + private BackendServiceCdnPolicy cdnPolicy; + private ConnectionDraining connectionDraining; + private String creationTimestamp; + private String description; + private Boolean enableCDN; + private String fingerprint; + private List healthChecks; + private BackendServiceIAP iap; + private String id; + private String kind; + private String loadBalancingScheme; + private String name; + private Integer port; + private String portName; + private String protocol; + private String region; + private String selfLink; + private String sessionAffinity; + private Integer timeoutSec; + + Builder() {} + + public Builder mergeFrom(BackendService other) { + if (other == BackendService.getDefaultInstance()) return this; + if (other.getAffinityCookieTtlSec() != null) { + this.affinityCookieTtlSec = other.affinityCookieTtlSec; + } + if (other.getBackendsList() != null) { + this.backends = other.backends; + } + if (other.getCdnPolicy() != null) { + this.cdnPolicy = other.cdnPolicy; + } + if (other.getConnectionDraining() != null) { + this.connectionDraining = other.connectionDraining; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getEnableCDN() != null) { + this.enableCDN = other.enableCDN; + } + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getHealthChecksList() != null) { + this.healthChecks = other.healthChecks; + } + if (other.getIap() != null) { + this.iap = other.iap; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getLoadBalancingScheme() != null) { + this.loadBalancingScheme = other.loadBalancingScheme; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPort() != null) { + this.port = other.port; + } + if (other.getPortName() != null) { + this.portName = other.portName; + } + if (other.getProtocol() != null) { + this.protocol = other.protocol; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSessionAffinity() != null) { + this.sessionAffinity = other.sessionAffinity; + } + if (other.getTimeoutSec() != null) { + this.timeoutSec = other.timeoutSec; + } + return this; + } + + Builder(BackendService source) { + this.affinityCookieTtlSec = source.affinityCookieTtlSec; + this.backends = source.backends; + this.cdnPolicy = source.cdnPolicy; + this.connectionDraining = source.connectionDraining; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.enableCDN = source.enableCDN; + this.fingerprint = source.fingerprint; + this.healthChecks = source.healthChecks; + this.iap = source.iap; + this.id = source.id; + this.kind = source.kind; + this.loadBalancingScheme = source.loadBalancingScheme; + this.name = source.name; + this.port = source.port; + this.portName = source.portName; + this.protocol = source.protocol; + this.region = source.region; + this.selfLink = source.selfLink; + this.sessionAffinity = source.sessionAffinity; + this.timeoutSec = source.timeoutSec; + } + + public Integer getAffinityCookieTtlSec() { + return affinityCookieTtlSec; + } + + public Builder setAffinityCookieTtlSec(Integer affinityCookieTtlSec) { + this.affinityCookieTtlSec = affinityCookieTtlSec; + return this; + } + + public List getBackendsList() { + return backends; + } + + public Builder addAllBackends(List backends) { + if (this.backends == null) { + this.backends = new ArrayList<>(backends.size()); + } + this.backends.addAll(backends); + return this; + } + + public Builder addBackends(Backend backends) { + this.backends.add(backends); + return this; + } + + public BackendServiceCdnPolicy getCdnPolicy() { + return cdnPolicy; + } + + public Builder setCdnPolicy(BackendServiceCdnPolicy cdnPolicy) { + this.cdnPolicy = cdnPolicy; + return this; + } + + public ConnectionDraining getConnectionDraining() { + return connectionDraining; + } + + public Builder setConnectionDraining(ConnectionDraining connectionDraining) { + this.connectionDraining = connectionDraining; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public Boolean getEnableCDN() { + return enableCDN; + } + + public Builder setEnableCDN(Boolean enableCDN) { + this.enableCDN = enableCDN; + return this; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public List getHealthChecksList() { + return healthChecks; + } + + public Builder addAllHealthChecks(List healthChecks) { + if (this.healthChecks == null) { + this.healthChecks = new ArrayList<>(healthChecks.size()); + } + this.healthChecks.addAll(healthChecks); + return this; + } + + public Builder addHealthChecks(String healthChecks) { + this.healthChecks.add(healthChecks); + return this; + } + + public BackendServiceIAP getIap() { + return iap; + } + + public Builder setIap(BackendServiceIAP iap) { + this.iap = iap; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getLoadBalancingScheme() { + return loadBalancingScheme; + } + + public Builder setLoadBalancingScheme(String loadBalancingScheme) { + this.loadBalancingScheme = loadBalancingScheme; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Integer getPort() { + return port; + } + + public Builder setPort(Integer port) { + this.port = port; + return this; + } + + public String getPortName() { + return portName; + } + + public Builder setPortName(String portName) { + this.portName = portName; + return this; + } + + public String getProtocol() { + return protocol; + } + + public Builder setProtocol(String protocol) { + this.protocol = protocol; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getSessionAffinity() { + return sessionAffinity; + } + + public Builder setSessionAffinity(String sessionAffinity) { + this.sessionAffinity = sessionAffinity; + return this; + } + + public Integer getTimeoutSec() { + return timeoutSec; + } + + public Builder setTimeoutSec(Integer timeoutSec) { + this.timeoutSec = timeoutSec; + return this; + } + + public BackendService build() { + + return new BackendService( + affinityCookieTtlSec, + backends, + cdnPolicy, + connectionDraining, + creationTimestamp, + description, + enableCDN, + fingerprint, + healthChecks, + iap, + id, + kind, + loadBalancingScheme, + name, + port, + portName, + protocol, + region, + selfLink, + sessionAffinity, + timeoutSec); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAffinityCookieTtlSec(this.affinityCookieTtlSec); + newBuilder.addAllBackends(this.backends); + newBuilder.setCdnPolicy(this.cdnPolicy); + newBuilder.setConnectionDraining(this.connectionDraining); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setEnableCDN(this.enableCDN); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.addAllHealthChecks(this.healthChecks); + newBuilder.setIap(this.iap); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setLoadBalancingScheme(this.loadBalancingScheme); + newBuilder.setName(this.name); + newBuilder.setPort(this.port); + newBuilder.setPortName(this.portName); + newBuilder.setProtocol(this.protocol); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setSessionAffinity(this.sessionAffinity); + newBuilder.setTimeoutSec(this.timeoutSec); + return newBuilder; + } + } + + @Override + public String toString() { + return "BackendService{" + + "affinityCookieTtlSec=" + + affinityCookieTtlSec + + ", " + + "backends=" + + backends + + ", " + + "cdnPolicy=" + + cdnPolicy + + ", " + + "connectionDraining=" + + connectionDraining + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "enableCDN=" + + enableCDN + + ", " + + "fingerprint=" + + fingerprint + + ", " + + "healthChecks=" + + healthChecks + + ", " + + "iap=" + + iap + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "loadBalancingScheme=" + + loadBalancingScheme + + ", " + + "name=" + + name + + ", " + + "port=" + + port + + ", " + + "portName=" + + portName + + ", " + + "protocol=" + + protocol + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + ", " + + "sessionAffinity=" + + sessionAffinity + + ", " + + "timeoutSec=" + + timeoutSec + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BackendService) { + BackendService that = (BackendService) o; + return Objects.equals(this.affinityCookieTtlSec, that.getAffinityCookieTtlSec()) + && Objects.equals(this.backends, that.getBackendsList()) + && Objects.equals(this.cdnPolicy, that.getCdnPolicy()) + && Objects.equals(this.connectionDraining, that.getConnectionDraining()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.enableCDN, that.getEnableCDN()) + && Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.healthChecks, that.getHealthChecksList()) + && Objects.equals(this.iap, that.getIap()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.loadBalancingScheme, that.getLoadBalancingScheme()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.port, that.getPort()) + && Objects.equals(this.portName, that.getPortName()) + && Objects.equals(this.protocol, that.getProtocol()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.sessionAffinity, that.getSessionAffinity()) + && Objects.equals(this.timeoutSec, that.getTimeoutSec()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + affinityCookieTtlSec, + backends, + cdnPolicy, + connectionDraining, + creationTimestamp, + description, + enableCDN, + fingerprint, + healthChecks, + iap, + id, + kind, + loadBalancingScheme, + name, + port, + portName, + protocol, + region, + selfLink, + sessionAffinity, + timeoutSec); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceAggregatedList.java new file mode 100644 index 000000000000..85b75e24ef98 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class BackendServiceAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private BackendServiceAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private BackendServiceAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(BackendServiceAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static BackendServiceAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final BackendServiceAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new BackendServiceAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(BackendServiceAggregatedList other) { + if (other == BackendServiceAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(BackendServiceAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public BackendServiceAggregatedList build() { + + return new BackendServiceAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "BackendServiceAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BackendServiceAggregatedList) { + BackendServiceAggregatedList that = (BackendServiceAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceCdnPolicy.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceCdnPolicy.java new file mode 100644 index 000000000000..b9892872ad1d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceCdnPolicy.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class BackendServiceCdnPolicy implements ApiMessage { + private final CacheKeyPolicy cacheKeyPolicy; + + private BackendServiceCdnPolicy() { + this.cacheKeyPolicy = null; + } + + private BackendServiceCdnPolicy(CacheKeyPolicy cacheKeyPolicy) { + this.cacheKeyPolicy = cacheKeyPolicy; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("cacheKeyPolicy")) { + return cacheKeyPolicy; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public CacheKeyPolicy getCacheKeyPolicy() { + return cacheKeyPolicy; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(BackendServiceCdnPolicy prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static BackendServiceCdnPolicy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final BackendServiceCdnPolicy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new BackendServiceCdnPolicy(); + } + + public static class Builder { + private CacheKeyPolicy cacheKeyPolicy; + + Builder() {} + + public Builder mergeFrom(BackendServiceCdnPolicy other) { + if (other == BackendServiceCdnPolicy.getDefaultInstance()) return this; + if (other.getCacheKeyPolicy() != null) { + this.cacheKeyPolicy = other.cacheKeyPolicy; + } + return this; + } + + Builder(BackendServiceCdnPolicy source) { + this.cacheKeyPolicy = source.cacheKeyPolicy; + } + + public CacheKeyPolicy getCacheKeyPolicy() { + return cacheKeyPolicy; + } + + public Builder setCacheKeyPolicy(CacheKeyPolicy cacheKeyPolicy) { + this.cacheKeyPolicy = cacheKeyPolicy; + return this; + } + + public BackendServiceCdnPolicy build() { + return new BackendServiceCdnPolicy(cacheKeyPolicy); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCacheKeyPolicy(this.cacheKeyPolicy); + return newBuilder; + } + } + + @Override + public String toString() { + return "BackendServiceCdnPolicy{" + "cacheKeyPolicy=" + cacheKeyPolicy + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BackendServiceCdnPolicy) { + BackendServiceCdnPolicy that = (BackendServiceCdnPolicy) o; + return Objects.equals(this.cacheKeyPolicy, that.getCacheKeyPolicy()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(cacheKeyPolicy); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceClient.java new file mode 100644 index 000000000000..99d520e89b3d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceClient.java @@ -0,0 +1,1329 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.BackendServiceStub; +import com.google.cloud.compute.v1.stub.BackendServiceStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+ *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+ *   Operation response = backendServiceClient.deleteBackendService(backendService);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the backendServiceClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of BackendServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * BackendServiceSettings backendServiceSettings =
+ *     BackendServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * BackendServiceClient backendServiceClient =
+ *     BackendServiceClient.create(backendServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * BackendServiceSettings backendServiceSettings =
+ *     BackendServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * BackendServiceClient backendServiceClient =
+ *     BackendServiceClient.create(backendServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BackendServiceClient implements BackgroundResource { + private final BackendServiceSettings settings; + private final BackendServiceStub stub; + + /** Constructs an instance of BackendServiceClient with default settings. */ + public static final BackendServiceClient create() throws IOException { + return create(BackendServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of BackendServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final BackendServiceClient create(BackendServiceSettings settings) + throws IOException { + return new BackendServiceClient(settings); + } + + /** + * Constructs an instance of BackendServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer to use BackendServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final BackendServiceClient create(BackendServiceStub stub) { + return new BackendServiceClient(stub); + } + + /** + * Constructs an instance of BackendServiceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected BackendServiceClient(BackendServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((BackendServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected BackendServiceClient(BackendServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final BackendServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public BackendServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of all BackendService resources, regional and global, available to the + * specified project. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (BackendServicesScopedList element : backendServiceClient.aggregatedListBackendServices(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Name of the project scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListBackendServicesPagedResponse aggregatedListBackendServices( + ProjectName project) { + AggregatedListBackendServicesHttpRequest request = + AggregatedListBackendServicesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListBackendServices(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of all BackendService resources, regional and global, available to the + * specified project. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (BackendServicesScopedList element : backendServiceClient.aggregatedListBackendServices(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Name of the project scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListBackendServicesPagedResponse aggregatedListBackendServices( + String project) { + AggregatedListBackendServicesHttpRequest request = + AggregatedListBackendServicesHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListBackendServices(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of all BackendService resources, regional and global, available to the + * specified project. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListBackendServicesHttpRequest request = AggregatedListBackendServicesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (BackendServicesScopedList element : backendServiceClient.aggregatedListBackendServices(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListBackendServicesPagedResponse aggregatedListBackendServices( + AggregatedListBackendServicesHttpRequest request) { + return aggregatedListBackendServicesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of all BackendService resources, regional and global, available to the + * specified project. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListBackendServicesHttpRequest request = AggregatedListBackendServicesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListBackendServicesPagedResponse> future = backendServiceClient.aggregatedListBackendServicesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (BackendServicesScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListBackendServicesHttpRequest, AggregatedListBackendServicesPagedResponse> + aggregatedListBackendServicesPagedCallable() { + return stub.aggregatedListBackendServicesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of all BackendService resources, regional and global, available to the + * specified project. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListBackendServicesHttpRequest request = AggregatedListBackendServicesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     BackendServiceAggregatedList response = backendServiceClient.aggregatedListBackendServicesCallable().call(request);
+   *     for (BackendServicesScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListBackendServicesCallable() { + return stub.aggregatedListBackendServicesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified BackendService resource. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   Operation response = backendServiceClient.deleteBackendService(backendService);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteBackendService(ProjectGlobalBackendServiceName backendService) { + + DeleteBackendServiceHttpRequest request = + DeleteBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService == null ? null : backendService.toString()) + .build(); + return deleteBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified BackendService resource. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   Operation response = backendServiceClient.deleteBackendService(backendService.toString());
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteBackendService(String backendService) { + + DeleteBackendServiceHttpRequest request = + DeleteBackendServiceHttpRequest.newBuilder().setBackendService(backendService).build(); + return deleteBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified BackendService resource. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   DeleteBackendServiceHttpRequest request = DeleteBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .build();
+   *   Operation response = backendServiceClient.deleteBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteBackendService(DeleteBackendServiceHttpRequest request) { + return deleteBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified BackendService resource. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   DeleteBackendServiceHttpRequest request = DeleteBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = backendServiceClient.deleteBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteBackendServiceCallable() { + return stub.deleteBackendServiceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified BackendService resource. Gets a list of available backend services by + * making a list() request. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   BackendService response = backendServiceClient.getBackendService(backendService);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendService getBackendService(ProjectGlobalBackendServiceName backendService) { + + GetBackendServiceHttpRequest request = + GetBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService == null ? null : backendService.toString()) + .build(); + return getBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified BackendService resource. Gets a list of available backend services by + * making a list() request. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   BackendService response = backendServiceClient.getBackendService(backendService.toString());
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendService getBackendService(String backendService) { + + GetBackendServiceHttpRequest request = + GetBackendServiceHttpRequest.newBuilder().setBackendService(backendService).build(); + return getBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified BackendService resource. Gets a list of available backend services by + * making a list() request. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   GetBackendServiceHttpRequest request = GetBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .build();
+   *   BackendService response = backendServiceClient.getBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendService getBackendService(GetBackendServiceHttpRequest request) { + return getBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified BackendService resource. Gets a list of available backend services by + * making a list() request. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   GetBackendServiceHttpRequest request = GetBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .build();
+   *   ApiFuture<BackendService> future = backendServiceClient.getBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   BackendService response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getBackendServiceCallable() { + return stub.getBackendServiceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for this BackendService. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
+   *   BackendServiceGroupHealth response = backendServiceClient.getHealthBackendService(backendService, resourceGroupReferenceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to which the queried instance + * belongs. + * @param resourceGroupReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendServiceGroupHealth getHealthBackendService( + ProjectGlobalBackendServiceName backendService, + ResourceGroupReference resourceGroupReferenceResource) { + + GetHealthBackendServiceHttpRequest request = + GetHealthBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService == null ? null : backendService.toString()) + .setResourceGroupReferenceResource(resourceGroupReferenceResource) + .build(); + return getHealthBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for this BackendService. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
+   *   BackendServiceGroupHealth response = backendServiceClient.getHealthBackendService(backendService.toString(), resourceGroupReferenceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to which the queried instance + * belongs. + * @param resourceGroupReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendServiceGroupHealth getHealthBackendService( + String backendService, ResourceGroupReference resourceGroupReferenceResource) { + + GetHealthBackendServiceHttpRequest request = + GetHealthBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService) + .setResourceGroupReferenceResource(resourceGroupReferenceResource) + .build(); + return getHealthBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for this BackendService. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
+   *   GetHealthBackendServiceHttpRequest request = GetHealthBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setResourceGroupReferenceResource(resourceGroupReferenceResource)
+   *     .build();
+   *   BackendServiceGroupHealth response = backendServiceClient.getHealthBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendServiceGroupHealth getHealthBackendService( + GetHealthBackendServiceHttpRequest request) { + return getHealthBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for this BackendService. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
+   *   GetHealthBackendServiceHttpRequest request = GetHealthBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setResourceGroupReferenceResource(resourceGroupReferenceResource)
+   *     .build();
+   *   ApiFuture<BackendServiceGroupHealth> future = backendServiceClient.getHealthBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   BackendServiceGroupHealth response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getHealthBackendServiceCallable() { + return stub.getHealthBackendServiceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a BackendService resource in the specified project using the data included in the + * request. There are several restrictions and guidelines to keep in mind when creating a backend + * service. Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = backendServiceClient.insertBackendService(project, backendServiceResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertBackendService( + ProjectName project, BackendService backendServiceResource) { + + InsertBackendServiceHttpRequest request = + InsertBackendServiceHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setBackendServiceResource(backendServiceResource) + .build(); + return insertBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a BackendService resource in the specified project using the data included in the + * request. There are several restrictions and guidelines to keep in mind when creating a backend + * service. Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = backendServiceClient.insertBackendService(project.toString(), backendServiceResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertBackendService( + String project, BackendService backendServiceResource) { + + InsertBackendServiceHttpRequest request = + InsertBackendServiceHttpRequest.newBuilder() + .setProject(project) + .setBackendServiceResource(backendServiceResource) + .build(); + return insertBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a BackendService resource in the specified project using the data included in the + * request. There are several restrictions and guidelines to keep in mind when creating a backend + * service. Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   InsertBackendServiceHttpRequest request = InsertBackendServiceHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   Operation response = backendServiceClient.insertBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertBackendService(InsertBackendServiceHttpRequest request) { + return insertBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a BackendService resource in the specified project using the data included in the + * request. There are several restrictions and guidelines to keep in mind when creating a backend + * service. Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   InsertBackendServiceHttpRequest request = InsertBackendServiceHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = backendServiceClient.insertBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertBackendServiceCallable() { + return stub.insertBackendServiceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of BackendService resources available to the specified project. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (BackendService element : backendServiceClient.listBackendServices(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListBackendServicesPagedResponse listBackendServices(ProjectName project) { + ListBackendServicesHttpRequest request = + ListBackendServicesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listBackendServices(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of BackendService resources available to the specified project. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (BackendService element : backendServiceClient.listBackendServices(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListBackendServicesPagedResponse listBackendServices(String project) { + ListBackendServicesHttpRequest request = + ListBackendServicesHttpRequest.newBuilder().setProject(project).build(); + return listBackendServices(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of BackendService resources available to the specified project. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListBackendServicesHttpRequest request = ListBackendServicesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (BackendService element : backendServiceClient.listBackendServices(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListBackendServicesPagedResponse listBackendServices( + ListBackendServicesHttpRequest request) { + return listBackendServicesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of BackendService resources available to the specified project. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListBackendServicesHttpRequest request = ListBackendServicesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListBackendServicesPagedResponse> future = backendServiceClient.listBackendServicesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (BackendService element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listBackendServicesPagedCallable() { + return stub.listBackendServicesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of BackendService resources available to the specified project. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListBackendServicesHttpRequest request = ListBackendServicesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     BackendServiceList response = backendServiceClient.listBackendServicesCallable().call(request);
+   *     for (BackendService element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listBackendServicesCallable() { + return stub.listBackendServicesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified BackendService resource with the data included in the request. There are + * several restrictions and guidelines to keep in mind when updating a backend service. Read + * Restrictions and Guidelines for more information. This method supports PATCH semantics and uses + * the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = backendServiceClient.patchBackendService(backendService, backendServiceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to patch. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchBackendService( + ProjectGlobalBackendServiceName backendService, BackendService backendServiceResource) { + + PatchBackendServiceHttpRequest request = + PatchBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService == null ? null : backendService.toString()) + .setBackendServiceResource(backendServiceResource) + .build(); + return patchBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified BackendService resource with the data included in the request. There are + * several restrictions and guidelines to keep in mind when updating a backend service. Read + * Restrictions and Guidelines for more information. This method supports PATCH semantics and uses + * the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = backendServiceClient.patchBackendService(backendService.toString(), backendServiceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to patch. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchBackendService( + String backendService, BackendService backendServiceResource) { + + PatchBackendServiceHttpRequest request = + PatchBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService) + .setBackendServiceResource(backendServiceResource) + .build(); + return patchBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified BackendService resource with the data included in the request. There are + * several restrictions and guidelines to keep in mind when updating a backend service. Read + * Restrictions and Guidelines for more information. This method supports PATCH semantics and uses + * the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   PatchBackendServiceHttpRequest request = PatchBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   Operation response = backendServiceClient.patchBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchBackendService(PatchBackendServiceHttpRequest request) { + return patchBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified BackendService resource with the data included in the request. There are + * several restrictions and guidelines to keep in mind when updating a backend service. Read + * Restrictions and Guidelines for more information. This method supports PATCH semantics and uses + * the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   PatchBackendServiceHttpRequest request = PatchBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = backendServiceClient.patchBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + patchBackendServiceCallable() { + return stub.patchBackendServiceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendService resource with the data included in the request. There are + * several restrictions and guidelines to keep in mind when updating a backend service. Read + * Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = backendServiceClient.updateBackendService(backendService, backendServiceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to update. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateBackendService( + ProjectGlobalBackendServiceName backendService, BackendService backendServiceResource) { + + UpdateBackendServiceHttpRequest request = + UpdateBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService == null ? null : backendService.toString()) + .setBackendServiceResource(backendServiceResource) + .build(); + return updateBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendService resource with the data included in the request. There are + * several restrictions and guidelines to keep in mind when updating a backend service. Read + * Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = backendServiceClient.updateBackendService(backendService.toString(), backendServiceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to update. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateBackendService( + String backendService, BackendService backendServiceResource) { + + UpdateBackendServiceHttpRequest request = + UpdateBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService) + .setBackendServiceResource(backendServiceResource) + .build(); + return updateBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendService resource with the data included in the request. There are + * several restrictions and guidelines to keep in mind when updating a backend service. Read + * Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   UpdateBackendServiceHttpRequest request = UpdateBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   Operation response = backendServiceClient.updateBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateBackendService(UpdateBackendServiceHttpRequest request) { + return updateBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified BackendService resource with the data included in the request. There are + * several restrictions and guidelines to keep in mind when updating a backend service. Read + * Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+   *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   UpdateBackendServiceHttpRequest request = UpdateBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = backendServiceClient.updateBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + updateBackendServiceCallable() { + return stub.updateBackendServiceCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListBackendServicesPagedResponse + extends AbstractPagedListResponse< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + BackendServicesScopedList, AggregatedListBackendServicesPage, + AggregatedListBackendServicesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + BackendServicesScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListBackendServicesPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + AggregatedListBackendServicesPage, AggregatedListBackendServicesPagedResponse>() { + @Override + public AggregatedListBackendServicesPagedResponse apply( + AggregatedListBackendServicesPage input) { + return new AggregatedListBackendServicesPagedResponse(input); + } + }); + } + + private AggregatedListBackendServicesPagedResponse(AggregatedListBackendServicesPage page) { + super(page, AggregatedListBackendServicesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListBackendServicesPage + extends AbstractPage< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + BackendServicesScopedList, AggregatedListBackendServicesPage> { + + private AggregatedListBackendServicesPage( + PageContext< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + BackendServicesScopedList> + context, + BackendServiceAggregatedList response) { + super(context, response); + } + + private static AggregatedListBackendServicesPage createEmptyPage() { + return new AggregatedListBackendServicesPage(null, null); + } + + @Override + protected AggregatedListBackendServicesPage createPage( + PageContext< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + BackendServicesScopedList> + context, + BackendServiceAggregatedList response) { + return new AggregatedListBackendServicesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + BackendServicesScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListBackendServicesFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + BackendServicesScopedList, AggregatedListBackendServicesPage, + AggregatedListBackendServicesFixedSizeCollection> { + + private AggregatedListBackendServicesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListBackendServicesFixedSizeCollection createEmptyCollection() { + return new AggregatedListBackendServicesFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListBackendServicesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListBackendServicesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListBackendServicesPagedResponse + extends AbstractPagedListResponse< + ListBackendServicesHttpRequest, BackendServiceList, BackendService, + ListBackendServicesPage, ListBackendServicesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListBackendServicesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListBackendServicesPagedResponse apply(ListBackendServicesPage input) { + return new ListBackendServicesPagedResponse(input); + } + }); + } + + private ListBackendServicesPagedResponse(ListBackendServicesPage page) { + super(page, ListBackendServicesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListBackendServicesPage + extends AbstractPage< + ListBackendServicesHttpRequest, BackendServiceList, BackendService, + ListBackendServicesPage> { + + private ListBackendServicesPage( + PageContext context, + BackendServiceList response) { + super(context, response); + } + + private static ListBackendServicesPage createEmptyPage() { + return new ListBackendServicesPage(null, null); + } + + @Override + protected ListBackendServicesPage createPage( + PageContext context, + BackendServiceList response) { + return new ListBackendServicesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListBackendServicesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListBackendServicesHttpRequest, BackendServiceList, BackendService, + ListBackendServicesPage, ListBackendServicesFixedSizeCollection> { + + private ListBackendServicesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListBackendServicesFixedSizeCollection createEmptyCollection() { + return new ListBackendServicesFixedSizeCollection(null, 0); + } + + @Override + protected ListBackendServicesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListBackendServicesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceGroupHealth.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceGroupHealth.java new file mode 100644 index 000000000000..ef90349b4949 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceGroupHealth.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class BackendServiceGroupHealth implements ApiMessage { + private final List healthStatus; + private final String kind; + + private BackendServiceGroupHealth() { + this.healthStatus = null; + this.kind = null; + } + + private BackendServiceGroupHealth(List healthStatus, String kind) { + this.healthStatus = healthStatus; + this.kind = kind; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("healthStatus")) { + return healthStatus; + } + if (fieldName.equals("kind")) { + return kind; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getHealthStatusList() { + return healthStatus; + } + + public String getKind() { + return kind; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(BackendServiceGroupHealth prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static BackendServiceGroupHealth getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final BackendServiceGroupHealth DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new BackendServiceGroupHealth(); + } + + public static class Builder { + private List healthStatus; + private String kind; + + Builder() {} + + public Builder mergeFrom(BackendServiceGroupHealth other) { + if (other == BackendServiceGroupHealth.getDefaultInstance()) return this; + if (other.getHealthStatusList() != null) { + this.healthStatus = other.healthStatus; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + return this; + } + + Builder(BackendServiceGroupHealth source) { + this.healthStatus = source.healthStatus; + this.kind = source.kind; + } + + public List getHealthStatusList() { + return healthStatus; + } + + public Builder addAllHealthStatus(List healthStatus) { + if (this.healthStatus == null) { + this.healthStatus = new ArrayList<>(healthStatus.size()); + } + this.healthStatus.addAll(healthStatus); + return this; + } + + public Builder addHealthStatus(HealthStatus healthStatus) { + this.healthStatus.add(healthStatus); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public BackendServiceGroupHealth build() { + + return new BackendServiceGroupHealth(healthStatus, kind); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllHealthStatus(this.healthStatus); + newBuilder.setKind(this.kind); + return newBuilder; + } + } + + @Override + public String toString() { + return "BackendServiceGroupHealth{" + + "healthStatus=" + + healthStatus + + ", " + + "kind=" + + kind + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BackendServiceGroupHealth) { + BackendServiceGroupHealth that = (BackendServiceGroupHealth) o; + return Objects.equals(this.healthStatus, that.getHealthStatusList()) + && Objects.equals(this.kind, that.getKind()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(healthStatus, kind); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceIAP.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceIAP.java new file mode 100644 index 000000000000..7bf7ea7e950b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceIAP.java @@ -0,0 +1,238 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class BackendServiceIAP implements ApiMessage { + private final Boolean enabled; + private final String oauth2ClientId; + private final String oauth2ClientSecret; + private final String oauth2ClientSecretSha256; + + private BackendServiceIAP() { + this.enabled = null; + this.oauth2ClientId = null; + this.oauth2ClientSecret = null; + this.oauth2ClientSecretSha256 = null; + } + + private BackendServiceIAP( + Boolean enabled, + String oauth2ClientId, + String oauth2ClientSecret, + String oauth2ClientSecretSha256) { + this.enabled = enabled; + this.oauth2ClientId = oauth2ClientId; + this.oauth2ClientSecret = oauth2ClientSecret; + this.oauth2ClientSecretSha256 = oauth2ClientSecretSha256; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("enabled")) { + return enabled; + } + if (fieldName.equals("oauth2ClientId")) { + return oauth2ClientId; + } + if (fieldName.equals("oauth2ClientSecret")) { + return oauth2ClientSecret; + } + if (fieldName.equals("oauth2ClientSecretSha256")) { + return oauth2ClientSecretSha256; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getEnabled() { + return enabled; + } + + public String getOauth2ClientId() { + return oauth2ClientId; + } + + public String getOauth2ClientSecret() { + return oauth2ClientSecret; + } + + public String getOauth2ClientSecretSha256() { + return oauth2ClientSecretSha256; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(BackendServiceIAP prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static BackendServiceIAP getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final BackendServiceIAP DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new BackendServiceIAP(); + } + + public static class Builder { + private Boolean enabled; + private String oauth2ClientId; + private String oauth2ClientSecret; + private String oauth2ClientSecretSha256; + + Builder() {} + + public Builder mergeFrom(BackendServiceIAP other) { + if (other == BackendServiceIAP.getDefaultInstance()) return this; + if (other.getEnabled() != null) { + this.enabled = other.enabled; + } + if (other.getOauth2ClientId() != null) { + this.oauth2ClientId = other.oauth2ClientId; + } + if (other.getOauth2ClientSecret() != null) { + this.oauth2ClientSecret = other.oauth2ClientSecret; + } + if (other.getOauth2ClientSecretSha256() != null) { + this.oauth2ClientSecretSha256 = other.oauth2ClientSecretSha256; + } + return this; + } + + Builder(BackendServiceIAP source) { + this.enabled = source.enabled; + this.oauth2ClientId = source.oauth2ClientId; + this.oauth2ClientSecret = source.oauth2ClientSecret; + this.oauth2ClientSecretSha256 = source.oauth2ClientSecretSha256; + } + + public Boolean getEnabled() { + return enabled; + } + + public Builder setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public String getOauth2ClientId() { + return oauth2ClientId; + } + + public Builder setOauth2ClientId(String oauth2ClientId) { + this.oauth2ClientId = oauth2ClientId; + return this; + } + + public String getOauth2ClientSecret() { + return oauth2ClientSecret; + } + + public Builder setOauth2ClientSecret(String oauth2ClientSecret) { + this.oauth2ClientSecret = oauth2ClientSecret; + return this; + } + + public String getOauth2ClientSecretSha256() { + return oauth2ClientSecretSha256; + } + + public Builder setOauth2ClientSecretSha256(String oauth2ClientSecretSha256) { + this.oauth2ClientSecretSha256 = oauth2ClientSecretSha256; + return this; + } + + public BackendServiceIAP build() { + + return new BackendServiceIAP( + enabled, oauth2ClientId, oauth2ClientSecret, oauth2ClientSecretSha256); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setEnabled(this.enabled); + newBuilder.setOauth2ClientId(this.oauth2ClientId); + newBuilder.setOauth2ClientSecret(this.oauth2ClientSecret); + newBuilder.setOauth2ClientSecretSha256(this.oauth2ClientSecretSha256); + return newBuilder; + } + } + + @Override + public String toString() { + return "BackendServiceIAP{" + + "enabled=" + + enabled + + ", " + + "oauth2ClientId=" + + oauth2ClientId + + ", " + + "oauth2ClientSecret=" + + oauth2ClientSecret + + ", " + + "oauth2ClientSecretSha256=" + + oauth2ClientSecretSha256 + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BackendServiceIAP) { + BackendServiceIAP that = (BackendServiceIAP) o; + return Objects.equals(this.enabled, that.getEnabled()) + && Objects.equals(this.oauth2ClientId, that.getOauth2ClientId()) + && Objects.equals(this.oauth2ClientSecret, that.getOauth2ClientSecret()) + && Objects.equals(this.oauth2ClientSecretSha256, that.getOauth2ClientSecretSha256()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(enabled, oauth2ClientId, oauth2ClientSecret, oauth2ClientSecretSha256); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceList.java new file mode 100644 index 000000000000..e89fdd5087ca --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class BackendServiceList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private BackendServiceList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private BackendServiceList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(BackendServiceList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static BackendServiceList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final BackendServiceList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new BackendServiceList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(BackendServiceList other) { + if (other == BackendServiceList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(BackendServiceList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(BackendService items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public BackendServiceList build() { + + return new BackendServiceList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "BackendServiceList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BackendServiceList) { + BackendServiceList that = (BackendServiceList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceSettings.java new file mode 100644 index 000000000000..1f0e872b9cc1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceSettings.java @@ -0,0 +1,276 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.BackendServiceClient.AggregatedListBackendServicesPagedResponse; +import static com.google.cloud.compute.v1.BackendServiceClient.ListBackendServicesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.BackendServiceStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link BackendServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteBackendService to 30 seconds: + * + *

+ * 
+ * BackendServiceSettings.Builder backendServiceSettingsBuilder =
+ *     BackendServiceSettings.newBuilder();
+ * backendServiceSettingsBuilder.deleteBackendServiceSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * BackendServiceSettings backendServiceSettings = backendServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BackendServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListBackendServices. */ + public PagedCallSettings< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + AggregatedListBackendServicesPagedResponse> + aggregatedListBackendServicesSettings() { + return ((BackendServiceStubSettings) getStubSettings()).aggregatedListBackendServicesSettings(); + } + + /** Returns the object with the settings used for calls to deleteBackendService. */ + public UnaryCallSettings + deleteBackendServiceSettings() { + return ((BackendServiceStubSettings) getStubSettings()).deleteBackendServiceSettings(); + } + + /** Returns the object with the settings used for calls to getBackendService. */ + public UnaryCallSettings + getBackendServiceSettings() { + return ((BackendServiceStubSettings) getStubSettings()).getBackendServiceSettings(); + } + + /** Returns the object with the settings used for calls to getHealthBackendService. */ + public UnaryCallSettings + getHealthBackendServiceSettings() { + return ((BackendServiceStubSettings) getStubSettings()).getHealthBackendServiceSettings(); + } + + /** Returns the object with the settings used for calls to insertBackendService. */ + public UnaryCallSettings + insertBackendServiceSettings() { + return ((BackendServiceStubSettings) getStubSettings()).insertBackendServiceSettings(); + } + + /** Returns the object with the settings used for calls to listBackendServices. */ + public PagedCallSettings< + ListBackendServicesHttpRequest, BackendServiceList, ListBackendServicesPagedResponse> + listBackendServicesSettings() { + return ((BackendServiceStubSettings) getStubSettings()).listBackendServicesSettings(); + } + + /** Returns the object with the settings used for calls to patchBackendService. */ + public UnaryCallSettings + patchBackendServiceSettings() { + return ((BackendServiceStubSettings) getStubSettings()).patchBackendServiceSettings(); + } + + /** Returns the object with the settings used for calls to updateBackendService. */ + public UnaryCallSettings + updateBackendServiceSettings() { + return ((BackendServiceStubSettings) getStubSettings()).updateBackendServiceSettings(); + } + + public static final BackendServiceSettings create(BackendServiceStubSettings stub) + throws IOException { + return new BackendServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return BackendServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return BackendServiceStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return BackendServiceStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return BackendServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return BackendServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return BackendServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return BackendServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return BackendServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected BackendServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for BackendServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(BackendServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(BackendServiceStubSettings.newBuilder()); + } + + protected Builder(BackendServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(BackendServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public BackendServiceStubSettings.Builder getStubSettingsBuilder() { + return ((BackendServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListBackendServices. */ + public PagedCallSettings.Builder< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + AggregatedListBackendServicesPagedResponse> + aggregatedListBackendServicesSettings() { + return getStubSettingsBuilder().aggregatedListBackendServicesSettings(); + } + + /** Returns the builder for the settings used for calls to deleteBackendService. */ + public UnaryCallSettings.Builder + deleteBackendServiceSettings() { + return getStubSettingsBuilder().deleteBackendServiceSettings(); + } + + /** Returns the builder for the settings used for calls to getBackendService. */ + public UnaryCallSettings.Builder + getBackendServiceSettings() { + return getStubSettingsBuilder().getBackendServiceSettings(); + } + + /** Returns the builder for the settings used for calls to getHealthBackendService. */ + public UnaryCallSettings.Builder + getHealthBackendServiceSettings() { + return getStubSettingsBuilder().getHealthBackendServiceSettings(); + } + + /** Returns the builder for the settings used for calls to insertBackendService. */ + public UnaryCallSettings.Builder + insertBackendServiceSettings() { + return getStubSettingsBuilder().insertBackendServiceSettings(); + } + + /** Returns the builder for the settings used for calls to listBackendServices. */ + public PagedCallSettings.Builder< + ListBackendServicesHttpRequest, BackendServiceList, ListBackendServicesPagedResponse> + listBackendServicesSettings() { + return getStubSettingsBuilder().listBackendServicesSettings(); + } + + /** Returns the builder for the settings used for calls to patchBackendService. */ + public UnaryCallSettings.Builder + patchBackendServiceSettings() { + return getStubSettingsBuilder().patchBackendServiceSettings(); + } + + /** Returns the builder for the settings used for calls to updateBackendService. */ + public UnaryCallSettings.Builder + updateBackendServiceSettings() { + return getStubSettingsBuilder().updateBackendServiceSettings(); + } + + @Override + public BackendServiceSettings build() throws IOException { + return new BackendServiceSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServicesScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServicesScopedList.java new file mode 100644 index 000000000000..2314286e6873 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServicesScopedList.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class BackendServicesScopedList implements ApiMessage { + private final List backendServices; + private final Warning warning; + + private BackendServicesScopedList() { + this.backendServices = null; + this.warning = null; + } + + private BackendServicesScopedList(List backendServices, Warning warning) { + this.backendServices = backendServices; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("backendServices")) { + return backendServices; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getBackendServicesList() { + return backendServices; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(BackendServicesScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static BackendServicesScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final BackendServicesScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new BackendServicesScopedList(); + } + + public static class Builder { + private List backendServices; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(BackendServicesScopedList other) { + if (other == BackendServicesScopedList.getDefaultInstance()) return this; + if (other.getBackendServicesList() != null) { + this.backendServices = other.backendServices; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(BackendServicesScopedList source) { + this.backendServices = source.backendServices; + this.warning = source.warning; + } + + public List getBackendServicesList() { + return backendServices; + } + + public Builder addAllBackendServices(List backendServices) { + if (this.backendServices == null) { + this.backendServices = new ArrayList<>(backendServices.size()); + } + this.backendServices.addAll(backendServices); + return this; + } + + public Builder addBackendServices(BackendService backendServices) { + this.backendServices.add(backendServices); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public BackendServicesScopedList build() { + + return new BackendServicesScopedList(backendServices, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllBackendServices(this.backendServices); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "BackendServicesScopedList{" + + "backendServices=" + + backendServices + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BackendServicesScopedList) { + BackendServicesScopedList that = (BackendServicesScopedList) o; + return Objects.equals(this.backendServices, that.getBackendServicesList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(backendServices, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CacheInvalidationRule.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CacheInvalidationRule.java new file mode 100644 index 000000000000..34d363da9d00 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CacheInvalidationRule.java @@ -0,0 +1,168 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class CacheInvalidationRule implements ApiMessage { + private final String host; + private final String path; + + private CacheInvalidationRule() { + this.host = null; + this.path = null; + } + + private CacheInvalidationRule(String host, String path) { + this.host = host; + this.path = path; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("host")) { + return host; + } + if (fieldName.equals("path")) { + return path; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getHost() { + return host; + } + + public String getPath() { + return path; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(CacheInvalidationRule prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static CacheInvalidationRule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final CacheInvalidationRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new CacheInvalidationRule(); + } + + public static class Builder { + private String host; + private String path; + + Builder() {} + + public Builder mergeFrom(CacheInvalidationRule other) { + if (other == CacheInvalidationRule.getDefaultInstance()) return this; + if (other.getHost() != null) { + this.host = other.host; + } + if (other.getPath() != null) { + this.path = other.path; + } + return this; + } + + Builder(CacheInvalidationRule source) { + this.host = source.host; + this.path = source.path; + } + + public String getHost() { + return host; + } + + public Builder setHost(String host) { + this.host = host; + return this; + } + + public String getPath() { + return path; + } + + public Builder setPath(String path) { + this.path = path; + return this; + } + + public CacheInvalidationRule build() { + + return new CacheInvalidationRule(host, path); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setHost(this.host); + newBuilder.setPath(this.path); + return newBuilder; + } + } + + @Override + public String toString() { + return "CacheInvalidationRule{" + "host=" + host + ", " + "path=" + path + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CacheInvalidationRule) { + CacheInvalidationRule that = (CacheInvalidationRule) o; + return Objects.equals(this.host, that.getHost()) && Objects.equals(this.path, that.getPath()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(host, path); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CacheKeyPolicy.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CacheKeyPolicy.java new file mode 100644 index 000000000000..ebfa5f81c911 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CacheKeyPolicy.java @@ -0,0 +1,294 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class CacheKeyPolicy implements ApiMessage { + private final Boolean includeHost; + private final Boolean includeProtocol; + private final Boolean includeQueryString; + private final List queryStringBlacklist; + private final List queryStringWhitelist; + + private CacheKeyPolicy() { + this.includeHost = null; + this.includeProtocol = null; + this.includeQueryString = null; + this.queryStringBlacklist = null; + this.queryStringWhitelist = null; + } + + private CacheKeyPolicy( + Boolean includeHost, + Boolean includeProtocol, + Boolean includeQueryString, + List queryStringBlacklist, + List queryStringWhitelist) { + this.includeHost = includeHost; + this.includeProtocol = includeProtocol; + this.includeQueryString = includeQueryString; + this.queryStringBlacklist = queryStringBlacklist; + this.queryStringWhitelist = queryStringWhitelist; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("includeHost")) { + return includeHost; + } + if (fieldName.equals("includeProtocol")) { + return includeProtocol; + } + if (fieldName.equals("includeQueryString")) { + return includeQueryString; + } + if (fieldName.equals("queryStringBlacklist")) { + return queryStringBlacklist; + } + if (fieldName.equals("queryStringWhitelist")) { + return queryStringWhitelist; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getIncludeHost() { + return includeHost; + } + + public Boolean getIncludeProtocol() { + return includeProtocol; + } + + public Boolean getIncludeQueryString() { + return includeQueryString; + } + + public List getQueryStringBlacklistList() { + return queryStringBlacklist; + } + + public List getQueryStringWhitelistList() { + return queryStringWhitelist; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(CacheKeyPolicy prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static CacheKeyPolicy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final CacheKeyPolicy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new CacheKeyPolicy(); + } + + public static class Builder { + private Boolean includeHost; + private Boolean includeProtocol; + private Boolean includeQueryString; + private List queryStringBlacklist; + private List queryStringWhitelist; + + Builder() {} + + public Builder mergeFrom(CacheKeyPolicy other) { + if (other == CacheKeyPolicy.getDefaultInstance()) return this; + if (other.getIncludeHost() != null) { + this.includeHost = other.includeHost; + } + if (other.getIncludeProtocol() != null) { + this.includeProtocol = other.includeProtocol; + } + if (other.getIncludeQueryString() != null) { + this.includeQueryString = other.includeQueryString; + } + if (other.getQueryStringBlacklistList() != null) { + this.queryStringBlacklist = other.queryStringBlacklist; + } + if (other.getQueryStringWhitelistList() != null) { + this.queryStringWhitelist = other.queryStringWhitelist; + } + return this; + } + + Builder(CacheKeyPolicy source) { + this.includeHost = source.includeHost; + this.includeProtocol = source.includeProtocol; + this.includeQueryString = source.includeQueryString; + this.queryStringBlacklist = source.queryStringBlacklist; + this.queryStringWhitelist = source.queryStringWhitelist; + } + + public Boolean getIncludeHost() { + return includeHost; + } + + public Builder setIncludeHost(Boolean includeHost) { + this.includeHost = includeHost; + return this; + } + + public Boolean getIncludeProtocol() { + return includeProtocol; + } + + public Builder setIncludeProtocol(Boolean includeProtocol) { + this.includeProtocol = includeProtocol; + return this; + } + + public Boolean getIncludeQueryString() { + return includeQueryString; + } + + public Builder setIncludeQueryString(Boolean includeQueryString) { + this.includeQueryString = includeQueryString; + return this; + } + + public List getQueryStringBlacklistList() { + return queryStringBlacklist; + } + + public Builder addAllQueryStringBlacklist(List queryStringBlacklist) { + if (this.queryStringBlacklist == null) { + this.queryStringBlacklist = new ArrayList<>(queryStringBlacklist.size()); + } + this.queryStringBlacklist.addAll(queryStringBlacklist); + return this; + } + + public Builder addQueryStringBlacklist(String queryStringBlacklist) { + this.queryStringBlacklist.add(queryStringBlacklist); + return this; + } + + public List getQueryStringWhitelistList() { + return queryStringWhitelist; + } + + public Builder addAllQueryStringWhitelist(List queryStringWhitelist) { + if (this.queryStringWhitelist == null) { + this.queryStringWhitelist = new ArrayList<>(queryStringWhitelist.size()); + } + this.queryStringWhitelist.addAll(queryStringWhitelist); + return this; + } + + public Builder addQueryStringWhitelist(String queryStringWhitelist) { + this.queryStringWhitelist.add(queryStringWhitelist); + return this; + } + + public CacheKeyPolicy build() { + + return new CacheKeyPolicy( + includeHost, + includeProtocol, + includeQueryString, + queryStringBlacklist, + queryStringWhitelist); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setIncludeHost(this.includeHost); + newBuilder.setIncludeProtocol(this.includeProtocol); + newBuilder.setIncludeQueryString(this.includeQueryString); + newBuilder.addAllQueryStringBlacklist(this.queryStringBlacklist); + newBuilder.addAllQueryStringWhitelist(this.queryStringWhitelist); + return newBuilder; + } + } + + @Override + public String toString() { + return "CacheKeyPolicy{" + + "includeHost=" + + includeHost + + ", " + + "includeProtocol=" + + includeProtocol + + ", " + + "includeQueryString=" + + includeQueryString + + ", " + + "queryStringBlacklist=" + + queryStringBlacklist + + ", " + + "queryStringWhitelist=" + + queryStringWhitelist + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CacheKeyPolicy) { + CacheKeyPolicy that = (CacheKeyPolicy) o; + return Objects.equals(this.includeHost, that.getIncludeHost()) + && Objects.equals(this.includeProtocol, that.getIncludeProtocol()) + && Objects.equals(this.includeQueryString, that.getIncludeQueryString()) + && Objects.equals(this.queryStringBlacklist, that.getQueryStringBlacklistList()) + && Objects.equals(this.queryStringWhitelist, that.getQueryStringWhitelistList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + includeHost, + includeProtocol, + includeQueryString, + queryStringBlacklist, + queryStringWhitelist); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Commitment.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Commitment.java new file mode 100644 index 000000000000..dc34e8a93323 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Commitment.java @@ -0,0 +1,542 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Commitment implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String endTimestamp; + private final String id; + private final String kind; + private final String name; + private final String plan; + private final String region; + private final List resources; + private final String selfLink; + private final String startTimestamp; + private final String status; + private final String statusMessage; + + private Commitment() { + this.creationTimestamp = null; + this.description = null; + this.endTimestamp = null; + this.id = null; + this.kind = null; + this.name = null; + this.plan = null; + this.region = null; + this.resources = null; + this.selfLink = null; + this.startTimestamp = null; + this.status = null; + this.statusMessage = null; + } + + private Commitment( + String creationTimestamp, + String description, + String endTimestamp, + String id, + String kind, + String name, + String plan, + String region, + List resources, + String selfLink, + String startTimestamp, + String status, + String statusMessage) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.endTimestamp = endTimestamp; + this.id = id; + this.kind = kind; + this.name = name; + this.plan = plan; + this.region = region; + this.resources = resources; + this.selfLink = selfLink; + this.startTimestamp = startTimestamp; + this.status = status; + this.statusMessage = statusMessage; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("endTimestamp")) { + return endTimestamp; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("plan")) { + return plan; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("resources")) { + return resources; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("startTimestamp")) { + return startTimestamp; + } + if (fieldName.equals("status")) { + return status; + } + if (fieldName.equals("statusMessage")) { + return statusMessage; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getEndTimestamp() { + return endTimestamp; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getPlan() { + return plan; + } + + public String getRegion() { + return region; + } + + public List getResourcesList() { + return resources; + } + + public String getSelfLink() { + return selfLink; + } + + public String getStartTimestamp() { + return startTimestamp; + } + + public String getStatus() { + return status; + } + + public String getStatusMessage() { + return statusMessage; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Commitment prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Commitment getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Commitment DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Commitment(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String endTimestamp; + private String id; + private String kind; + private String name; + private String plan; + private String region; + private List resources; + private String selfLink; + private String startTimestamp; + private String status; + private String statusMessage; + + Builder() {} + + public Builder mergeFrom(Commitment other) { + if (other == Commitment.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getEndTimestamp() != null) { + this.endTimestamp = other.endTimestamp; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPlan() != null) { + this.plan = other.plan; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getResourcesList() != null) { + this.resources = other.resources; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getStartTimestamp() != null) { + this.startTimestamp = other.startTimestamp; + } + if (other.getStatus() != null) { + this.status = other.status; + } + if (other.getStatusMessage() != null) { + this.statusMessage = other.statusMessage; + } + return this; + } + + Builder(Commitment source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.endTimestamp = source.endTimestamp; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.plan = source.plan; + this.region = source.region; + this.resources = source.resources; + this.selfLink = source.selfLink; + this.startTimestamp = source.startTimestamp; + this.status = source.status; + this.statusMessage = source.statusMessage; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getEndTimestamp() { + return endTimestamp; + } + + public Builder setEndTimestamp(String endTimestamp) { + this.endTimestamp = endTimestamp; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getPlan() { + return plan; + } + + public Builder setPlan(String plan) { + this.plan = plan; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public List getResourcesList() { + return resources; + } + + public Builder addAllResources(List resources) { + if (this.resources == null) { + this.resources = new ArrayList<>(resources.size()); + } + this.resources.addAll(resources); + return this; + } + + public Builder addResources(ResourceCommitment resources) { + this.resources.add(resources); + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getStartTimestamp() { + return startTimestamp; + } + + public Builder setStartTimestamp(String startTimestamp) { + this.startTimestamp = startTimestamp; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public String getStatusMessage() { + return statusMessage; + } + + public Builder setStatusMessage(String statusMessage) { + this.statusMessage = statusMessage; + return this; + } + + public Commitment build() { + + return new Commitment( + creationTimestamp, + description, + endTimestamp, + id, + kind, + name, + plan, + region, + resources, + selfLink, + startTimestamp, + status, + statusMessage); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setEndTimestamp(this.endTimestamp); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setPlan(this.plan); + newBuilder.setRegion(this.region); + newBuilder.addAllResources(this.resources); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setStartTimestamp(this.startTimestamp); + newBuilder.setStatus(this.status); + newBuilder.setStatusMessage(this.statusMessage); + return newBuilder; + } + } + + @Override + public String toString() { + return "Commitment{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "endTimestamp=" + + endTimestamp + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "plan=" + + plan + + ", " + + "region=" + + region + + ", " + + "resources=" + + resources + + ", " + + "selfLink=" + + selfLink + + ", " + + "startTimestamp=" + + startTimestamp + + ", " + + "status=" + + status + + ", " + + "statusMessage=" + + statusMessage + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Commitment) { + Commitment that = (Commitment) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.endTimestamp, that.getEndTimestamp()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.plan, that.getPlan()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.resources, that.getResourcesList()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.startTimestamp, that.getStartTimestamp()) + && Objects.equals(this.status, that.getStatus()) + && Objects.equals(this.statusMessage, that.getStatusMessage()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + description, + endTimestamp, + id, + kind, + name, + plan, + region, + resources, + selfLink, + startTimestamp, + status, + statusMessage); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CommitmentAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CommitmentAggregatedList.java new file mode 100644 index 000000000000..755176db0c56 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CommitmentAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class CommitmentAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private CommitmentAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private CommitmentAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(CommitmentAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static CommitmentAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final CommitmentAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new CommitmentAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(CommitmentAggregatedList other) { + if (other == CommitmentAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(CommitmentAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public CommitmentAggregatedList build() { + + return new CommitmentAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "CommitmentAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CommitmentAggregatedList) { + CommitmentAggregatedList that = (CommitmentAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CommitmentList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CommitmentList.java new file mode 100644 index 000000000000..8d6a8931d91b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CommitmentList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class CommitmentList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private CommitmentList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private CommitmentList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(CommitmentList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static CommitmentList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final CommitmentList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new CommitmentList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(CommitmentList other) { + if (other == CommitmentList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(CommitmentList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Commitment items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public CommitmentList build() { + + return new CommitmentList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "CommitmentList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CommitmentList) { + CommitmentList that = (CommitmentList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CommitmentsScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CommitmentsScopedList.java new file mode 100644 index 000000000000..7abc8f23eb5a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CommitmentsScopedList.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class CommitmentsScopedList implements ApiMessage { + private final List commitments; + private final Warning warning; + + private CommitmentsScopedList() { + this.commitments = null; + this.warning = null; + } + + private CommitmentsScopedList(List commitments, Warning warning) { + this.commitments = commitments; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("commitments")) { + return commitments; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getCommitmentsList() { + return commitments; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(CommitmentsScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static CommitmentsScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final CommitmentsScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new CommitmentsScopedList(); + } + + public static class Builder { + private List commitments; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(CommitmentsScopedList other) { + if (other == CommitmentsScopedList.getDefaultInstance()) return this; + if (other.getCommitmentsList() != null) { + this.commitments = other.commitments; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(CommitmentsScopedList source) { + this.commitments = source.commitments; + this.warning = source.warning; + } + + public List getCommitmentsList() { + return commitments; + } + + public Builder addAllCommitments(List commitments) { + if (this.commitments == null) { + this.commitments = new ArrayList<>(commitments.size()); + } + this.commitments.addAll(commitments); + return this; + } + + public Builder addCommitments(Commitment commitments) { + this.commitments.add(commitments); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public CommitmentsScopedList build() { + + return new CommitmentsScopedList(commitments, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllCommitments(this.commitments); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "CommitmentsScopedList{" + + "commitments=" + + commitments + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CommitmentsScopedList) { + CommitmentsScopedList that = (CommitmentsScopedList) o; + return Objects.equals(this.commitments, that.getCommitmentsList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(commitments, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ConnectionDraining.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ConnectionDraining.java new file mode 100644 index 000000000000..cbcf3e4a0732 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ConnectionDraining.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ConnectionDraining implements ApiMessage { + private final Integer drainingTimeoutSec; + + private ConnectionDraining() { + this.drainingTimeoutSec = null; + } + + private ConnectionDraining(Integer drainingTimeoutSec) { + this.drainingTimeoutSec = drainingTimeoutSec; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("drainingTimeoutSec")) { + return drainingTimeoutSec; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getDrainingTimeoutSec() { + return drainingTimeoutSec; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ConnectionDraining prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ConnectionDraining getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ConnectionDraining DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ConnectionDraining(); + } + + public static class Builder { + private Integer drainingTimeoutSec; + + Builder() {} + + public Builder mergeFrom(ConnectionDraining other) { + if (other == ConnectionDraining.getDefaultInstance()) return this; + if (other.getDrainingTimeoutSec() != null) { + this.drainingTimeoutSec = other.drainingTimeoutSec; + } + return this; + } + + Builder(ConnectionDraining source) { + this.drainingTimeoutSec = source.drainingTimeoutSec; + } + + public Integer getDrainingTimeoutSec() { + return drainingTimeoutSec; + } + + public Builder setDrainingTimeoutSec(Integer drainingTimeoutSec) { + this.drainingTimeoutSec = drainingTimeoutSec; + return this; + } + + public ConnectionDraining build() { + return new ConnectionDraining(drainingTimeoutSec); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDrainingTimeoutSec(this.drainingTimeoutSec); + return newBuilder; + } + } + + @Override + public String toString() { + return "ConnectionDraining{" + "drainingTimeoutSec=" + drainingTimeoutSec + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ConnectionDraining) { + ConnectionDraining that = (ConnectionDraining) o; + return Objects.equals(this.drainingTimeoutSec, that.getDrainingTimeoutSec()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(drainingTimeoutSec); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CreateSnapshotDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CreateSnapshotDiskHttpRequest.java new file mode 100644 index 000000000000..61bb82da6835 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CreateSnapshotDiskHttpRequest.java @@ -0,0 +1,477 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class CreateSnapshotDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String disk; + private final String fields; + private final Boolean guestFlush; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final Snapshot snapshotResource; + private final String userIp; + + private CreateSnapshotDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.disk = null; + this.fields = null; + this.guestFlush = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.snapshotResource = null; + this.userIp = null; + } + + private CreateSnapshotDiskHttpRequest( + String access_token, + String callback, + String disk, + String fields, + Boolean guestFlush, + String key, + String prettyPrint, + String quotaUser, + String requestId, + Snapshot snapshotResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.disk = disk; + this.fields = fields; + this.guestFlush = guestFlush; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.snapshotResource = snapshotResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("disk")) { + return disk; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("guestFlush")) { + return guestFlush; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("snapshotResource")) { + return snapshotResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Snapshot getApiMessageRequestBody() { + return snapshotResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getDisk() { + return disk; + } + + public String getFields() { + return fields; + } + + public Boolean getGuestFlush() { + return guestFlush; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public Snapshot getSnapshotResource() { + return snapshotResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(CreateSnapshotDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static CreateSnapshotDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final CreateSnapshotDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new CreateSnapshotDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String disk; + private String fields; + private Boolean guestFlush; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private Snapshot snapshotResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(CreateSnapshotDiskHttpRequest other) { + if (other == CreateSnapshotDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDisk() != null) { + this.disk = other.disk; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getGuestFlush() != null) { + this.guestFlush = other.guestFlush; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSnapshotResource() != null) { + this.snapshotResource = other.snapshotResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(CreateSnapshotDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.disk = source.disk; + this.fields = source.fields; + this.guestFlush = source.guestFlush; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.snapshotResource = source.snapshotResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDisk() { + return disk; + } + + public Builder setDisk(String disk) { + this.disk = disk; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public Boolean getGuestFlush() { + return guestFlush; + } + + public Builder setGuestFlush(Boolean guestFlush) { + this.guestFlush = guestFlush; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Snapshot getSnapshotResource() { + return snapshotResource; + } + + public Builder setSnapshotResource(Snapshot snapshotResource) { + this.snapshotResource = snapshotResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public CreateSnapshotDiskHttpRequest build() { + String missing = ""; + + if (disk == null) { + missing += " disk"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new CreateSnapshotDiskHttpRequest( + access_token, + callback, + disk, + fields, + guestFlush, + key, + prettyPrint, + quotaUser, + requestId, + snapshotResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDisk(this.disk); + newBuilder.setFields(this.fields); + newBuilder.setGuestFlush(this.guestFlush); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSnapshotResource(this.snapshotResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "CreateSnapshotDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "disk=" + + disk + + ", " + + "fields=" + + fields + + ", " + + "guestFlush=" + + guestFlush + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "snapshotResource=" + + snapshotResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CreateSnapshotDiskHttpRequest) { + CreateSnapshotDiskHttpRequest that = (CreateSnapshotDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.disk, that.getDisk()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.guestFlush, that.getGuestFlush()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.snapshotResource, that.getSnapshotResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + disk, + fields, + guestFlush, + key, + prettyPrint, + quotaUser, + requestId, + snapshotResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CreateSnapshotRegionDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CreateSnapshotRegionDiskHttpRequest.java new file mode 100644 index 000000000000..394b1e60eccc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CreateSnapshotRegionDiskHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class CreateSnapshotRegionDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String disk; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final Snapshot snapshotResource; + private final String userIp; + + private CreateSnapshotRegionDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.disk = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.snapshotResource = null; + this.userIp = null; + } + + private CreateSnapshotRegionDiskHttpRequest( + String access_token, + String callback, + String disk, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + Snapshot snapshotResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.disk = disk; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.snapshotResource = snapshotResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("disk")) { + return disk; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("snapshotResource")) { + return snapshotResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Snapshot getApiMessageRequestBody() { + return snapshotResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getDisk() { + return disk; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public Snapshot getSnapshotResource() { + return snapshotResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(CreateSnapshotRegionDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static CreateSnapshotRegionDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final CreateSnapshotRegionDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new CreateSnapshotRegionDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String disk; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private Snapshot snapshotResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(CreateSnapshotRegionDiskHttpRequest other) { + if (other == CreateSnapshotRegionDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDisk() != null) { + this.disk = other.disk; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSnapshotResource() != null) { + this.snapshotResource = other.snapshotResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(CreateSnapshotRegionDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.disk = source.disk; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.snapshotResource = source.snapshotResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDisk() { + return disk; + } + + public Builder setDisk(String disk) { + this.disk = disk; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Snapshot getSnapshotResource() { + return snapshotResource; + } + + public Builder setSnapshotResource(Snapshot snapshotResource) { + this.snapshotResource = snapshotResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public CreateSnapshotRegionDiskHttpRequest build() { + String missing = ""; + + if (disk == null) { + missing += " disk"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new CreateSnapshotRegionDiskHttpRequest( + access_token, + callback, + disk, + fields, + key, + prettyPrint, + quotaUser, + requestId, + snapshotResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDisk(this.disk); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSnapshotResource(this.snapshotResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "CreateSnapshotRegionDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "disk=" + + disk + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "snapshotResource=" + + snapshotResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CreateSnapshotRegionDiskHttpRequest) { + CreateSnapshotRegionDiskHttpRequest that = (CreateSnapshotRegionDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.disk, that.getDisk()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.snapshotResource, that.getSnapshotResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + disk, + fields, + key, + prettyPrint, + quotaUser, + requestId, + snapshotResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CustomerEncryptionKey.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CustomerEncryptionKey.java new file mode 100644 index 000000000000..5c1acb5c85e4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CustomerEncryptionKey.java @@ -0,0 +1,169 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class CustomerEncryptionKey implements ApiMessage { + private final String rawKey; + private final String sha256; + + private CustomerEncryptionKey() { + this.rawKey = null; + this.sha256 = null; + } + + private CustomerEncryptionKey(String rawKey, String sha256) { + this.rawKey = rawKey; + this.sha256 = sha256; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("rawKey")) { + return rawKey; + } + if (fieldName.equals("sha256")) { + return sha256; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getRawKey() { + return rawKey; + } + + public String getSha256() { + return sha256; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(CustomerEncryptionKey prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static CustomerEncryptionKey getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final CustomerEncryptionKey DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new CustomerEncryptionKey(); + } + + public static class Builder { + private String rawKey; + private String sha256; + + Builder() {} + + public Builder mergeFrom(CustomerEncryptionKey other) { + if (other == CustomerEncryptionKey.getDefaultInstance()) return this; + if (other.getRawKey() != null) { + this.rawKey = other.rawKey; + } + if (other.getSha256() != null) { + this.sha256 = other.sha256; + } + return this; + } + + Builder(CustomerEncryptionKey source) { + this.rawKey = source.rawKey; + this.sha256 = source.sha256; + } + + public String getRawKey() { + return rawKey; + } + + public Builder setRawKey(String rawKey) { + this.rawKey = rawKey; + return this; + } + + public String getSha256() { + return sha256; + } + + public Builder setSha256(String sha256) { + this.sha256 = sha256; + return this; + } + + public CustomerEncryptionKey build() { + + return new CustomerEncryptionKey(rawKey, sha256); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setRawKey(this.rawKey); + newBuilder.setSha256(this.sha256); + return newBuilder; + } + } + + @Override + public String toString() { + return "CustomerEncryptionKey{" + "rawKey=" + rawKey + ", " + "sha256=" + sha256 + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CustomerEncryptionKey) { + CustomerEncryptionKey that = (CustomerEncryptionKey) o; + return Objects.equals(this.rawKey, that.getRawKey()) + && Objects.equals(this.sha256, that.getSha256()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(rawKey, sha256); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CustomerEncryptionKeyProtectedDisk.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CustomerEncryptionKeyProtectedDisk.java new file mode 100644 index 000000000000..31796df11626 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/CustomerEncryptionKeyProtectedDisk.java @@ -0,0 +1,176 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class CustomerEncryptionKeyProtectedDisk implements ApiMessage { + private final CustomerEncryptionKey diskEncryptionKey; + private final String source; + + private CustomerEncryptionKeyProtectedDisk() { + this.diskEncryptionKey = null; + this.source = null; + } + + private CustomerEncryptionKeyProtectedDisk( + CustomerEncryptionKey diskEncryptionKey, String source) { + this.diskEncryptionKey = diskEncryptionKey; + this.source = source; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("diskEncryptionKey")) { + return diskEncryptionKey; + } + if (fieldName.equals("source")) { + return source; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public CustomerEncryptionKey getDiskEncryptionKey() { + return diskEncryptionKey; + } + + public String getSource() { + return source; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(CustomerEncryptionKeyProtectedDisk prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static CustomerEncryptionKeyProtectedDisk getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final CustomerEncryptionKeyProtectedDisk DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new CustomerEncryptionKeyProtectedDisk(); + } + + public static class Builder { + private CustomerEncryptionKey diskEncryptionKey; + private String source; + + Builder() {} + + public Builder mergeFrom(CustomerEncryptionKeyProtectedDisk other) { + if (other == CustomerEncryptionKeyProtectedDisk.getDefaultInstance()) return this; + if (other.getDiskEncryptionKey() != null) { + this.diskEncryptionKey = other.diskEncryptionKey; + } + if (other.getSource() != null) { + this.source = other.source; + } + return this; + } + + Builder(CustomerEncryptionKeyProtectedDisk source) { + this.diskEncryptionKey = source.diskEncryptionKey; + this.source = source.source; + } + + public CustomerEncryptionKey getDiskEncryptionKey() { + return diskEncryptionKey; + } + + public Builder setDiskEncryptionKey(CustomerEncryptionKey diskEncryptionKey) { + this.diskEncryptionKey = diskEncryptionKey; + return this; + } + + public String getSource() { + return source; + } + + public Builder setSource(String source) { + this.source = source; + return this; + } + + public CustomerEncryptionKeyProtectedDisk build() { + + return new CustomerEncryptionKeyProtectedDisk(diskEncryptionKey, source); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDiskEncryptionKey(this.diskEncryptionKey); + newBuilder.setSource(this.source); + return newBuilder; + } + } + + @Override + public String toString() { + return "CustomerEncryptionKeyProtectedDisk{" + + "diskEncryptionKey=" + + diskEncryptionKey + + ", " + + "source=" + + source + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CustomerEncryptionKeyProtectedDisk) { + CustomerEncryptionKeyProtectedDisk that = (CustomerEncryptionKeyProtectedDisk) o; + return Objects.equals(this.diskEncryptionKey, that.getDiskEncryptionKey()) + && Objects.equals(this.source, that.getSource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(diskEncryptionKey, source); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Data.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Data.java new file mode 100644 index 000000000000..d74b9ed54b52 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Data.java @@ -0,0 +1,168 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Data implements ApiMessage { + private final String key; + private final String value; + + private Data() { + this.key = null; + this.value = null; + } + + private Data(String key, String value) { + this.key = key; + this.value = value; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("value")) { + return value; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getKey() { + return key; + } + + public String getValue() { + return value; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Data prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Data getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Data DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Data(); + } + + public static class Builder { + private String key; + private String value; + + Builder() {} + + public Builder mergeFrom(Data other) { + if (other == Data.getDefaultInstance()) return this; + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getValue() != null) { + this.value = other.value; + } + return this; + } + + Builder(Data source) { + this.key = source.key; + this.value = source.value; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getValue() { + return value; + } + + public Builder setValue(String value) { + this.value = value; + return this; + } + + public Data build() { + + return new Data(key, value); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setKey(this.key); + newBuilder.setValue(this.value); + return newBuilder; + } + } + + @Override + public String toString() { + return "Data{" + "key=" + key + ", " + "value=" + value + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Data) { + Data that = (Data) o; + return Objects.equals(this.key, that.getKey()) && Objects.equals(this.value, that.getValue()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(key, value); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteAccessConfigInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteAccessConfigInstanceHttpRequest.java new file mode 100644 index 000000000000..0d0497c6c3a4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteAccessConfigInstanceHttpRequest.java @@ -0,0 +1,484 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteAccessConfigInstanceHttpRequest implements ApiMessage { + private final String accessConfig; + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final String networkInterface; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteAccessConfigInstanceHttpRequest() { + this.accessConfig = null; + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.networkInterface = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteAccessConfigInstanceHttpRequest( + String accessConfig, + String access_token, + String callback, + String fields, + String instance, + String key, + String networkInterface, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.accessConfig = accessConfig; + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.networkInterface = networkInterface; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("accessConfig")) { + return accessConfig; + } + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("networkInterface")) { + return networkInterface; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessConfig() { + return accessConfig; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getNetworkInterface() { + return networkInterface; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteAccessConfigInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteAccessConfigInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteAccessConfigInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteAccessConfigInstanceHttpRequest(); + } + + public static class Builder { + private String accessConfig; + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private String networkInterface; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteAccessConfigInstanceHttpRequest other) { + if (other == DeleteAccessConfigInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessConfig() != null) { + this.accessConfig = other.accessConfig; + } + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getNetworkInterface() != null) { + this.networkInterface = other.networkInterface; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteAccessConfigInstanceHttpRequest source) { + this.accessConfig = source.accessConfig; + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.networkInterface = source.networkInterface; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessConfig() { + return accessConfig; + } + + public Builder setAccessConfig(String accessConfig) { + this.accessConfig = accessConfig; + return this; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getNetworkInterface() { + return networkInterface; + } + + public Builder setNetworkInterface(String networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteAccessConfigInstanceHttpRequest build() { + String missing = ""; + if (accessConfig == null) { + missing += " accessConfig"; + } + + if (instance == null) { + missing += " instance"; + } + + if (networkInterface == null) { + missing += " networkInterface"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteAccessConfigInstanceHttpRequest( + accessConfig, + access_token, + callback, + fields, + instance, + key, + networkInterface, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessConfig(this.accessConfig); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setNetworkInterface(this.networkInterface); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteAccessConfigInstanceHttpRequest{" + + "accessConfig=" + + accessConfig + + ", " + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "networkInterface=" + + networkInterface + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteAccessConfigInstanceHttpRequest) { + DeleteAccessConfigInstanceHttpRequest that = (DeleteAccessConfigInstanceHttpRequest) o; + return Objects.equals(this.accessConfig, that.getAccessConfig()) + && Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.networkInterface, that.getNetworkInterface()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + accessConfig, + access_token, + callback, + fields, + instance, + key, + networkInterface, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteAddressHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteAddressHttpRequest.java new file mode 100644 index 000000000000..693eafccbf44 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteAddressHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteAddressHttpRequest implements ApiMessage { + private final String access_token; + private final String address; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteAddressHttpRequest() { + this.access_token = null; + this.address = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteAddressHttpRequest( + String access_token, + String address, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.address = address; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("address")) { + return address; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getAddress() { + return address; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteAddressHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteAddressHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteAddressHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteAddressHttpRequest(); + } + + public static class Builder { + private String access_token; + private String address; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteAddressHttpRequest other) { + if (other == DeleteAddressHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAddress() != null) { + this.address = other.address; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteAddressHttpRequest source) { + this.access_token = source.access_token; + this.address = source.address; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAddress() { + return address; + } + + public Builder setAddress(String address) { + this.address = address; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteAddressHttpRequest build() { + String missing = ""; + + if (address == null) { + missing += " address"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteAddressHttpRequest( + access_token, address, callback, fields, key, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAddress(this.address); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteAddressHttpRequest{" + + "access_token=" + + access_token + + ", " + + "address=" + + address + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteAddressHttpRequest) { + DeleteAddressHttpRequest that = (DeleteAddressHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.address, that.getAddress()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, address, callback, fields, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteAutoscalerHttpRequest.java new file mode 100644 index 000000000000..0d0e58fd556a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteAutoscalerHttpRequest.java @@ -0,0 +1,405 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteAutoscalerHttpRequest implements ApiMessage { + private final String access_token; + private final String autoscaler; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteAutoscalerHttpRequest() { + this.access_token = null; + this.autoscaler = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteAutoscalerHttpRequest( + String access_token, + String autoscaler, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.autoscaler = autoscaler; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("autoscaler")) { + return autoscaler; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getAutoscaler() { + return autoscaler; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteAutoscalerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteAutoscalerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteAutoscalerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteAutoscalerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String autoscaler; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteAutoscalerHttpRequest other) { + if (other == DeleteAutoscalerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAutoscaler() != null) { + this.autoscaler = other.autoscaler; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteAutoscalerHttpRequest source) { + this.access_token = source.access_token; + this.autoscaler = source.autoscaler; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Builder setAutoscaler(String autoscaler) { + this.autoscaler = autoscaler; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteAutoscalerHttpRequest build() { + String missing = ""; + + if (autoscaler == null) { + missing += " autoscaler"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteAutoscalerHttpRequest( + access_token, + autoscaler, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAutoscaler(this.autoscaler); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteAutoscalerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "autoscaler=" + + autoscaler + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteAutoscalerHttpRequest) { + DeleteAutoscalerHttpRequest that = (DeleteAutoscalerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.autoscaler, that.getAutoscaler()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, autoscaler, callback, fields, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteBackendBucketHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteBackendBucketHttpRequest.java new file mode 100644 index 000000000000..bdefaf6a5a18 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteBackendBucketHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteBackendBucketHttpRequest implements ApiMessage { + private final String access_token; + private final String backendBucket; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteBackendBucketHttpRequest() { + this.access_token = null; + this.backendBucket = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteBackendBucketHttpRequest( + String access_token, + String backendBucket, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendBucket = backendBucket; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendBucket")) { + return backendBucket; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendBucket() { + return backendBucket; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteBackendBucketHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteBackendBucketHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteBackendBucketHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteBackendBucketHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendBucket; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteBackendBucketHttpRequest other) { + if (other == DeleteBackendBucketHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendBucket() != null) { + this.backendBucket = other.backendBucket; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteBackendBucketHttpRequest source) { + this.access_token = source.access_token; + this.backendBucket = source.backendBucket; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendBucket() { + return backendBucket; + } + + public Builder setBackendBucket(String backendBucket) { + this.backendBucket = backendBucket; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteBackendBucketHttpRequest build() { + String missing = ""; + + if (backendBucket == null) { + missing += " backendBucket"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteBackendBucketHttpRequest( + access_token, + backendBucket, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendBucket(this.backendBucket); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteBackendBucketHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendBucket=" + + backendBucket + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteBackendBucketHttpRequest) { + DeleteBackendBucketHttpRequest that = (DeleteBackendBucketHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendBucket, that.getBackendBucket()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendBucket, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteBackendServiceHttpRequest.java new file mode 100644 index 000000000000..36c2f268f09b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteBackendServiceHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final String backendService; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteBackendServiceHttpRequest() { + this.access_token = null; + this.backendService = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteBackendServiceHttpRequest( + String access_token, + String backendService, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendService = backendService; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendService")) { + return backendService; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendService() { + return backendService; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendService; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteBackendServiceHttpRequest other) { + if (other == DeleteBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendService() != null) { + this.backendService = other.backendService; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendService = source.backendService; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendService() { + return backendService; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteBackendServiceHttpRequest build() { + String missing = ""; + + if (backendService == null) { + missing += " backendService"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteBackendServiceHttpRequest( + access_token, + backendService, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendService(this.backendService); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendService=" + + backendService + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteBackendServiceHttpRequest) { + DeleteBackendServiceHttpRequest that = (DeleteBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendService, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteDiskHttpRequest.java new file mode 100644 index 000000000000..6f71d205d1ed --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteDiskHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String disk; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.disk = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteDiskHttpRequest( + String access_token, + String callback, + String disk, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.disk = disk; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("disk")) { + return disk; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getDisk() { + return disk; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String disk; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteDiskHttpRequest other) { + if (other == DeleteDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDisk() != null) { + this.disk = other.disk; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.disk = source.disk; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDisk() { + return disk; + } + + public Builder setDisk(String disk) { + this.disk = disk; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteDiskHttpRequest build() { + String missing = ""; + + if (disk == null) { + missing += " disk"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteDiskHttpRequest( + access_token, callback, disk, fields, key, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDisk(this.disk); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "disk=" + + disk + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteDiskHttpRequest) { + DeleteDiskHttpRequest that = (DeleteDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.disk, that.getDisk()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, disk, fields, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteFirewallHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteFirewallHttpRequest.java new file mode 100644 index 000000000000..170556e99284 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteFirewallHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteFirewallHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String firewall; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteFirewallHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.firewall = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteFirewallHttpRequest( + String access_token, + String callback, + String fields, + String firewall, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.firewall = firewall; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("firewall")) { + return firewall; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFirewall() { + return firewall; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteFirewallHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteFirewallHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteFirewallHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteFirewallHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String firewall; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteFirewallHttpRequest other) { + if (other == DeleteFirewallHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFirewall() != null) { + this.firewall = other.firewall; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteFirewallHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.firewall = source.firewall; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFirewall() { + return firewall; + } + + public Builder setFirewall(String firewall) { + this.firewall = firewall; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteFirewallHttpRequest build() { + String missing = ""; + + if (firewall == null) { + missing += " firewall"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteFirewallHttpRequest( + access_token, callback, fields, firewall, key, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFirewall(this.firewall); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteFirewallHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "firewall=" + + firewall + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteFirewallHttpRequest) { + DeleteFirewallHttpRequest that = (DeleteFirewallHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.firewall, that.getFirewall()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, firewall, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteForwardingRuleHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteForwardingRuleHttpRequest.java new file mode 100644 index 000000000000..42e54201f856 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteForwardingRuleHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteForwardingRuleHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String forwardingRule; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteForwardingRuleHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.forwardingRule = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteForwardingRuleHttpRequest( + String access_token, + String callback, + String fields, + String forwardingRule, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.forwardingRule = forwardingRule; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("forwardingRule")) { + return forwardingRule; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteForwardingRuleHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteForwardingRuleHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteForwardingRuleHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteForwardingRuleHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String forwardingRule; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteForwardingRuleHttpRequest other) { + if (other == DeleteForwardingRuleHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getForwardingRule() != null) { + this.forwardingRule = other.forwardingRule; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteForwardingRuleHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.forwardingRule = source.forwardingRule; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public Builder setForwardingRule(String forwardingRule) { + this.forwardingRule = forwardingRule; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteForwardingRuleHttpRequest build() { + String missing = ""; + + if (forwardingRule == null) { + missing += " forwardingRule"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteForwardingRuleHttpRequest( + access_token, + callback, + fields, + forwardingRule, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setForwardingRule(this.forwardingRule); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteForwardingRuleHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "forwardingRule=" + + forwardingRule + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteForwardingRuleHttpRequest) { + DeleteForwardingRuleHttpRequest that = (DeleteForwardingRuleHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.forwardingRule, that.getForwardingRule()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + forwardingRule, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteGlobalAddressHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteGlobalAddressHttpRequest.java new file mode 100644 index 000000000000..b1106d5bb80e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteGlobalAddressHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteGlobalAddressHttpRequest implements ApiMessage { + private final String access_token; + private final String address; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteGlobalAddressHttpRequest() { + this.access_token = null; + this.address = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteGlobalAddressHttpRequest( + String access_token, + String address, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.address = address; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("address")) { + return address; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getAddress() { + return address; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteGlobalAddressHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteGlobalAddressHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteGlobalAddressHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteGlobalAddressHttpRequest(); + } + + public static class Builder { + private String access_token; + private String address; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteGlobalAddressHttpRequest other) { + if (other == DeleteGlobalAddressHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAddress() != null) { + this.address = other.address; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteGlobalAddressHttpRequest source) { + this.access_token = source.access_token; + this.address = source.address; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAddress() { + return address; + } + + public Builder setAddress(String address) { + this.address = address; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteGlobalAddressHttpRequest build() { + String missing = ""; + + if (address == null) { + missing += " address"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteGlobalAddressHttpRequest( + access_token, address, callback, fields, key, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAddress(this.address); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteGlobalAddressHttpRequest{" + + "access_token=" + + access_token + + ", " + + "address=" + + address + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteGlobalAddressHttpRequest) { + DeleteGlobalAddressHttpRequest that = (DeleteGlobalAddressHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.address, that.getAddress()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, address, callback, fields, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteGlobalForwardingRuleHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteGlobalForwardingRuleHttpRequest.java new file mode 100644 index 000000000000..9035cee23212 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteGlobalForwardingRuleHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteGlobalForwardingRuleHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String forwardingRule; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteGlobalForwardingRuleHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.forwardingRule = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteGlobalForwardingRuleHttpRequest( + String access_token, + String callback, + String fields, + String forwardingRule, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.forwardingRule = forwardingRule; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("forwardingRule")) { + return forwardingRule; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteGlobalForwardingRuleHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteGlobalForwardingRuleHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteGlobalForwardingRuleHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteGlobalForwardingRuleHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String forwardingRule; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteGlobalForwardingRuleHttpRequest other) { + if (other == DeleteGlobalForwardingRuleHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getForwardingRule() != null) { + this.forwardingRule = other.forwardingRule; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteGlobalForwardingRuleHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.forwardingRule = source.forwardingRule; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public Builder setForwardingRule(String forwardingRule) { + this.forwardingRule = forwardingRule; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteGlobalForwardingRuleHttpRequest build() { + String missing = ""; + + if (forwardingRule == null) { + missing += " forwardingRule"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteGlobalForwardingRuleHttpRequest( + access_token, + callback, + fields, + forwardingRule, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setForwardingRule(this.forwardingRule); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteGlobalForwardingRuleHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "forwardingRule=" + + forwardingRule + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteGlobalForwardingRuleHttpRequest) { + DeleteGlobalForwardingRuleHttpRequest that = (DeleteGlobalForwardingRuleHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.forwardingRule, that.getForwardingRule()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + forwardingRule, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteGlobalOperationHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteGlobalOperationHttpRequest.java new file mode 100644 index 000000000000..6e092ff9013d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteGlobalOperationHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteGlobalOperationHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String operation; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private DeleteGlobalOperationHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.operation = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private DeleteGlobalOperationHttpRequest( + String access_token, + String callback, + String fields, + String key, + String operation, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.operation = operation; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("operation")) { + return operation; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getOperation() { + return operation; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteGlobalOperationHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteGlobalOperationHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteGlobalOperationHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteGlobalOperationHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String operation; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteGlobalOperationHttpRequest other) { + if (other == DeleteGlobalOperationHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getOperation() != null) { + this.operation = other.operation; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteGlobalOperationHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.operation = source.operation; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getOperation() { + return operation; + } + + public Builder setOperation(String operation) { + this.operation = operation; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteGlobalOperationHttpRequest build() { + String missing = ""; + + if (operation == null) { + missing += " operation"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteGlobalOperationHttpRequest( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setOperation(this.operation); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteGlobalOperationHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "operation=" + + operation + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteGlobalOperationHttpRequest) { + DeleteGlobalOperationHttpRequest that = (DeleteGlobalOperationHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.operation, that.getOperation()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteHealthCheckHttpRequest.java new file mode 100644 index 000000000000..8d3a336d5895 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteHealthCheckHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String healthCheck; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.healthCheck = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteHealthCheckHttpRequest( + String access_token, + String callback, + String fields, + String healthCheck, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.healthCheck = healthCheck; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("healthCheck")) { + return healthCheck; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHealthCheck() { + return healthCheck; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String healthCheck; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteHealthCheckHttpRequest other) { + if (other == DeleteHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHealthCheck() != null) { + this.healthCheck = other.healthCheck; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.healthCheck = source.healthCheck; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHealthCheck() { + return healthCheck; + } + + public Builder setHealthCheck(String healthCheck) { + this.healthCheck = healthCheck; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteHealthCheckHttpRequest build() { + String missing = ""; + + if (healthCheck == null) { + missing += " healthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteHealthCheckHttpRequest( + access_token, + callback, + fields, + healthCheck, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setHealthCheck(this.healthCheck); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "healthCheck=" + + healthCheck + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteHealthCheckHttpRequest) { + DeleteHealthCheckHttpRequest that = (DeleteHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.healthCheck, that.getHealthCheck()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + healthCheck, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteHttpHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteHttpHealthCheckHttpRequest.java new file mode 100644 index 000000000000..d349a48aa402 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteHttpHealthCheckHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteHttpHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String httpHealthCheck; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteHttpHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.httpHealthCheck = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteHttpHealthCheckHttpRequest( + String access_token, + String callback, + String fields, + String httpHealthCheck, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.httpHealthCheck = httpHealthCheck; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("httpHealthCheck")) { + return httpHealthCheck; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHttpHealthCheck() { + return httpHealthCheck; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteHttpHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteHttpHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteHttpHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteHttpHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String httpHealthCheck; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteHttpHealthCheckHttpRequest other) { + if (other == DeleteHttpHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHttpHealthCheck() != null) { + this.httpHealthCheck = other.httpHealthCheck; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteHttpHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.httpHealthCheck = source.httpHealthCheck; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHttpHealthCheck() { + return httpHealthCheck; + } + + public Builder setHttpHealthCheck(String httpHealthCheck) { + this.httpHealthCheck = httpHealthCheck; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteHttpHealthCheckHttpRequest build() { + String missing = ""; + + if (httpHealthCheck == null) { + missing += " httpHealthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteHttpHealthCheckHttpRequest( + access_token, + callback, + fields, + httpHealthCheck, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setHttpHealthCheck(this.httpHealthCheck); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteHttpHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "httpHealthCheck=" + + httpHealthCheck + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteHttpHealthCheckHttpRequest) { + DeleteHttpHealthCheckHttpRequest that = (DeleteHttpHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.httpHealthCheck, that.getHttpHealthCheck()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + httpHealthCheck, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteHttpsHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteHttpsHealthCheckHttpRequest.java new file mode 100644 index 000000000000..8152f210254e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteHttpsHealthCheckHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteHttpsHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String httpsHealthCheck; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteHttpsHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.httpsHealthCheck = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteHttpsHealthCheckHttpRequest( + String access_token, + String callback, + String fields, + String httpsHealthCheck, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.httpsHealthCheck = httpsHealthCheck; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("httpsHealthCheck")) { + return httpsHealthCheck; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteHttpsHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteHttpsHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteHttpsHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteHttpsHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String httpsHealthCheck; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteHttpsHealthCheckHttpRequest other) { + if (other == DeleteHttpsHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHttpsHealthCheck() != null) { + this.httpsHealthCheck = other.httpsHealthCheck; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteHttpsHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.httpsHealthCheck = source.httpsHealthCheck; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public Builder setHttpsHealthCheck(String httpsHealthCheck) { + this.httpsHealthCheck = httpsHealthCheck; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteHttpsHealthCheckHttpRequest build() { + String missing = ""; + + if (httpsHealthCheck == null) { + missing += " httpsHealthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteHttpsHealthCheckHttpRequest( + access_token, + callback, + fields, + httpsHealthCheck, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setHttpsHealthCheck(this.httpsHealthCheck); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteHttpsHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "httpsHealthCheck=" + + httpsHealthCheck + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteHttpsHealthCheckHttpRequest) { + DeleteHttpsHealthCheckHttpRequest that = (DeleteHttpsHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.httpsHealthCheck, that.getHttpsHealthCheck()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + httpsHealthCheck, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteImageHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteImageHttpRequest.java new file mode 100644 index 000000000000..c7553ecc3d21 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteImageHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteImageHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String image; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteImageHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.image = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteImageHttpRequest( + String access_token, + String callback, + String fields, + String image, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.image = image; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("image")) { + return image; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getImage() { + return image; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteImageHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteImageHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteImageHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteImageHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String image; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteImageHttpRequest other) { + if (other == DeleteImageHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getImage() != null) { + this.image = other.image; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteImageHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.image = source.image; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getImage() { + return image; + } + + public Builder setImage(String image) { + this.image = image; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteImageHttpRequest build() { + String missing = ""; + + if (image == null) { + missing += " image"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteImageHttpRequest( + access_token, callback, fields, image, key, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setImage(this.image); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteImageHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "image=" + + image + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteImageHttpRequest) { + DeleteImageHttpRequest that = (DeleteImageHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.image, that.getImage()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, image, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceGroupHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceGroupHttpRequest.java new file mode 100644 index 000000000000..7493d25b35fb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceGroupHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteInstanceGroupHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroup; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteInstanceGroupHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroup = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteInstanceGroupHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroup, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroup = instanceGroup; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroup")) { + return instanceGroup; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteInstanceGroupHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteInstanceGroupHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteInstanceGroupHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteInstanceGroupHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroup; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteInstanceGroupHttpRequest other) { + if (other == DeleteInstanceGroupHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroup() != null) { + this.instanceGroup = other.instanceGroup; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteInstanceGroupHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroup = source.instanceGroup; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteInstanceGroupHttpRequest build() { + String missing = ""; + + if (instanceGroup == null) { + missing += " instanceGroup"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteInstanceGroupHttpRequest( + access_token, + callback, + fields, + instanceGroup, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroup(this.instanceGroup); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteInstanceGroupHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroup=" + + instanceGroup + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteInstanceGroupHttpRequest) { + DeleteInstanceGroupHttpRequest that = (DeleteInstanceGroupHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroup, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..45f5f6490909 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceGroupManagerHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteInstanceGroupManagerHttpRequest other) { + if (other == DeleteInstanceGroupManagerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteInstanceGroupManagerHttpRequest) { + DeleteInstanceGroupManagerHttpRequest that = (DeleteInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceHttpRequest.java new file mode 100644 index 000000000000..6f9a6197141f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteInstanceHttpRequest other) { + if (other == DeleteInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteInstanceHttpRequest( + access_token, callback, fields, instance, key, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteInstanceHttpRequest) { + DeleteInstanceHttpRequest that = (DeleteInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, instance, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceTemplateHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceTemplateHttpRequest.java new file mode 100644 index 000000000000..e1220a364c62 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstanceTemplateHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteInstanceTemplateHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceTemplate; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteInstanceTemplateHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceTemplate = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteInstanceTemplateHttpRequest( + String access_token, + String callback, + String fields, + String instanceTemplate, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceTemplate = instanceTemplate; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceTemplate")) { + return instanceTemplate; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteInstanceTemplateHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteInstanceTemplateHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteInstanceTemplateHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteInstanceTemplateHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceTemplate; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteInstanceTemplateHttpRequest other) { + if (other == DeleteInstanceTemplateHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceTemplate() != null) { + this.instanceTemplate = other.instanceTemplate; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteInstanceTemplateHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceTemplate = source.instanceTemplate; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public Builder setInstanceTemplate(String instanceTemplate) { + this.instanceTemplate = instanceTemplate; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteInstanceTemplateHttpRequest build() { + String missing = ""; + + if (instanceTemplate == null) { + missing += " instanceTemplate"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteInstanceTemplateHttpRequest( + access_token, + callback, + fields, + instanceTemplate, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceTemplate(this.instanceTemplate); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteInstanceTemplateHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceTemplate=" + + instanceTemplate + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteInstanceTemplateHttpRequest) { + DeleteInstanceTemplateHttpRequest that = (DeleteInstanceTemplateHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceTemplate, that.getInstanceTemplate()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceTemplate, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstancesInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstancesInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..3f87e1272557 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstancesInstanceGroupManagerHttpRequest.java @@ -0,0 +1,460 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteInstancesInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final InstanceGroupManagersDeleteInstancesRequest + instanceGroupManagersDeleteInstancesRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteInstancesInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.instanceGroupManagersDeleteInstancesRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteInstancesInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + InstanceGroupManagersDeleteInstancesRequest + instanceGroupManagersDeleteInstancesRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.instanceGroupManagersDeleteInstancesRequestResource = + instanceGroupManagersDeleteInstancesRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("instanceGroupManagersDeleteInstancesRequestResource")) { + return instanceGroupManagersDeleteInstancesRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceGroupManagersDeleteInstancesRequest getApiMessageRequestBody() { + return instanceGroupManagersDeleteInstancesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public InstanceGroupManagersDeleteInstancesRequest + getInstanceGroupManagersDeleteInstancesRequestResource() { + return instanceGroupManagersDeleteInstancesRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteInstancesInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteInstancesInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteInstancesInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteInstancesInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private InstanceGroupManagersDeleteInstancesRequest + instanceGroupManagersDeleteInstancesRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteInstancesInstanceGroupManagerHttpRequest other) { + if (other == DeleteInstancesInstanceGroupManagerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getInstanceGroupManagersDeleteInstancesRequestResource() != null) { + this.instanceGroupManagersDeleteInstancesRequestResource = + other.instanceGroupManagersDeleteInstancesRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteInstancesInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.instanceGroupManagersDeleteInstancesRequestResource = + source.instanceGroupManagersDeleteInstancesRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public InstanceGroupManagersDeleteInstancesRequest + getInstanceGroupManagersDeleteInstancesRequestResource() { + return instanceGroupManagersDeleteInstancesRequestResource; + } + + public Builder setInstanceGroupManagersDeleteInstancesRequestResource( + InstanceGroupManagersDeleteInstancesRequest + instanceGroupManagersDeleteInstancesRequestResource) { + this.instanceGroupManagersDeleteInstancesRequestResource = + instanceGroupManagersDeleteInstancesRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteInstancesInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteInstancesInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + instanceGroupManagersDeleteInstancesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setInstanceGroupManagersDeleteInstancesRequestResource( + this.instanceGroupManagersDeleteInstancesRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteInstancesInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "instanceGroupManagersDeleteInstancesRequestResource=" + + instanceGroupManagersDeleteInstancesRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteInstancesInstanceGroupManagerHttpRequest) { + DeleteInstancesInstanceGroupManagerHttpRequest that = + (DeleteInstancesInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals( + this.instanceGroupManagersDeleteInstancesRequestResource, + that.getInstanceGroupManagersDeleteInstancesRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + instanceGroupManagersDeleteInstancesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstancesRegionInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstancesRegionInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..45a0bd96edd6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInstancesRegionInstanceGroupManagerHttpRequest.java @@ -0,0 +1,461 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteInstancesRegionInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final RegionInstanceGroupManagersDeleteInstancesRequest + regionInstanceGroupManagersDeleteInstancesRequestResource; + private final String requestId; + private final String userIp; + + private DeleteInstancesRegionInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.regionInstanceGroupManagersDeleteInstancesRequestResource = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteInstancesRegionInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + String key, + String prettyPrint, + String quotaUser, + RegionInstanceGroupManagersDeleteInstancesRequest + regionInstanceGroupManagersDeleteInstancesRequestResource, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.regionInstanceGroupManagersDeleteInstancesRequestResource = + regionInstanceGroupManagersDeleteInstancesRequestResource; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("regionInstanceGroupManagersDeleteInstancesRequestResource")) { + return regionInstanceGroupManagersDeleteInstancesRequestResource; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public RegionInstanceGroupManagersDeleteInstancesRequest getApiMessageRequestBody() { + return regionInstanceGroupManagersDeleteInstancesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public RegionInstanceGroupManagersDeleteInstancesRequest + getRegionInstanceGroupManagersDeleteInstancesRequestResource() { + return regionInstanceGroupManagersDeleteInstancesRequestResource; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteInstancesRegionInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteInstancesRegionInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteInstancesRegionInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteInstancesRegionInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private String key; + private String prettyPrint; + private String quotaUser; + private RegionInstanceGroupManagersDeleteInstancesRequest + regionInstanceGroupManagersDeleteInstancesRequestResource; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteInstancesRegionInstanceGroupManagerHttpRequest other) { + if (other == DeleteInstancesRegionInstanceGroupManagerHttpRequest.getDefaultInstance()) + return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegionInstanceGroupManagersDeleteInstancesRequestResource() != null) { + this.regionInstanceGroupManagersDeleteInstancesRequestResource = + other.regionInstanceGroupManagersDeleteInstancesRequestResource; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteInstancesRegionInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.regionInstanceGroupManagersDeleteInstancesRequestResource = + source.regionInstanceGroupManagersDeleteInstancesRequestResource; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public RegionInstanceGroupManagersDeleteInstancesRequest + getRegionInstanceGroupManagersDeleteInstancesRequestResource() { + return regionInstanceGroupManagersDeleteInstancesRequestResource; + } + + public Builder setRegionInstanceGroupManagersDeleteInstancesRequestResource( + RegionInstanceGroupManagersDeleteInstancesRequest + regionInstanceGroupManagersDeleteInstancesRequestResource) { + this.regionInstanceGroupManagersDeleteInstancesRequestResource = + regionInstanceGroupManagersDeleteInstancesRequestResource; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteInstancesRegionInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteInstancesRegionInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + regionInstanceGroupManagersDeleteInstancesRequestResource, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegionInstanceGroupManagersDeleteInstancesRequestResource( + this.regionInstanceGroupManagersDeleteInstancesRequestResource); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteInstancesRegionInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "regionInstanceGroupManagersDeleteInstancesRequestResource=" + + regionInstanceGroupManagersDeleteInstancesRequestResource + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteInstancesRegionInstanceGroupManagerHttpRequest) { + DeleteInstancesRegionInstanceGroupManagerHttpRequest that = + (DeleteInstancesRegionInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals( + this.regionInstanceGroupManagersDeleteInstancesRequestResource, + that.getRegionInstanceGroupManagersDeleteInstancesRequestResource()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + regionInstanceGroupManagersDeleteInstancesRequestResource, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInterconnectAttachmentHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInterconnectAttachmentHttpRequest.java new file mode 100644 index 000000000000..21d38965684f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInterconnectAttachmentHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteInterconnectAttachmentHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String interconnectAttachment; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteInterconnectAttachmentHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.interconnectAttachment = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteInterconnectAttachmentHttpRequest( + String access_token, + String callback, + String fields, + String interconnectAttachment, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.interconnectAttachment = interconnectAttachment; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("interconnectAttachment")) { + return interconnectAttachment; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInterconnectAttachment() { + return interconnectAttachment; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteInterconnectAttachmentHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteInterconnectAttachmentHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteInterconnectAttachmentHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteInterconnectAttachmentHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String interconnectAttachment; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteInterconnectAttachmentHttpRequest other) { + if (other == DeleteInterconnectAttachmentHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInterconnectAttachment() != null) { + this.interconnectAttachment = other.interconnectAttachment; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteInterconnectAttachmentHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.interconnectAttachment = source.interconnectAttachment; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInterconnectAttachment() { + return interconnectAttachment; + } + + public Builder setInterconnectAttachment(String interconnectAttachment) { + this.interconnectAttachment = interconnectAttachment; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteInterconnectAttachmentHttpRequest build() { + String missing = ""; + + if (interconnectAttachment == null) { + missing += " interconnectAttachment"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteInterconnectAttachmentHttpRequest( + access_token, + callback, + fields, + interconnectAttachment, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInterconnectAttachment(this.interconnectAttachment); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteInterconnectAttachmentHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "interconnectAttachment=" + + interconnectAttachment + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteInterconnectAttachmentHttpRequest) { + DeleteInterconnectAttachmentHttpRequest that = (DeleteInterconnectAttachmentHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.interconnectAttachment, that.getInterconnectAttachment()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + interconnectAttachment, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInterconnectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInterconnectHttpRequest.java new file mode 100644 index 000000000000..f500dceac067 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteInterconnectHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteInterconnectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String interconnect; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteInterconnectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.interconnect = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteInterconnectHttpRequest( + String access_token, + String callback, + String fields, + String interconnect, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.interconnect = interconnect; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("interconnect")) { + return interconnect; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInterconnect() { + return interconnect; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteInterconnectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteInterconnectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteInterconnectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteInterconnectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String interconnect; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteInterconnectHttpRequest other) { + if (other == DeleteInterconnectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInterconnect() != null) { + this.interconnect = other.interconnect; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteInterconnectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.interconnect = source.interconnect; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInterconnect() { + return interconnect; + } + + public Builder setInterconnect(String interconnect) { + this.interconnect = interconnect; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteInterconnectHttpRequest build() { + String missing = ""; + + if (interconnect == null) { + missing += " interconnect"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteInterconnectHttpRequest( + access_token, + callback, + fields, + interconnect, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInterconnect(this.interconnect); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteInterconnectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "interconnect=" + + interconnect + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteInterconnectHttpRequest) { + DeleteInterconnectHttpRequest that = (DeleteInterconnectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.interconnect, that.getInterconnect()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + interconnect, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteLicenseHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteLicenseHttpRequest.java new file mode 100644 index 000000000000..1b72506cf12b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteLicenseHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteLicenseHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String license; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteLicenseHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.license = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteLicenseHttpRequest( + String access_token, + String callback, + String fields, + String key, + String license, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.license = license; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("license")) { + return license; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getLicense() { + return license; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteLicenseHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteLicenseHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteLicenseHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteLicenseHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String license; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteLicenseHttpRequest other) { + if (other == DeleteLicenseHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getLicense() != null) { + this.license = other.license; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteLicenseHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.license = source.license; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getLicense() { + return license; + } + + public Builder setLicense(String license) { + this.license = license; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteLicenseHttpRequest build() { + String missing = ""; + + if (license == null) { + missing += " license"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteLicenseHttpRequest( + access_token, callback, fields, key, license, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setLicense(this.license); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteLicenseHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "license=" + + license + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteLicenseHttpRequest) { + DeleteLicenseHttpRequest that = (DeleteLicenseHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.license, that.getLicense()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, license, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteNetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteNetworkHttpRequest.java new file mode 100644 index 000000000000..7541e806787a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteNetworkHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteNetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String network; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteNetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.network = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteNetworkHttpRequest( + String access_token, + String callback, + String fields, + String key, + String network, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.network = network; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getNetwork() { + return network; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteNetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteNetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteNetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteNetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String network; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteNetworkHttpRequest other) { + if (other == DeleteNetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteNetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.network = source.network; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteNetworkHttpRequest build() { + String missing = ""; + + if (network == null) { + missing += " network"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteNetworkHttpRequest( + access_token, callback, fields, key, network, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setNetwork(this.network); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteNetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "network=" + + network + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteNetworkHttpRequest) { + DeleteNetworkHttpRequest that = (DeleteNetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, network, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionAutoscalerHttpRequest.java new file mode 100644 index 000000000000..08cc13a54a85 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionAutoscalerHttpRequest.java @@ -0,0 +1,405 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteRegionAutoscalerHttpRequest implements ApiMessage { + private final String access_token; + private final String autoscaler; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteRegionAutoscalerHttpRequest() { + this.access_token = null; + this.autoscaler = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteRegionAutoscalerHttpRequest( + String access_token, + String autoscaler, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.autoscaler = autoscaler; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("autoscaler")) { + return autoscaler; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getAutoscaler() { + return autoscaler; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteRegionAutoscalerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteRegionAutoscalerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteRegionAutoscalerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteRegionAutoscalerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String autoscaler; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteRegionAutoscalerHttpRequest other) { + if (other == DeleteRegionAutoscalerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAutoscaler() != null) { + this.autoscaler = other.autoscaler; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteRegionAutoscalerHttpRequest source) { + this.access_token = source.access_token; + this.autoscaler = source.autoscaler; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Builder setAutoscaler(String autoscaler) { + this.autoscaler = autoscaler; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteRegionAutoscalerHttpRequest build() { + String missing = ""; + + if (autoscaler == null) { + missing += " autoscaler"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteRegionAutoscalerHttpRequest( + access_token, + autoscaler, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAutoscaler(this.autoscaler); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteRegionAutoscalerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "autoscaler=" + + autoscaler + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteRegionAutoscalerHttpRequest) { + DeleteRegionAutoscalerHttpRequest that = (DeleteRegionAutoscalerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.autoscaler, that.getAutoscaler()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, autoscaler, callback, fields, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionBackendServiceHttpRequest.java new file mode 100644 index 000000000000..008d140f7a38 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionBackendServiceHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteRegionBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final String backendService; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteRegionBackendServiceHttpRequest() { + this.access_token = null; + this.backendService = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteRegionBackendServiceHttpRequest( + String access_token, + String backendService, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendService = backendService; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendService")) { + return backendService; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendService() { + return backendService; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteRegionBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteRegionBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteRegionBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteRegionBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendService; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteRegionBackendServiceHttpRequest other) { + if (other == DeleteRegionBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendService() != null) { + this.backendService = other.backendService; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteRegionBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendService = source.backendService; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendService() { + return backendService; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteRegionBackendServiceHttpRequest build() { + String missing = ""; + + if (backendService == null) { + missing += " backendService"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteRegionBackendServiceHttpRequest( + access_token, + backendService, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendService(this.backendService); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteRegionBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendService=" + + backendService + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteRegionBackendServiceHttpRequest) { + DeleteRegionBackendServiceHttpRequest that = (DeleteRegionBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendService, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionDiskHttpRequest.java new file mode 100644 index 000000000000..e7711ba261bf --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionDiskHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteRegionDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String disk; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteRegionDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.disk = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteRegionDiskHttpRequest( + String access_token, + String callback, + String disk, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.disk = disk; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("disk")) { + return disk; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getDisk() { + return disk; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteRegionDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteRegionDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteRegionDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteRegionDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String disk; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteRegionDiskHttpRequest other) { + if (other == DeleteRegionDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDisk() != null) { + this.disk = other.disk; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteRegionDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.disk = source.disk; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDisk() { + return disk; + } + + public Builder setDisk(String disk) { + this.disk = disk; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteRegionDiskHttpRequest build() { + String missing = ""; + + if (disk == null) { + missing += " disk"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteRegionDiskHttpRequest( + access_token, callback, disk, fields, key, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDisk(this.disk); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteRegionDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "disk=" + + disk + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteRegionDiskHttpRequest) { + DeleteRegionDiskHttpRequest that = (DeleteRegionDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.disk, that.getDisk()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, disk, fields, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..e11f8b34363a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionInstanceGroupManagerHttpRequest.java @@ -0,0 +1,414 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteRegionInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeleteRegionInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeleteRegionInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteRegionInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteRegionInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteRegionInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteRegionInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteRegionInstanceGroupManagerHttpRequest other) { + if (other == DeleteRegionInstanceGroupManagerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteRegionInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteRegionInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteRegionInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteRegionInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteRegionInstanceGroupManagerHttpRequest) { + DeleteRegionInstanceGroupManagerHttpRequest that = + (DeleteRegionInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionOperationHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionOperationHttpRequest.java new file mode 100644 index 000000000000..6055704b364e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRegionOperationHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteRegionOperationHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String operation; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private DeleteRegionOperationHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.operation = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private DeleteRegionOperationHttpRequest( + String access_token, + String callback, + String fields, + String key, + String operation, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.operation = operation; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("operation")) { + return operation; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getOperation() { + return operation; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteRegionOperationHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteRegionOperationHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteRegionOperationHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteRegionOperationHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String operation; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteRegionOperationHttpRequest other) { + if (other == DeleteRegionOperationHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getOperation() != null) { + this.operation = other.operation; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteRegionOperationHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.operation = source.operation; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getOperation() { + return operation; + } + + public Builder setOperation(String operation) { + this.operation = operation; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteRegionOperationHttpRequest build() { + String missing = ""; + + if (operation == null) { + missing += " operation"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteRegionOperationHttpRequest( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setOperation(this.operation); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteRegionOperationHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "operation=" + + operation + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteRegionOperationHttpRequest) { + DeleteRegionOperationHttpRequest that = (DeleteRegionOperationHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.operation, that.getOperation()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRouteHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRouteHttpRequest.java new file mode 100644 index 000000000000..386c7b765e77 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRouteHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteRouteHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String route; + private final String userIp; + + private DeleteRouteHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.route = null; + this.userIp = null; + } + + private DeleteRouteHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String route, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.route = route; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("route")) { + return route; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getRoute() { + return route; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteRouteHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteRouteHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteRouteHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteRouteHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String route; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteRouteHttpRequest other) { + if (other == DeleteRouteHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getRoute() != null) { + this.route = other.route; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteRouteHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.route = source.route; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getRoute() { + return route; + } + + public Builder setRoute(String route) { + this.route = route; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteRouteHttpRequest build() { + String missing = ""; + + if (route == null) { + missing += " route"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteRouteHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, route, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setRoute(this.route); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteRouteHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "route=" + + route + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteRouteHttpRequest) { + DeleteRouteHttpRequest that = (DeleteRouteHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.route, that.getRoute()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, route, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRouterHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRouterHttpRequest.java new file mode 100644 index 000000000000..5bd48ef27f22 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteRouterHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteRouterHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String router; + private final String userIp; + + private DeleteRouterHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.router = null; + this.userIp = null; + } + + private DeleteRouterHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String router, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.router = router; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("router")) { + return router; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getRouter() { + return router; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteRouterHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteRouterHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteRouterHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteRouterHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String router; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteRouterHttpRequest other) { + if (other == DeleteRouterHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getRouter() != null) { + this.router = other.router; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteRouterHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.router = source.router; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getRouter() { + return router; + } + + public Builder setRouter(String router) { + this.router = router; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteRouterHttpRequest build() { + String missing = ""; + + if (router == null) { + missing += " router"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteRouterHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, router, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setRouter(this.router); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteRouterHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "router=" + + router + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteRouterHttpRequest) { + DeleteRouterHttpRequest that = (DeleteRouterHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.router, that.getRouter()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, router, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSnapshotHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSnapshotHttpRequest.java new file mode 100644 index 000000000000..bd2cc210d568 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSnapshotHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteSnapshotHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String snapshot; + private final String userIp; + + private DeleteSnapshotHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.snapshot = null; + this.userIp = null; + } + + private DeleteSnapshotHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String snapshot, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.snapshot = snapshot; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("snapshot")) { + return snapshot; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getSnapshot() { + return snapshot; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteSnapshotHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteSnapshotHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteSnapshotHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteSnapshotHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String snapshot; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteSnapshotHttpRequest other) { + if (other == DeleteSnapshotHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSnapshot() != null) { + this.snapshot = other.snapshot; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteSnapshotHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.snapshot = source.snapshot; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getSnapshot() { + return snapshot; + } + + public Builder setSnapshot(String snapshot) { + this.snapshot = snapshot; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteSnapshotHttpRequest build() { + String missing = ""; + + if (snapshot == null) { + missing += " snapshot"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteSnapshotHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, snapshot, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSnapshot(this.snapshot); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteSnapshotHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "snapshot=" + + snapshot + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteSnapshotHttpRequest) { + DeleteSnapshotHttpRequest that = (DeleteSnapshotHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.snapshot, that.getSnapshot()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, snapshot, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSslCertificateHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSslCertificateHttpRequest.java new file mode 100644 index 000000000000..d73bc6c2785a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSslCertificateHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteSslCertificateHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String sslCertificate; + private final String userIp; + + private DeleteSslCertificateHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.sslCertificate = null; + this.userIp = null; + } + + private DeleteSslCertificateHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String sslCertificate, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.sslCertificate = sslCertificate; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("sslCertificate")) { + return sslCertificate; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getSslCertificate() { + return sslCertificate; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteSslCertificateHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteSslCertificateHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteSslCertificateHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteSslCertificateHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String sslCertificate; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteSslCertificateHttpRequest other) { + if (other == DeleteSslCertificateHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSslCertificate() != null) { + this.sslCertificate = other.sslCertificate; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteSslCertificateHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.sslCertificate = source.sslCertificate; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getSslCertificate() { + return sslCertificate; + } + + public Builder setSslCertificate(String sslCertificate) { + this.sslCertificate = sslCertificate; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteSslCertificateHttpRequest build() { + String missing = ""; + + if (sslCertificate == null) { + missing += " sslCertificate"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteSslCertificateHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + sslCertificate, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSslCertificate(this.sslCertificate); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteSslCertificateHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "sslCertificate=" + + sslCertificate + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteSslCertificateHttpRequest) { + DeleteSslCertificateHttpRequest that = (DeleteSslCertificateHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.sslCertificate, that.getSslCertificate()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + sslCertificate, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSslPolicyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSslPolicyHttpRequest.java new file mode 100644 index 000000000000..270a2dd6834e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSslPolicyHttpRequest.java @@ -0,0 +1,405 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteSslPolicyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String sslPolicy; + private final String userIp; + + private DeleteSslPolicyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.sslPolicy = null; + this.userIp = null; + } + + private DeleteSslPolicyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String sslPolicy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.sslPolicy = sslPolicy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("sslPolicy")) { + return sslPolicy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteSslPolicyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteSslPolicyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteSslPolicyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteSslPolicyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String sslPolicy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteSslPolicyHttpRequest other) { + if (other == DeleteSslPolicyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSslPolicy() != null) { + this.sslPolicy = other.sslPolicy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteSslPolicyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.sslPolicy = source.sslPolicy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public Builder setSslPolicy(String sslPolicy) { + this.sslPolicy = sslPolicy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteSslPolicyHttpRequest build() { + String missing = ""; + + if (sslPolicy == null) { + missing += " sslPolicy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteSslPolicyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + sslPolicy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSslPolicy(this.sslPolicy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteSslPolicyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "sslPolicy=" + + sslPolicy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteSslPolicyHttpRequest) { + DeleteSslPolicyHttpRequest that = (DeleteSslPolicyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.sslPolicy, that.getSslPolicy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, sslPolicy, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSubnetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSubnetworkHttpRequest.java new file mode 100644 index 000000000000..4270d7f84e8c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteSubnetworkHttpRequest.java @@ -0,0 +1,405 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteSubnetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String subnetwork; + private final String userIp; + + private DeleteSubnetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.subnetwork = null; + this.userIp = null; + } + + private DeleteSubnetworkHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String subnetwork, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.subnetwork = subnetwork; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("subnetwork")) { + return subnetwork; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getSubnetwork() { + return subnetwork; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteSubnetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteSubnetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteSubnetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteSubnetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String subnetwork; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteSubnetworkHttpRequest other) { + if (other == DeleteSubnetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSubnetwork() != null) { + this.subnetwork = other.subnetwork; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteSubnetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.subnetwork = source.subnetwork; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getSubnetwork() { + return subnetwork; + } + + public Builder setSubnetwork(String subnetwork) { + this.subnetwork = subnetwork; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteSubnetworkHttpRequest build() { + String missing = ""; + + if (subnetwork == null) { + missing += " subnetwork"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteSubnetworkHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + subnetwork, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSubnetwork(this.subnetwork); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteSubnetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "subnetwork=" + + subnetwork + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteSubnetworkHttpRequest) { + DeleteSubnetworkHttpRequest that = (DeleteSubnetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.subnetwork, that.getSubnetwork()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, subnetwork, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetHttpProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetHttpProxyHttpRequest.java new file mode 100644 index 000000000000..6b2928c2b241 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetHttpProxyHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteTargetHttpProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetHttpProxy; + private final String userIp; + + private DeleteTargetHttpProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetHttpProxy = null; + this.userIp = null; + } + + private DeleteTargetHttpProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetHttpProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetHttpProxy = targetHttpProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetHttpProxy")) { + return targetHttpProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetHttpProxy() { + return targetHttpProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteTargetHttpProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteTargetHttpProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteTargetHttpProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteTargetHttpProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetHttpProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteTargetHttpProxyHttpRequest other) { + if (other == DeleteTargetHttpProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetHttpProxy() != null) { + this.targetHttpProxy = other.targetHttpProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteTargetHttpProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetHttpProxy = source.targetHttpProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetHttpProxy() { + return targetHttpProxy; + } + + public Builder setTargetHttpProxy(String targetHttpProxy) { + this.targetHttpProxy = targetHttpProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteTargetHttpProxyHttpRequest build() { + String missing = ""; + + if (targetHttpProxy == null) { + missing += " targetHttpProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteTargetHttpProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetHttpProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetHttpProxy(this.targetHttpProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteTargetHttpProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetHttpProxy=" + + targetHttpProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteTargetHttpProxyHttpRequest) { + DeleteTargetHttpProxyHttpRequest that = (DeleteTargetHttpProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetHttpProxy, that.getTargetHttpProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetHttpProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetHttpsProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetHttpsProxyHttpRequest.java new file mode 100644 index 000000000000..27f496359c10 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetHttpsProxyHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteTargetHttpsProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetHttpsProxy; + private final String userIp; + + private DeleteTargetHttpsProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetHttpsProxy = null; + this.userIp = null; + } + + private DeleteTargetHttpsProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetHttpsProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetHttpsProxy = targetHttpsProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetHttpsProxy")) { + return targetHttpsProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteTargetHttpsProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteTargetHttpsProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteTargetHttpsProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteTargetHttpsProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetHttpsProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteTargetHttpsProxyHttpRequest other) { + if (other == DeleteTargetHttpsProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetHttpsProxy() != null) { + this.targetHttpsProxy = other.targetHttpsProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteTargetHttpsProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetHttpsProxy = source.targetHttpsProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public Builder setTargetHttpsProxy(String targetHttpsProxy) { + this.targetHttpsProxy = targetHttpsProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteTargetHttpsProxyHttpRequest build() { + String missing = ""; + + if (targetHttpsProxy == null) { + missing += " targetHttpsProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteTargetHttpsProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetHttpsProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetHttpsProxy(this.targetHttpsProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteTargetHttpsProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetHttpsProxy=" + + targetHttpsProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteTargetHttpsProxyHttpRequest) { + DeleteTargetHttpsProxyHttpRequest that = (DeleteTargetHttpsProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetHttpsProxy, that.getTargetHttpsProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetHttpsProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetInstanceHttpRequest.java new file mode 100644 index 000000000000..7c0999908eec --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetInstanceHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteTargetInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetInstance; + private final String userIp; + + private DeleteTargetInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetInstance = null; + this.userIp = null; + } + + private DeleteTargetInstanceHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetInstance, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetInstance = targetInstance; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetInstance")) { + return targetInstance; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetInstance() { + return targetInstance; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteTargetInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteTargetInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteTargetInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteTargetInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetInstance; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteTargetInstanceHttpRequest other) { + if (other == DeleteTargetInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetInstance() != null) { + this.targetInstance = other.targetInstance; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteTargetInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetInstance = source.targetInstance; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetInstance() { + return targetInstance; + } + + public Builder setTargetInstance(String targetInstance) { + this.targetInstance = targetInstance; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteTargetInstanceHttpRequest build() { + String missing = ""; + + if (targetInstance == null) { + missing += " targetInstance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteTargetInstanceHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetInstance, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetInstance(this.targetInstance); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteTargetInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetInstance=" + + targetInstance + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteTargetInstanceHttpRequest) { + DeleteTargetInstanceHttpRequest that = (DeleteTargetInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetInstance, that.getTargetInstance()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetInstance, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetPoolHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetPoolHttpRequest.java new file mode 100644 index 000000000000..aca94b513e81 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetPoolHttpRequest.java @@ -0,0 +1,405 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteTargetPoolHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetPool; + private final String userIp; + + private DeleteTargetPoolHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetPool = null; + this.userIp = null; + } + + private DeleteTargetPoolHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetPool, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetPool = targetPool; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetPool")) { + return targetPool; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetPool() { + return targetPool; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteTargetPoolHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteTargetPoolHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteTargetPoolHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteTargetPoolHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetPool; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteTargetPoolHttpRequest other) { + if (other == DeleteTargetPoolHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetPool() != null) { + this.targetPool = other.targetPool; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteTargetPoolHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetPool = source.targetPool; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetPool() { + return targetPool; + } + + public Builder setTargetPool(String targetPool) { + this.targetPool = targetPool; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteTargetPoolHttpRequest build() { + String missing = ""; + + if (targetPool == null) { + missing += " targetPool"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteTargetPoolHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetPool, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetPool(this.targetPool); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteTargetPoolHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetPool=" + + targetPool + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteTargetPoolHttpRequest) { + DeleteTargetPoolHttpRequest that = (DeleteTargetPoolHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetPool, that.getTargetPool()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, targetPool, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetSslProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetSslProxyHttpRequest.java new file mode 100644 index 000000000000..645f7b594a81 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetSslProxyHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteTargetSslProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetSslProxy; + private final String userIp; + + private DeleteTargetSslProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetSslProxy = null; + this.userIp = null; + } + + private DeleteTargetSslProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetSslProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetSslProxy = targetSslProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetSslProxy")) { + return targetSslProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteTargetSslProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteTargetSslProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteTargetSslProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteTargetSslProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetSslProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteTargetSslProxyHttpRequest other) { + if (other == DeleteTargetSslProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetSslProxy() != null) { + this.targetSslProxy = other.targetSslProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteTargetSslProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetSslProxy = source.targetSslProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public Builder setTargetSslProxy(String targetSslProxy) { + this.targetSslProxy = targetSslProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteTargetSslProxyHttpRequest build() { + String missing = ""; + + if (targetSslProxy == null) { + missing += " targetSslProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteTargetSslProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetSslProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetSslProxy(this.targetSslProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteTargetSslProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetSslProxy=" + + targetSslProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteTargetSslProxyHttpRequest) { + DeleteTargetSslProxyHttpRequest that = (DeleteTargetSslProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetSslProxy, that.getTargetSslProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetSslProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetTcpProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetTcpProxyHttpRequest.java new file mode 100644 index 000000000000..76e48333d234 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetTcpProxyHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteTargetTcpProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetTcpProxy; + private final String userIp; + + private DeleteTargetTcpProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetTcpProxy = null; + this.userIp = null; + } + + private DeleteTargetTcpProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetTcpProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetTcpProxy = targetTcpProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetTcpProxy")) { + return targetTcpProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetTcpProxy() { + return targetTcpProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteTargetTcpProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteTargetTcpProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteTargetTcpProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteTargetTcpProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetTcpProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteTargetTcpProxyHttpRequest other) { + if (other == DeleteTargetTcpProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetTcpProxy() != null) { + this.targetTcpProxy = other.targetTcpProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteTargetTcpProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetTcpProxy = source.targetTcpProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetTcpProxy() { + return targetTcpProxy; + } + + public Builder setTargetTcpProxy(String targetTcpProxy) { + this.targetTcpProxy = targetTcpProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteTargetTcpProxyHttpRequest build() { + String missing = ""; + + if (targetTcpProxy == null) { + missing += " targetTcpProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteTargetTcpProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetTcpProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetTcpProxy(this.targetTcpProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteTargetTcpProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetTcpProxy=" + + targetTcpProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteTargetTcpProxyHttpRequest) { + DeleteTargetTcpProxyHttpRequest that = (DeleteTargetTcpProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetTcpProxy, that.getTargetTcpProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetTcpProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetVpnGatewayHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetVpnGatewayHttpRequest.java new file mode 100644 index 000000000000..bba660371155 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteTargetVpnGatewayHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteTargetVpnGatewayHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetVpnGateway; + private final String userIp; + + private DeleteTargetVpnGatewayHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetVpnGateway = null; + this.userIp = null; + } + + private DeleteTargetVpnGatewayHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetVpnGateway, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetVpnGateway = targetVpnGateway; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetVpnGateway")) { + return targetVpnGateway; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetVpnGateway() { + return targetVpnGateway; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteTargetVpnGatewayHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteTargetVpnGatewayHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteTargetVpnGatewayHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteTargetVpnGatewayHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetVpnGateway; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteTargetVpnGatewayHttpRequest other) { + if (other == DeleteTargetVpnGatewayHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetVpnGateway() != null) { + this.targetVpnGateway = other.targetVpnGateway; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteTargetVpnGatewayHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetVpnGateway = source.targetVpnGateway; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetVpnGateway() { + return targetVpnGateway; + } + + public Builder setTargetVpnGateway(String targetVpnGateway) { + this.targetVpnGateway = targetVpnGateway; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteTargetVpnGatewayHttpRequest build() { + String missing = ""; + + if (targetVpnGateway == null) { + missing += " targetVpnGateway"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteTargetVpnGatewayHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetVpnGateway, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetVpnGateway(this.targetVpnGateway); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteTargetVpnGatewayHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetVpnGateway=" + + targetVpnGateway + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteTargetVpnGatewayHttpRequest) { + DeleteTargetVpnGatewayHttpRequest that = (DeleteTargetVpnGatewayHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetVpnGateway, that.getTargetVpnGateway()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetVpnGateway, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteUrlMapHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteUrlMapHttpRequest.java new file mode 100644 index 000000000000..e4be6526e378 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteUrlMapHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteUrlMapHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String urlMap; + private final String userIp; + + private DeleteUrlMapHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.urlMap = null; + this.userIp = null; + } + + private DeleteUrlMapHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String urlMap, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.urlMap = urlMap; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("urlMap")) { + return urlMap; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUrlMap() { + return urlMap; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteUrlMapHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteUrlMapHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteUrlMapHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteUrlMapHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String urlMap; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteUrlMapHttpRequest other) { + if (other == DeleteUrlMapHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUrlMap() != null) { + this.urlMap = other.urlMap; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteUrlMapHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.urlMap = source.urlMap; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUrlMap() { + return urlMap; + } + + public Builder setUrlMap(String urlMap) { + this.urlMap = urlMap; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteUrlMapHttpRequest build() { + String missing = ""; + + if (urlMap == null) { + missing += " urlMap"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteUrlMapHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, urlMap, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUrlMap(this.urlMap); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteUrlMapHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "urlMap=" + + urlMap + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteUrlMapHttpRequest) { + DeleteUrlMapHttpRequest that = (DeleteUrlMapHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.urlMap, that.getUrlMap()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, urlMap, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteVpnTunnelHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteVpnTunnelHttpRequest.java new file mode 100644 index 000000000000..f886123d795a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteVpnTunnelHttpRequest.java @@ -0,0 +1,404 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteVpnTunnelHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + private final String vpnTunnel; + + private DeleteVpnTunnelHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + this.vpnTunnel = null; + } + + private DeleteVpnTunnelHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp, + String vpnTunnel) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + this.vpnTunnel = vpnTunnel; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("vpnTunnel")) { + return vpnTunnel; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public String getVpnTunnel() { + return vpnTunnel; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteVpnTunnelHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteVpnTunnelHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteVpnTunnelHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteVpnTunnelHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + private String vpnTunnel; + + Builder() {} + + public Builder mergeFrom(DeleteVpnTunnelHttpRequest other) { + if (other == DeleteVpnTunnelHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getVpnTunnel() != null) { + this.vpnTunnel = other.vpnTunnel; + } + return this; + } + + Builder(DeleteVpnTunnelHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + this.vpnTunnel = source.vpnTunnel; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getVpnTunnel() { + return vpnTunnel; + } + + public Builder setVpnTunnel(String vpnTunnel) { + this.vpnTunnel = vpnTunnel; + return this; + } + + public DeleteVpnTunnelHttpRequest build() { + String missing = ""; + + if (vpnTunnel == null) { + missing += " vpnTunnel"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteVpnTunnelHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp, + vpnTunnel); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + newBuilder.setVpnTunnel(this.vpnTunnel); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteVpnTunnelHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + ", " + + "vpnTunnel=" + + vpnTunnel + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteVpnTunnelHttpRequest) { + DeleteVpnTunnelHttpRequest that = (DeleteVpnTunnelHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.vpnTunnel, that.getVpnTunnel()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, requestId, userIp, vpnTunnel); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteZoneOperationHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteZoneOperationHttpRequest.java new file mode 100644 index 000000000000..40ddc56cdec5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeleteZoneOperationHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeleteZoneOperationHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String operation; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private DeleteZoneOperationHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.operation = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private DeleteZoneOperationHttpRequest( + String access_token, + String callback, + String fields, + String key, + String operation, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.operation = operation; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("operation")) { + return operation; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getOperation() { + return operation; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeleteZoneOperationHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeleteZoneOperationHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeleteZoneOperationHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeleteZoneOperationHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String operation; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeleteZoneOperationHttpRequest other) { + if (other == DeleteZoneOperationHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getOperation() != null) { + this.operation = other.operation; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeleteZoneOperationHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.operation = source.operation; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getOperation() { + return operation; + } + + public Builder setOperation(String operation) { + this.operation = operation; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeleteZoneOperationHttpRequest build() { + String missing = ""; + + if (operation == null) { + missing += " operation"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeleteZoneOperationHttpRequest( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setOperation(this.operation); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeleteZoneOperationHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "operation=" + + operation + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeleteZoneOperationHttpRequest) { + DeleteZoneOperationHttpRequest that = (DeleteZoneOperationHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.operation, that.getOperation()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Denied.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Denied.java new file mode 100644 index 000000000000..e841066a4447 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Denied.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Denied implements ApiMessage { + private final String iPProtocol; + private final List ports; + + private Denied() { + this.iPProtocol = null; + this.ports = null; + } + + private Denied(String iPProtocol, List ports) { + this.iPProtocol = iPProtocol; + this.ports = ports; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("iPProtocol")) { + return iPProtocol; + } + if (fieldName.equals("ports")) { + return ports; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getIPProtocol() { + return iPProtocol; + } + + public List getPortsList() { + return ports; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Denied prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Denied getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Denied DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Denied(); + } + + public static class Builder { + private String iPProtocol; + private List ports; + + Builder() {} + + public Builder mergeFrom(Denied other) { + if (other == Denied.getDefaultInstance()) return this; + if (other.getIPProtocol() != null) { + this.iPProtocol = other.iPProtocol; + } + if (other.getPortsList() != null) { + this.ports = other.ports; + } + return this; + } + + Builder(Denied source) { + this.iPProtocol = source.iPProtocol; + this.ports = source.ports; + } + + public String getIPProtocol() { + return iPProtocol; + } + + public Builder setIPProtocol(String iPProtocol) { + this.iPProtocol = iPProtocol; + return this; + } + + public List getPortsList() { + return ports; + } + + public Builder addAllPorts(List ports) { + if (this.ports == null) { + this.ports = new ArrayList<>(ports.size()); + } + this.ports.addAll(ports); + return this; + } + + public Builder addPorts(String ports) { + this.ports.add(ports); + return this; + } + + public Denied build() { + + return new Denied(iPProtocol, ports); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setIPProtocol(this.iPProtocol); + newBuilder.addAllPorts(this.ports); + return newBuilder; + } + } + + @Override + public String toString() { + return "Denied{" + "iPProtocol=" + iPProtocol + ", " + "ports=" + ports + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Denied) { + Denied that = (Denied) o; + return Objects.equals(this.iPProtocol, that.getIPProtocol()) + && Objects.equals(this.ports, that.getPortsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(iPProtocol, ports); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeprecateImageHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeprecateImageHttpRequest.java new file mode 100644 index 000000000000..fd9fbc338322 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeprecateImageHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeprecateImageHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final DeprecationStatus deprecationStatusResource; + private final String fields; + private final String image; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DeprecateImageHttpRequest() { + this.access_token = null; + this.callback = null; + this.deprecationStatusResource = null; + this.fields = null; + this.image = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DeprecateImageHttpRequest( + String access_token, + String callback, + DeprecationStatus deprecationStatusResource, + String fields, + String image, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.deprecationStatusResource = deprecationStatusResource; + this.fields = fields; + this.image = image; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("deprecationStatusResource")) { + return deprecationStatusResource; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("image")) { + return image; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public DeprecationStatus getApiMessageRequestBody() { + return deprecationStatusResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public DeprecationStatus getDeprecationStatusResource() { + return deprecationStatusResource; + } + + public String getFields() { + return fields; + } + + public String getImage() { + return image; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeprecateImageHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeprecateImageHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeprecateImageHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeprecateImageHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private DeprecationStatus deprecationStatusResource; + private String fields; + private String image; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DeprecateImageHttpRequest other) { + if (other == DeprecateImageHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDeprecationStatusResource() != null) { + this.deprecationStatusResource = other.deprecationStatusResource; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getImage() != null) { + this.image = other.image; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DeprecateImageHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.deprecationStatusResource = source.deprecationStatusResource; + this.fields = source.fields; + this.image = source.image; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public DeprecationStatus getDeprecationStatusResource() { + return deprecationStatusResource; + } + + public Builder setDeprecationStatusResource(DeprecationStatus deprecationStatusResource) { + this.deprecationStatusResource = deprecationStatusResource; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getImage() { + return image; + } + + public Builder setImage(String image) { + this.image = image; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DeprecateImageHttpRequest build() { + String missing = ""; + + if (image == null) { + missing += " image"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DeprecateImageHttpRequest( + access_token, + callback, + deprecationStatusResource, + fields, + image, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDeprecationStatusResource(this.deprecationStatusResource); + newBuilder.setFields(this.fields); + newBuilder.setImage(this.image); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeprecateImageHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "deprecationStatusResource=" + + deprecationStatusResource + + ", " + + "fields=" + + fields + + ", " + + "image=" + + image + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeprecateImageHttpRequest) { + DeprecateImageHttpRequest that = (DeprecateImageHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.deprecationStatusResource, that.getDeprecationStatusResource()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.image, that.getImage()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + deprecationStatusResource, + fields, + image, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeprecationStatus.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeprecationStatus.java new file mode 100644 index 000000000000..c0022caa6ff8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DeprecationStatus.java @@ -0,0 +1,263 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DeprecationStatus implements ApiMessage { + private final String deleted; + private final String deprecated; + private final String obsolete; + private final String replacement; + private final String state; + + private DeprecationStatus() { + this.deleted = null; + this.deprecated = null; + this.obsolete = null; + this.replacement = null; + this.state = null; + } + + private DeprecationStatus( + String deleted, String deprecated, String obsolete, String replacement, String state) { + this.deleted = deleted; + this.deprecated = deprecated; + this.obsolete = obsolete; + this.replacement = replacement; + this.state = state; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("deleted")) { + return deleted; + } + if (fieldName.equals("deprecated")) { + return deprecated; + } + if (fieldName.equals("obsolete")) { + return obsolete; + } + if (fieldName.equals("replacement")) { + return replacement; + } + if (fieldName.equals("state")) { + return state; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getDeleted() { + return deleted; + } + + public String getDeprecated() { + return deprecated; + } + + public String getObsolete() { + return obsolete; + } + + public String getReplacement() { + return replacement; + } + + public String getState() { + return state; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DeprecationStatus prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DeprecationStatus getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DeprecationStatus DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DeprecationStatus(); + } + + public static class Builder { + private String deleted; + private String deprecated; + private String obsolete; + private String replacement; + private String state; + + Builder() {} + + public Builder mergeFrom(DeprecationStatus other) { + if (other == DeprecationStatus.getDefaultInstance()) return this; + if (other.getDeleted() != null) { + this.deleted = other.deleted; + } + if (other.getDeprecated() != null) { + this.deprecated = other.deprecated; + } + if (other.getObsolete() != null) { + this.obsolete = other.obsolete; + } + if (other.getReplacement() != null) { + this.replacement = other.replacement; + } + if (other.getState() != null) { + this.state = other.state; + } + return this; + } + + Builder(DeprecationStatus source) { + this.deleted = source.deleted; + this.deprecated = source.deprecated; + this.obsolete = source.obsolete; + this.replacement = source.replacement; + this.state = source.state; + } + + public String getDeleted() { + return deleted; + } + + public Builder setDeleted(String deleted) { + this.deleted = deleted; + return this; + } + + public String getDeprecated() { + return deprecated; + } + + public Builder setDeprecated(String deprecated) { + this.deprecated = deprecated; + return this; + } + + public String getObsolete() { + return obsolete; + } + + public Builder setObsolete(String obsolete) { + this.obsolete = obsolete; + return this; + } + + public String getReplacement() { + return replacement; + } + + public Builder setReplacement(String replacement) { + this.replacement = replacement; + return this; + } + + public String getState() { + return state; + } + + public Builder setState(String state) { + this.state = state; + return this; + } + + public DeprecationStatus build() { + + return new DeprecationStatus(deleted, deprecated, obsolete, replacement, state); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDeleted(this.deleted); + newBuilder.setDeprecated(this.deprecated); + newBuilder.setObsolete(this.obsolete); + newBuilder.setReplacement(this.replacement); + newBuilder.setState(this.state); + return newBuilder; + } + } + + @Override + public String toString() { + return "DeprecationStatus{" + + "deleted=" + + deleted + + ", " + + "deprecated=" + + deprecated + + ", " + + "obsolete=" + + obsolete + + ", " + + "replacement=" + + replacement + + ", " + + "state=" + + state + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DeprecationStatus) { + DeprecationStatus that = (DeprecationStatus) o; + return Objects.equals(this.deleted, that.getDeleted()) + && Objects.equals(this.deprecated, that.getDeprecated()) + && Objects.equals(this.obsolete, that.getObsolete()) + && Objects.equals(this.replacement, that.getReplacement()) + && Objects.equals(this.state, that.getState()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(deleted, deprecated, obsolete, replacement, state); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DetachDiskInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DetachDiskInstanceHttpRequest.java new file mode 100644 index 000000000000..e93c3ac9809f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DetachDiskInstanceHttpRequest.java @@ -0,0 +1,449 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DetachDiskInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String deviceName; + private final String fields; + private final String instance; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DetachDiskInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.deviceName = null; + this.fields = null; + this.instance = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DetachDiskInstanceHttpRequest( + String access_token, + String callback, + String deviceName, + String fields, + String instance, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.deviceName = deviceName; + this.fields = fields; + this.instance = instance; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("deviceName")) { + return deviceName; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getDeviceName() { + return deviceName; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DetachDiskInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DetachDiskInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DetachDiskInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DetachDiskInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String deviceName; + private String fields; + private String instance; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DetachDiskInstanceHttpRequest other) { + if (other == DetachDiskInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDeviceName() != null) { + this.deviceName = other.deviceName; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DetachDiskInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.deviceName = source.deviceName; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDeviceName() { + return deviceName; + } + + public Builder setDeviceName(String deviceName) { + this.deviceName = deviceName; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DetachDiskInstanceHttpRequest build() { + String missing = ""; + + if (deviceName == null) { + missing += " deviceName"; + } + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DetachDiskInstanceHttpRequest( + access_token, + callback, + deviceName, + fields, + instance, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDeviceName(this.deviceName); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DetachDiskInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "deviceName=" + + deviceName + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DetachDiskInstanceHttpRequest) { + DetachDiskInstanceHttpRequest that = (DetachDiskInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.deviceName, that.getDeviceName()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + deviceName, + fields, + instance, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisableXpnHostProjectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisableXpnHostProjectHttpRequest.java new file mode 100644 index 000000000000..e99584fb3776 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisableXpnHostProjectHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DisableXpnHostProjectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DisableXpnHostProjectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DisableXpnHostProjectHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DisableXpnHostProjectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DisableXpnHostProjectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DisableXpnHostProjectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DisableXpnHostProjectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DisableXpnHostProjectHttpRequest other) { + if (other == DisableXpnHostProjectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DisableXpnHostProjectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DisableXpnHostProjectHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DisableXpnHostProjectHttpRequest( + access_token, callback, fields, key, prettyPrint, project, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DisableXpnHostProjectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DisableXpnHostProjectHttpRequest) { + DisableXpnHostProjectHttpRequest that = (DisableXpnHostProjectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, project, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisableXpnResourceProjectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisableXpnResourceProjectHttpRequest.java new file mode 100644 index 000000000000..8338ca7c7a40 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisableXpnResourceProjectHttpRequest.java @@ -0,0 +1,451 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DisableXpnResourceProjectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private DisableXpnResourceProjectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.projectsDisableXpnResourceRequestResource = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private DisableXpnResourceProjectHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.projectsDisableXpnResourceRequestResource = projectsDisableXpnResourceRequestResource; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("projectsDisableXpnResourceRequestResource")) { + return projectsDisableXpnResourceRequestResource; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ProjectsDisableXpnResourceRequest getApiMessageRequestBody() { + return projectsDisableXpnResourceRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public ProjectsDisableXpnResourceRequest getProjectsDisableXpnResourceRequestResource() { + return projectsDisableXpnResourceRequestResource; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DisableXpnResourceProjectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DisableXpnResourceProjectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DisableXpnResourceProjectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DisableXpnResourceProjectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(DisableXpnResourceProjectHttpRequest other) { + if (other == DisableXpnResourceProjectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getProjectsDisableXpnResourceRequestResource() != null) { + this.projectsDisableXpnResourceRequestResource = + other.projectsDisableXpnResourceRequestResource; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(DisableXpnResourceProjectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.projectsDisableXpnResourceRequestResource = + source.projectsDisableXpnResourceRequestResource; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public ProjectsDisableXpnResourceRequest getProjectsDisableXpnResourceRequestResource() { + return projectsDisableXpnResourceRequestResource; + } + + public Builder setProjectsDisableXpnResourceRequestResource( + ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource) { + this.projectsDisableXpnResourceRequestResource = projectsDisableXpnResourceRequestResource; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public DisableXpnResourceProjectHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new DisableXpnResourceProjectHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + project, + projectsDisableXpnResourceRequestResource, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setProjectsDisableXpnResourceRequestResource( + this.projectsDisableXpnResourceRequestResource); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "DisableXpnResourceProjectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "projectsDisableXpnResourceRequestResource=" + + projectsDisableXpnResourceRequestResource + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DisableXpnResourceProjectHttpRequest) { + DisableXpnResourceProjectHttpRequest that = (DisableXpnResourceProjectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals( + this.projectsDisableXpnResourceRequestResource, + that.getProjectsDisableXpnResourceRequestResource()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + project, + projectsDisableXpnResourceRequestResource, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Disk.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Disk.java new file mode 100644 index 000000000000..17230df6b038 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Disk.java @@ -0,0 +1,1056 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Disk implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final CustomerEncryptionKey diskEncryptionKey; + private final List guestOsFeatures; + private final String id; + private final String kind; + private final String labelFingerprint; + private final Map labels; + private final String lastAttachTimestamp; + private final String lastDetachTimestamp; + private final List licenseCodes; + private final List licenses; + private final String name; + private final String options; + private final String region; + private final List replicaZones; + private final String selfLink; + private final String sizeGb; + private final String sourceImage; + private final CustomerEncryptionKey sourceImageEncryptionKey; + private final String sourceImageId; + private final String sourceSnapshot; + private final CustomerEncryptionKey sourceSnapshotEncryptionKey; + private final String sourceSnapshotId; + private final String status; + private final String type; + private final List users; + private final String zone; + + private Disk() { + this.creationTimestamp = null; + this.description = null; + this.diskEncryptionKey = null; + this.guestOsFeatures = null; + this.id = null; + this.kind = null; + this.labelFingerprint = null; + this.labels = null; + this.lastAttachTimestamp = null; + this.lastDetachTimestamp = null; + this.licenseCodes = null; + this.licenses = null; + this.name = null; + this.options = null; + this.region = null; + this.replicaZones = null; + this.selfLink = null; + this.sizeGb = null; + this.sourceImage = null; + this.sourceImageEncryptionKey = null; + this.sourceImageId = null; + this.sourceSnapshot = null; + this.sourceSnapshotEncryptionKey = null; + this.sourceSnapshotId = null; + this.status = null; + this.type = null; + this.users = null; + this.zone = null; + } + + private Disk( + String creationTimestamp, + String description, + CustomerEncryptionKey diskEncryptionKey, + List guestOsFeatures, + String id, + String kind, + String labelFingerprint, + Map labels, + String lastAttachTimestamp, + String lastDetachTimestamp, + List licenseCodes, + List licenses, + String name, + String options, + String region, + List replicaZones, + String selfLink, + String sizeGb, + String sourceImage, + CustomerEncryptionKey sourceImageEncryptionKey, + String sourceImageId, + String sourceSnapshot, + CustomerEncryptionKey sourceSnapshotEncryptionKey, + String sourceSnapshotId, + String status, + String type, + List users, + String zone) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.diskEncryptionKey = diskEncryptionKey; + this.guestOsFeatures = guestOsFeatures; + this.id = id; + this.kind = kind; + this.labelFingerprint = labelFingerprint; + this.labels = labels; + this.lastAttachTimestamp = lastAttachTimestamp; + this.lastDetachTimestamp = lastDetachTimestamp; + this.licenseCodes = licenseCodes; + this.licenses = licenses; + this.name = name; + this.options = options; + this.region = region; + this.replicaZones = replicaZones; + this.selfLink = selfLink; + this.sizeGb = sizeGb; + this.sourceImage = sourceImage; + this.sourceImageEncryptionKey = sourceImageEncryptionKey; + this.sourceImageId = sourceImageId; + this.sourceSnapshot = sourceSnapshot; + this.sourceSnapshotEncryptionKey = sourceSnapshotEncryptionKey; + this.sourceSnapshotId = sourceSnapshotId; + this.status = status; + this.type = type; + this.users = users; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("diskEncryptionKey")) { + return diskEncryptionKey; + } + if (fieldName.equals("guestOsFeatures")) { + return guestOsFeatures; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("labelFingerprint")) { + return labelFingerprint; + } + if (fieldName.equals("labels")) { + return labels; + } + if (fieldName.equals("lastAttachTimestamp")) { + return lastAttachTimestamp; + } + if (fieldName.equals("lastDetachTimestamp")) { + return lastDetachTimestamp; + } + if (fieldName.equals("licenseCodes")) { + return licenseCodes; + } + if (fieldName.equals("licenses")) { + return licenses; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("options")) { + return options; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("replicaZones")) { + return replicaZones; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("sizeGb")) { + return sizeGb; + } + if (fieldName.equals("sourceImage")) { + return sourceImage; + } + if (fieldName.equals("sourceImageEncryptionKey")) { + return sourceImageEncryptionKey; + } + if (fieldName.equals("sourceImageId")) { + return sourceImageId; + } + if (fieldName.equals("sourceSnapshot")) { + return sourceSnapshot; + } + if (fieldName.equals("sourceSnapshotEncryptionKey")) { + return sourceSnapshotEncryptionKey; + } + if (fieldName.equals("sourceSnapshotId")) { + return sourceSnapshotId; + } + if (fieldName.equals("status")) { + return status; + } + if (fieldName.equals("type")) { + return type; + } + if (fieldName.equals("users")) { + return users; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public CustomerEncryptionKey getDiskEncryptionKey() { + return diskEncryptionKey; + } + + public List getGuestOsFeaturesList() { + return guestOsFeatures; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Map getLabelsMap() { + return labels; + } + + public String getLastAttachTimestamp() { + return lastAttachTimestamp; + } + + public String getLastDetachTimestamp() { + return lastDetachTimestamp; + } + + public List getLicenseCodesList() { + return licenseCodes; + } + + public List getLicensesList() { + return licenses; + } + + public String getName() { + return name; + } + + public String getOptions() { + return options; + } + + public String getRegion() { + return region; + } + + public List getReplicaZonesList() { + return replicaZones; + } + + public String getSelfLink() { + return selfLink; + } + + public String getSizeGb() { + return sizeGb; + } + + public String getSourceImage() { + return sourceImage; + } + + public CustomerEncryptionKey getSourceImageEncryptionKey() { + return sourceImageEncryptionKey; + } + + public String getSourceImageId() { + return sourceImageId; + } + + public String getSourceSnapshot() { + return sourceSnapshot; + } + + public CustomerEncryptionKey getSourceSnapshotEncryptionKey() { + return sourceSnapshotEncryptionKey; + } + + public String getSourceSnapshotId() { + return sourceSnapshotId; + } + + public String getStatus() { + return status; + } + + public String getType() { + return type; + } + + public List getUsersList() { + return users; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Disk prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Disk getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Disk DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Disk(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private CustomerEncryptionKey diskEncryptionKey; + private List guestOsFeatures; + private String id; + private String kind; + private String labelFingerprint; + private Map labels; + private String lastAttachTimestamp; + private String lastDetachTimestamp; + private List licenseCodes; + private List licenses; + private String name; + private String options; + private String region; + private List replicaZones; + private String selfLink; + private String sizeGb; + private String sourceImage; + private CustomerEncryptionKey sourceImageEncryptionKey; + private String sourceImageId; + private String sourceSnapshot; + private CustomerEncryptionKey sourceSnapshotEncryptionKey; + private String sourceSnapshotId; + private String status; + private String type; + private List users; + private String zone; + + Builder() {} + + public Builder mergeFrom(Disk other) { + if (other == Disk.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getDiskEncryptionKey() != null) { + this.diskEncryptionKey = other.diskEncryptionKey; + } + if (other.getGuestOsFeaturesList() != null) { + this.guestOsFeatures = other.guestOsFeatures; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getLabelFingerprint() != null) { + this.labelFingerprint = other.labelFingerprint; + } + if (other.getLabelsMap() != null) { + this.labels = other.labels; + } + if (other.getLastAttachTimestamp() != null) { + this.lastAttachTimestamp = other.lastAttachTimestamp; + } + if (other.getLastDetachTimestamp() != null) { + this.lastDetachTimestamp = other.lastDetachTimestamp; + } + if (other.getLicenseCodesList() != null) { + this.licenseCodes = other.licenseCodes; + } + if (other.getLicensesList() != null) { + this.licenses = other.licenses; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getOptions() != null) { + this.options = other.options; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getReplicaZonesList() != null) { + this.replicaZones = other.replicaZones; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSizeGb() != null) { + this.sizeGb = other.sizeGb; + } + if (other.getSourceImage() != null) { + this.sourceImage = other.sourceImage; + } + if (other.getSourceImageEncryptionKey() != null) { + this.sourceImageEncryptionKey = other.sourceImageEncryptionKey; + } + if (other.getSourceImageId() != null) { + this.sourceImageId = other.sourceImageId; + } + if (other.getSourceSnapshot() != null) { + this.sourceSnapshot = other.sourceSnapshot; + } + if (other.getSourceSnapshotEncryptionKey() != null) { + this.sourceSnapshotEncryptionKey = other.sourceSnapshotEncryptionKey; + } + if (other.getSourceSnapshotId() != null) { + this.sourceSnapshotId = other.sourceSnapshotId; + } + if (other.getStatus() != null) { + this.status = other.status; + } + if (other.getType() != null) { + this.type = other.type; + } + if (other.getUsersList() != null) { + this.users = other.users; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(Disk source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.diskEncryptionKey = source.diskEncryptionKey; + this.guestOsFeatures = source.guestOsFeatures; + this.id = source.id; + this.kind = source.kind; + this.labelFingerprint = source.labelFingerprint; + this.labels = source.labels; + this.lastAttachTimestamp = source.lastAttachTimestamp; + this.lastDetachTimestamp = source.lastDetachTimestamp; + this.licenseCodes = source.licenseCodes; + this.licenses = source.licenses; + this.name = source.name; + this.options = source.options; + this.region = source.region; + this.replicaZones = source.replicaZones; + this.selfLink = source.selfLink; + this.sizeGb = source.sizeGb; + this.sourceImage = source.sourceImage; + this.sourceImageEncryptionKey = source.sourceImageEncryptionKey; + this.sourceImageId = source.sourceImageId; + this.sourceSnapshot = source.sourceSnapshot; + this.sourceSnapshotEncryptionKey = source.sourceSnapshotEncryptionKey; + this.sourceSnapshotId = source.sourceSnapshotId; + this.status = source.status; + this.type = source.type; + this.users = source.users; + this.zone = source.zone; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public CustomerEncryptionKey getDiskEncryptionKey() { + return diskEncryptionKey; + } + + public Builder setDiskEncryptionKey(CustomerEncryptionKey diskEncryptionKey) { + this.diskEncryptionKey = diskEncryptionKey; + return this; + } + + public List getGuestOsFeaturesList() { + return guestOsFeatures; + } + + public Builder addAllGuestOsFeatures(List guestOsFeatures) { + if (this.guestOsFeatures == null) { + this.guestOsFeatures = new ArrayList<>(guestOsFeatures.size()); + } + this.guestOsFeatures.addAll(guestOsFeatures); + return this; + } + + public Builder addGuestOsFeatures(GuestOsFeature guestOsFeatures) { + this.guestOsFeatures.add(guestOsFeatures); + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Builder setLabelFingerprint(String labelFingerprint) { + this.labelFingerprint = labelFingerprint; + return this; + } + + public Map getLabelsMap() { + return labels; + } + + public Builder putAllLabels(Map labels) { + this.labels = labels; + return this; + } + + public String getLastAttachTimestamp() { + return lastAttachTimestamp; + } + + public Builder setLastAttachTimestamp(String lastAttachTimestamp) { + this.lastAttachTimestamp = lastAttachTimestamp; + return this; + } + + public String getLastDetachTimestamp() { + return lastDetachTimestamp; + } + + public Builder setLastDetachTimestamp(String lastDetachTimestamp) { + this.lastDetachTimestamp = lastDetachTimestamp; + return this; + } + + public List getLicenseCodesList() { + return licenseCodes; + } + + public Builder addAllLicenseCodes(List licenseCodes) { + if (this.licenseCodes == null) { + this.licenseCodes = new ArrayList<>(licenseCodes.size()); + } + this.licenseCodes.addAll(licenseCodes); + return this; + } + + public Builder addLicenseCodes(String licenseCodes) { + this.licenseCodes.add(licenseCodes); + return this; + } + + public List getLicensesList() { + return licenses; + } + + public Builder addAllLicenses(List licenses) { + if (this.licenses == null) { + this.licenses = new ArrayList<>(licenses.size()); + } + this.licenses.addAll(licenses); + return this; + } + + public Builder addLicenses(String licenses) { + this.licenses.add(licenses); + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getOptions() { + return options; + } + + public Builder setOptions(String options) { + this.options = options; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public List getReplicaZonesList() { + return replicaZones; + } + + public Builder addAllReplicaZones(List replicaZones) { + if (this.replicaZones == null) { + this.replicaZones = new ArrayList<>(replicaZones.size()); + } + this.replicaZones.addAll(replicaZones); + return this; + } + + public Builder addReplicaZones(String replicaZones) { + this.replicaZones.add(replicaZones); + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getSizeGb() { + return sizeGb; + } + + public Builder setSizeGb(String sizeGb) { + this.sizeGb = sizeGb; + return this; + } + + public String getSourceImage() { + return sourceImage; + } + + public Builder setSourceImage(String sourceImage) { + this.sourceImage = sourceImage; + return this; + } + + public CustomerEncryptionKey getSourceImageEncryptionKey() { + return sourceImageEncryptionKey; + } + + public Builder setSourceImageEncryptionKey(CustomerEncryptionKey sourceImageEncryptionKey) { + this.sourceImageEncryptionKey = sourceImageEncryptionKey; + return this; + } + + public String getSourceImageId() { + return sourceImageId; + } + + public Builder setSourceImageId(String sourceImageId) { + this.sourceImageId = sourceImageId; + return this; + } + + public String getSourceSnapshot() { + return sourceSnapshot; + } + + public Builder setSourceSnapshot(String sourceSnapshot) { + this.sourceSnapshot = sourceSnapshot; + return this; + } + + public CustomerEncryptionKey getSourceSnapshotEncryptionKey() { + return sourceSnapshotEncryptionKey; + } + + public Builder setSourceSnapshotEncryptionKey( + CustomerEncryptionKey sourceSnapshotEncryptionKey) { + this.sourceSnapshotEncryptionKey = sourceSnapshotEncryptionKey; + return this; + } + + public String getSourceSnapshotId() { + return sourceSnapshotId; + } + + public Builder setSourceSnapshotId(String sourceSnapshotId) { + this.sourceSnapshotId = sourceSnapshotId; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public String getType() { + return type; + } + + public Builder setType(String type) { + this.type = type; + return this; + } + + public List getUsersList() { + return users; + } + + public Builder addAllUsers(List users) { + if (this.users == null) { + this.users = new ArrayList<>(users.size()); + } + this.users.addAll(users); + return this; + } + + public Builder addUsers(String users) { + this.users.add(users); + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public Disk build() { + + return new Disk( + creationTimestamp, + description, + diskEncryptionKey, + guestOsFeatures, + id, + kind, + labelFingerprint, + labels, + lastAttachTimestamp, + lastDetachTimestamp, + licenseCodes, + licenses, + name, + options, + region, + replicaZones, + selfLink, + sizeGb, + sourceImage, + sourceImageEncryptionKey, + sourceImageId, + sourceSnapshot, + sourceSnapshotEncryptionKey, + sourceSnapshotId, + status, + type, + users, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setDiskEncryptionKey(this.diskEncryptionKey); + newBuilder.addAllGuestOsFeatures(this.guestOsFeatures); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setLabelFingerprint(this.labelFingerprint); + newBuilder.putAllLabels(this.labels); + newBuilder.setLastAttachTimestamp(this.lastAttachTimestamp); + newBuilder.setLastDetachTimestamp(this.lastDetachTimestamp); + newBuilder.addAllLicenseCodes(this.licenseCodes); + newBuilder.addAllLicenses(this.licenses); + newBuilder.setName(this.name); + newBuilder.setOptions(this.options); + newBuilder.setRegion(this.region); + newBuilder.addAllReplicaZones(this.replicaZones); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setSizeGb(this.sizeGb); + newBuilder.setSourceImage(this.sourceImage); + newBuilder.setSourceImageEncryptionKey(this.sourceImageEncryptionKey); + newBuilder.setSourceImageId(this.sourceImageId); + newBuilder.setSourceSnapshot(this.sourceSnapshot); + newBuilder.setSourceSnapshotEncryptionKey(this.sourceSnapshotEncryptionKey); + newBuilder.setSourceSnapshotId(this.sourceSnapshotId); + newBuilder.setStatus(this.status); + newBuilder.setType(this.type); + newBuilder.addAllUsers(this.users); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "Disk{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "diskEncryptionKey=" + + diskEncryptionKey + + ", " + + "guestOsFeatures=" + + guestOsFeatures + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "labelFingerprint=" + + labelFingerprint + + ", " + + "labels=" + + labels + + ", " + + "lastAttachTimestamp=" + + lastAttachTimestamp + + ", " + + "lastDetachTimestamp=" + + lastDetachTimestamp + + ", " + + "licenseCodes=" + + licenseCodes + + ", " + + "licenses=" + + licenses + + ", " + + "name=" + + name + + ", " + + "options=" + + options + + ", " + + "region=" + + region + + ", " + + "replicaZones=" + + replicaZones + + ", " + + "selfLink=" + + selfLink + + ", " + + "sizeGb=" + + sizeGb + + ", " + + "sourceImage=" + + sourceImage + + ", " + + "sourceImageEncryptionKey=" + + sourceImageEncryptionKey + + ", " + + "sourceImageId=" + + sourceImageId + + ", " + + "sourceSnapshot=" + + sourceSnapshot + + ", " + + "sourceSnapshotEncryptionKey=" + + sourceSnapshotEncryptionKey + + ", " + + "sourceSnapshotId=" + + sourceSnapshotId + + ", " + + "status=" + + status + + ", " + + "type=" + + type + + ", " + + "users=" + + users + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Disk) { + Disk that = (Disk) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.diskEncryptionKey, that.getDiskEncryptionKey()) + && Objects.equals(this.guestOsFeatures, that.getGuestOsFeaturesList()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.labelFingerprint, that.getLabelFingerprint()) + && Objects.equals(this.labels, that.getLabelsMap()) + && Objects.equals(this.lastAttachTimestamp, that.getLastAttachTimestamp()) + && Objects.equals(this.lastDetachTimestamp, that.getLastDetachTimestamp()) + && Objects.equals(this.licenseCodes, that.getLicenseCodesList()) + && Objects.equals(this.licenses, that.getLicensesList()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.options, that.getOptions()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.replicaZones, that.getReplicaZonesList()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.sizeGb, that.getSizeGb()) + && Objects.equals(this.sourceImage, that.getSourceImage()) + && Objects.equals(this.sourceImageEncryptionKey, that.getSourceImageEncryptionKey()) + && Objects.equals(this.sourceImageId, that.getSourceImageId()) + && Objects.equals(this.sourceSnapshot, that.getSourceSnapshot()) + && Objects.equals(this.sourceSnapshotEncryptionKey, that.getSourceSnapshotEncryptionKey()) + && Objects.equals(this.sourceSnapshotId, that.getSourceSnapshotId()) + && Objects.equals(this.status, that.getStatus()) + && Objects.equals(this.type, that.getType()) + && Objects.equals(this.users, that.getUsersList()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + description, + diskEncryptionKey, + guestOsFeatures, + id, + kind, + labelFingerprint, + labels, + lastAttachTimestamp, + lastDetachTimestamp, + licenseCodes, + licenses, + name, + options, + region, + replicaZones, + selfLink, + sizeGb, + sourceImage, + sourceImageEncryptionKey, + sourceImageId, + sourceSnapshot, + sourceSnapshotEncryptionKey, + sourceSnapshotId, + status, + type, + users, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskAggregatedList.java new file mode 100644 index 000000000000..e3254b1b0e23 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DiskAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private DiskAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private DiskAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DiskAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DiskAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DiskAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DiskAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(DiskAggregatedList other) { + if (other == DiskAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(DiskAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public DiskAggregatedList build() { + + return new DiskAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "DiskAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DiskAggregatedList) { + DiskAggregatedList that = (DiskAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java new file mode 100644 index 000000000000..385f53b71dab --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java @@ -0,0 +1,1269 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.DiskStub; +import com.google.cloud.compute.v1.stub.DiskStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (DiskClient diskClient = DiskClient.create()) {
+ *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+ *   Boolean guestFlush = false;
+ *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+ *   Operation response = diskClient.createSnapshotDisk(disk, guestFlush, snapshotResource);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the diskClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of DiskSettings to create(). For + * example: + * + *

To customize credentials: + * + *

+ * 
+ * DiskSettings diskSettings =
+ *     DiskSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * DiskClient diskClient =
+ *     DiskClient.create(diskSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * DiskSettings diskSettings =
+ *     DiskSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * DiskClient diskClient =
+ *     DiskClient.create(diskSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DiskClient implements BackgroundResource { + private final DiskSettings settings; + private final DiskStub stub; + + /** Constructs an instance of DiskClient with default settings. */ + public static final DiskClient create() throws IOException { + return create(DiskSettings.newBuilder().build()); + } + + /** + * Constructs an instance of DiskClient, using the given settings. The channels are created based + * on the settings passed in, or defaults for any settings that are not set. + */ + public static final DiskClient create(DiskSettings settings) throws IOException { + return new DiskClient(settings); + } + + /** + * Constructs an instance of DiskClient, using the given stub for making calls. This is for + * advanced usage - prefer to use DiskSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final DiskClient create(DiskStub stub) { + return new DiskClient(stub); + } + + /** + * Constructs an instance of DiskClient, using the given settings. This is protected so that it is + * easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected DiskClient(DiskSettings settings) throws IOException { + this.settings = settings; + this.stub = ((DiskStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected DiskClient(DiskStub stub) { + this.settings = null; + this.stub = stub; + } + + public final DiskSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public DiskStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of persistent disks. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (DisksScopedList element : diskClient.aggregatedListDisks(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListDisksPagedResponse aggregatedListDisks(ProjectName project) { + AggregatedListDisksHttpRequest request = + AggregatedListDisksHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListDisks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of persistent disks. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (DisksScopedList element : diskClient.aggregatedListDisks(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListDisksPagedResponse aggregatedListDisks(String project) { + AggregatedListDisksHttpRequest request = + AggregatedListDisksHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListDisks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of persistent disks. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListDisksHttpRequest request = AggregatedListDisksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (DisksScopedList element : diskClient.aggregatedListDisks(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListDisksPagedResponse aggregatedListDisks( + AggregatedListDisksHttpRequest request) { + return aggregatedListDisksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of persistent disks. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListDisksHttpRequest request = AggregatedListDisksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListDisksPagedResponse> future = diskClient.aggregatedListDisksPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (DisksScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListDisksPagedCallable() { + return stub.aggregatedListDisksPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of persistent disks. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListDisksHttpRequest request = AggregatedListDisksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     DiskAggregatedList response = diskClient.aggregatedListDisksCallable().call(request);
+   *     for (DisksScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListDisksCallable() { + return stub.aggregatedListDisksCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a snapshot of a specified persistent disk. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   Boolean guestFlush = false;
+   *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+   *   Operation response = diskClient.createSnapshotDisk(disk, guestFlush, snapshotResource);
+   * }
+   * 
+ * + * @param disk Name of the persistent disk to snapshot. + * @param guestFlush + * @param snapshotResource A persistent disk snapshot resource. (== resource_for beta.snapshots + * ==) (== resource_for v1.snapshots ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation createSnapshotDisk( + ProjectZoneDiskName disk, Boolean guestFlush, Snapshot snapshotResource) { + + CreateSnapshotDiskHttpRequest request = + CreateSnapshotDiskHttpRequest.newBuilder() + .setDisk(disk == null ? null : disk.toString()) + .setGuestFlush(guestFlush) + .setSnapshotResource(snapshotResource) + .build(); + return createSnapshotDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a snapshot of a specified persistent disk. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   Boolean guestFlush = false;
+   *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+   *   Operation response = diskClient.createSnapshotDisk(disk.toString(), guestFlush, snapshotResource);
+   * }
+   * 
+ * + * @param disk Name of the persistent disk to snapshot. + * @param guestFlush + * @param snapshotResource A persistent disk snapshot resource. (== resource_for beta.snapshots + * ==) (== resource_for v1.snapshots ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation createSnapshotDisk( + String disk, Boolean guestFlush, Snapshot snapshotResource) { + + CreateSnapshotDiskHttpRequest request = + CreateSnapshotDiskHttpRequest.newBuilder() + .setDisk(disk) + .setGuestFlush(guestFlush) + .setSnapshotResource(snapshotResource) + .build(); + return createSnapshotDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a snapshot of a specified persistent disk. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   Boolean guestFlush = false;
+   *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+   *   CreateSnapshotDiskHttpRequest request = CreateSnapshotDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .setGuestFlush(guestFlush)
+   *     .setSnapshotResource(snapshotResource)
+   *     .build();
+   *   Operation response = diskClient.createSnapshotDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation createSnapshotDisk(CreateSnapshotDiskHttpRequest request) { + return createSnapshotDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a snapshot of a specified persistent disk. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   Boolean guestFlush = false;
+   *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+   *   CreateSnapshotDiskHttpRequest request = CreateSnapshotDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .setGuestFlush(guestFlush)
+   *     .setSnapshotResource(snapshotResource)
+   *     .build();
+   *   ApiFuture<Operation> future = diskClient.createSnapshotDiskCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + createSnapshotDiskCallable() { + return stub.createSnapshotDiskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified persistent disk. Deleting a disk removes its data permanently and is + * irreversible. However, deleting a disk does not delete any snapshots previously made from the + * disk. You must separately delete snapshots. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   Operation response = diskClient.deleteDisk(disk);
+   * }
+   * 
+ * + * @param disk Name of the persistent disk to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteDisk(ProjectZoneDiskName disk) { + + DeleteDiskHttpRequest request = + DeleteDiskHttpRequest.newBuilder().setDisk(disk == null ? null : disk.toString()).build(); + return deleteDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified persistent disk. Deleting a disk removes its data permanently and is + * irreversible. However, deleting a disk does not delete any snapshots previously made from the + * disk. You must separately delete snapshots. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   Operation response = diskClient.deleteDisk(disk.toString());
+   * }
+   * 
+ * + * @param disk Name of the persistent disk to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteDisk(String disk) { + + DeleteDiskHttpRequest request = DeleteDiskHttpRequest.newBuilder().setDisk(disk).build(); + return deleteDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified persistent disk. Deleting a disk removes its data permanently and is + * irreversible. However, deleting a disk does not delete any snapshots previously made from the + * disk. You must separately delete snapshots. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   DeleteDiskHttpRequest request = DeleteDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .build();
+   *   Operation response = diskClient.deleteDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteDisk(DeleteDiskHttpRequest request) { + return deleteDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified persistent disk. Deleting a disk removes its data permanently and is + * irreversible. However, deleting a disk does not delete any snapshots previously made from the + * disk. You must separately delete snapshots. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   DeleteDiskHttpRequest request = DeleteDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = diskClient.deleteDiskCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteDiskCallable() { + return stub.deleteDiskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a specified persistent disk. Gets a list of available persistent disks by making a + * list() request. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   Disk response = diskClient.getDisk(disk);
+   * }
+   * 
+ * + * @param disk Name of the persistent disk to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Disk getDisk(ProjectZoneDiskName disk) { + + GetDiskHttpRequest request = + GetDiskHttpRequest.newBuilder().setDisk(disk == null ? null : disk.toString()).build(); + return getDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a specified persistent disk. Gets a list of available persistent disks by making a + * list() request. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   Disk response = diskClient.getDisk(disk.toString());
+   * }
+   * 
+ * + * @param disk Name of the persistent disk to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Disk getDisk(String disk) { + + GetDiskHttpRequest request = GetDiskHttpRequest.newBuilder().setDisk(disk).build(); + return getDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a specified persistent disk. Gets a list of available persistent disks by making a + * list() request. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   GetDiskHttpRequest request = GetDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .build();
+   *   Disk response = diskClient.getDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Disk getDisk(GetDiskHttpRequest request) { + return getDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a specified persistent disk. Gets a list of available persistent disks by making a + * list() request. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   GetDiskHttpRequest request = GetDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .build();
+   *   ApiFuture<Disk> future = diskClient.getDiskCallable().futureCall(request);
+   *   // Do something
+   *   Disk response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getDiskCallable() { + return stub.getDiskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a persistent disk in the specified project using the data in the request. You can + * create a disk with a sourceImage, a sourceSnapshot, or create an empty 500 GB data disk by + * omitting all properties. You can also create a disk that is larger than the default size by + * specifying the sizeGb property. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Disk diskResource = Disk.newBuilder().build();
+   *   Operation response = diskClient.insertDisk(zone, diskResource);
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @param diskResource A Disk resource. (== resource_for beta.disks ==) (== resource_for v1.disks + * ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertDisk(ProjectZoneName zone, Disk diskResource) { + + InsertDiskHttpRequest request = + InsertDiskHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .setDiskResource(diskResource) + .build(); + return insertDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a persistent disk in the specified project using the data in the request. You can + * create a disk with a sourceImage, a sourceSnapshot, or create an empty 500 GB data disk by + * omitting all properties. You can also create a disk that is larger than the default size by + * specifying the sizeGb property. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Disk diskResource = Disk.newBuilder().build();
+   *   Operation response = diskClient.insertDisk(zone.toString(), diskResource);
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @param diskResource A Disk resource. (== resource_for beta.disks ==) (== resource_for v1.disks + * ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertDisk(String zone, Disk diskResource) { + + InsertDiskHttpRequest request = + InsertDiskHttpRequest.newBuilder().setZone(zone).setDiskResource(diskResource).build(); + return insertDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a persistent disk in the specified project using the data in the request. You can + * create a disk with a sourceImage, a sourceSnapshot, or create an empty 500 GB data disk by + * omitting all properties. You can also create a disk that is larger than the default size by + * specifying the sizeGb property. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Disk diskResource = Disk.newBuilder().build();
+   *   InsertDiskHttpRequest request = InsertDiskHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setDiskResource(diskResource)
+   *     .build();
+   *   Operation response = diskClient.insertDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertDisk(InsertDiskHttpRequest request) { + return insertDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a persistent disk in the specified project using the data in the request. You can + * create a disk with a sourceImage, a sourceSnapshot, or create an empty 500 GB data disk by + * omitting all properties. You can also create a disk that is larger than the default size by + * specifying the sizeGb property. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Disk diskResource = Disk.newBuilder().build();
+   *   InsertDiskHttpRequest request = InsertDiskHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setDiskResource(diskResource)
+   *     .build();
+   *   ApiFuture<Operation> future = diskClient.insertDiskCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertDiskCallable() { + return stub.insertDiskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of persistent disks contained within the specified zone. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (Disk element : diskClient.listDisks(zone).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListDisksPagedResponse listDisks(ProjectZoneName zone) { + ListDisksHttpRequest request = + ListDisksHttpRequest.newBuilder().setZone(zone == null ? null : zone.toString()).build(); + return listDisks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of persistent disks contained within the specified zone. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (Disk element : diskClient.listDisks(zone.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListDisksPagedResponse listDisks(String zone) { + ListDisksHttpRequest request = ListDisksHttpRequest.newBuilder().setZone(zone).build(); + return listDisks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of persistent disks contained within the specified zone. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListDisksHttpRequest request = ListDisksHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   for (Disk element : diskClient.listDisks(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListDisksPagedResponse listDisks(ListDisksHttpRequest request) { + return listDisksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of persistent disks contained within the specified zone. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListDisksHttpRequest request = ListDisksHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   ApiFuture<ListDisksPagedResponse> future = diskClient.listDisksPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Disk element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listDisksPagedCallable() { + return stub.listDisksPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of persistent disks contained within the specified zone. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListDisksHttpRequest request = ListDisksHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   while (true) {
+   *     DiskList response = diskClient.listDisksCallable().call(request);
+   *     for (Disk element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listDisksCallable() { + return stub.listDisksCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the specified persistent disk. You can only increase the size of the disk. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   DisksResizeRequest disksResizeRequestResource = DisksResizeRequest.newBuilder().build();
+   *   Operation response = diskClient.resizeDisk(disk, disksResizeRequestResource);
+   * }
+   * 
+ * + * @param disk The name of the persistent disk. + * @param disksResizeRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeDisk( + ProjectZoneDiskName disk, DisksResizeRequest disksResizeRequestResource) { + + ResizeDiskHttpRequest request = + ResizeDiskHttpRequest.newBuilder() + .setDisk(disk == null ? null : disk.toString()) + .setDisksResizeRequestResource(disksResizeRequestResource) + .build(); + return resizeDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the specified persistent disk. You can only increase the size of the disk. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   DisksResizeRequest disksResizeRequestResource = DisksResizeRequest.newBuilder().build();
+   *   Operation response = diskClient.resizeDisk(disk.toString(), disksResizeRequestResource);
+   * }
+   * 
+ * + * @param disk The name of the persistent disk. + * @param disksResizeRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeDisk(String disk, DisksResizeRequest disksResizeRequestResource) { + + ResizeDiskHttpRequest request = + ResizeDiskHttpRequest.newBuilder() + .setDisk(disk) + .setDisksResizeRequestResource(disksResizeRequestResource) + .build(); + return resizeDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the specified persistent disk. You can only increase the size of the disk. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   DisksResizeRequest disksResizeRequestResource = DisksResizeRequest.newBuilder().build();
+   *   ResizeDiskHttpRequest request = ResizeDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .setDisksResizeRequestResource(disksResizeRequestResource)
+   *     .build();
+   *   Operation response = diskClient.resizeDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeDisk(ResizeDiskHttpRequest request) { + return resizeDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the specified persistent disk. You can only increase the size of the disk. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+   *   DisksResizeRequest disksResizeRequestResource = DisksResizeRequest.newBuilder().build();
+   *   ResizeDiskHttpRequest request = ResizeDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .setDisksResizeRequestResource(disksResizeRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = diskClient.resizeDiskCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable resizeDiskCallable() { + return stub.resizeDiskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on a disk. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskResourceName resource = ProjectZoneDiskResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
+   *   ZoneSetLabelsRequest zoneSetLabelsRequestResource = ZoneSetLabelsRequest.newBuilder().build();
+   *   Operation response = diskClient.setLabelsDisk(resource, zoneSetLabelsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param zoneSetLabelsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsDisk( + ProjectZoneDiskResourceName resource, ZoneSetLabelsRequest zoneSetLabelsRequestResource) { + + SetLabelsDiskHttpRequest request = + SetLabelsDiskHttpRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setZoneSetLabelsRequestResource(zoneSetLabelsRequestResource) + .build(); + return setLabelsDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on a disk. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskResourceName resource = ProjectZoneDiskResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
+   *   ZoneSetLabelsRequest zoneSetLabelsRequestResource = ZoneSetLabelsRequest.newBuilder().build();
+   *   Operation response = diskClient.setLabelsDisk(resource.toString(), zoneSetLabelsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param zoneSetLabelsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsDisk( + String resource, ZoneSetLabelsRequest zoneSetLabelsRequestResource) { + + SetLabelsDiskHttpRequest request = + SetLabelsDiskHttpRequest.newBuilder() + .setResource(resource) + .setZoneSetLabelsRequestResource(zoneSetLabelsRequestResource) + .build(); + return setLabelsDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on a disk. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskResourceName resource = ProjectZoneDiskResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
+   *   ZoneSetLabelsRequest zoneSetLabelsRequestResource = ZoneSetLabelsRequest.newBuilder().build();
+   *   SetLabelsDiskHttpRequest request = SetLabelsDiskHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setZoneSetLabelsRequestResource(zoneSetLabelsRequestResource)
+   *     .build();
+   *   Operation response = diskClient.setLabelsDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsDisk(SetLabelsDiskHttpRequest request) { + return setLabelsDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on a disk. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (DiskClient diskClient = DiskClient.create()) {
+   *   ProjectZoneDiskResourceName resource = ProjectZoneDiskResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
+   *   ZoneSetLabelsRequest zoneSetLabelsRequestResource = ZoneSetLabelsRequest.newBuilder().build();
+   *   SetLabelsDiskHttpRequest request = SetLabelsDiskHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setZoneSetLabelsRequestResource(zoneSetLabelsRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = diskClient.setLabelsDiskCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable setLabelsDiskCallable() { + return stub.setLabelsDiskCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListDisksPagedResponse + extends AbstractPagedListResponse< + AggregatedListDisksHttpRequest, DiskAggregatedList, DisksScopedList, + AggregatedListDisksPage, AggregatedListDisksFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListDisksPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public AggregatedListDisksPagedResponse apply(AggregatedListDisksPage input) { + return new AggregatedListDisksPagedResponse(input); + } + }); + } + + private AggregatedListDisksPagedResponse(AggregatedListDisksPage page) { + super(page, AggregatedListDisksFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListDisksPage + extends AbstractPage< + AggregatedListDisksHttpRequest, DiskAggregatedList, DisksScopedList, + AggregatedListDisksPage> { + + private AggregatedListDisksPage( + PageContext context, + DiskAggregatedList response) { + super(context, response); + } + + private static AggregatedListDisksPage createEmptyPage() { + return new AggregatedListDisksPage(null, null); + } + + @Override + protected AggregatedListDisksPage createPage( + PageContext context, + DiskAggregatedList response) { + return new AggregatedListDisksPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListDisksFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListDisksHttpRequest, DiskAggregatedList, DisksScopedList, + AggregatedListDisksPage, AggregatedListDisksFixedSizeCollection> { + + private AggregatedListDisksFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListDisksFixedSizeCollection createEmptyCollection() { + return new AggregatedListDisksFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListDisksFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListDisksFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListDisksPagedResponse + extends AbstractPagedListResponse< + ListDisksHttpRequest, DiskList, Disk, ListDisksPage, ListDisksFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListDisksPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListDisksPagedResponse apply(ListDisksPage input) { + return new ListDisksPagedResponse(input); + } + }); + } + + private ListDisksPagedResponse(ListDisksPage page) { + super(page, ListDisksFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListDisksPage + extends AbstractPage { + + private ListDisksPage( + PageContext context, DiskList response) { + super(context, response); + } + + private static ListDisksPage createEmptyPage() { + return new ListDisksPage(null, null); + } + + @Override + protected ListDisksPage createPage( + PageContext context, DiskList response) { + return new ListDisksPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListDisksFixedSizeCollection + extends AbstractFixedSizeCollection< + ListDisksHttpRequest, DiskList, Disk, ListDisksPage, ListDisksFixedSizeCollection> { + + private ListDisksFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListDisksFixedSizeCollection createEmptyCollection() { + return new ListDisksFixedSizeCollection(null, 0); + } + + @Override + protected ListDisksFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListDisksFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskList.java new file mode 100644 index 000000000000..41c6fe8ff920 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DiskList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private DiskList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private DiskList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DiskList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DiskList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DiskList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DiskList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(DiskList other) { + if (other == DiskList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(DiskList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Disk items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public DiskList build() { + + return new DiskList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "DiskList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DiskList) { + DiskList that = (DiskList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskMoveRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskMoveRequest.java new file mode 100644 index 000000000000..a2883c8c4c96 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskMoveRequest.java @@ -0,0 +1,175 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DiskMoveRequest implements ApiMessage { + private final String destinationZone; + private final String targetDisk; + + private DiskMoveRequest() { + this.destinationZone = null; + this.targetDisk = null; + } + + private DiskMoveRequest(String destinationZone, String targetDisk) { + this.destinationZone = destinationZone; + this.targetDisk = targetDisk; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("destinationZone")) { + return destinationZone; + } + if (fieldName.equals("targetDisk")) { + return targetDisk; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getDestinationZone() { + return destinationZone; + } + + public String getTargetDisk() { + return targetDisk; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DiskMoveRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DiskMoveRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DiskMoveRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DiskMoveRequest(); + } + + public static class Builder { + private String destinationZone; + private String targetDisk; + + Builder() {} + + public Builder mergeFrom(DiskMoveRequest other) { + if (other == DiskMoveRequest.getDefaultInstance()) return this; + if (other.getDestinationZone() != null) { + this.destinationZone = other.destinationZone; + } + if (other.getTargetDisk() != null) { + this.targetDisk = other.targetDisk; + } + return this; + } + + Builder(DiskMoveRequest source) { + this.destinationZone = source.destinationZone; + this.targetDisk = source.targetDisk; + } + + public String getDestinationZone() { + return destinationZone; + } + + public Builder setDestinationZone(String destinationZone) { + this.destinationZone = destinationZone; + return this; + } + + public String getTargetDisk() { + return targetDisk; + } + + public Builder setTargetDisk(String targetDisk) { + this.targetDisk = targetDisk; + return this; + } + + public DiskMoveRequest build() { + + return new DiskMoveRequest(destinationZone, targetDisk); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDestinationZone(this.destinationZone); + newBuilder.setTargetDisk(this.targetDisk); + return newBuilder; + } + } + + @Override + public String toString() { + return "DiskMoveRequest{" + + "destinationZone=" + + destinationZone + + ", " + + "targetDisk=" + + targetDisk + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DiskMoveRequest) { + DiskMoveRequest that = (DiskMoveRequest) o; + return Objects.equals(this.destinationZone, that.getDestinationZone()) + && Objects.equals(this.targetDisk, that.getTargetDisk()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(destinationZone, targetDisk); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskSettings.java new file mode 100644 index 000000000000..a01a30f18678 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskSettings.java @@ -0,0 +1,260 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.DiskClient.AggregatedListDisksPagedResponse; +import static com.google.cloud.compute.v1.DiskClient.ListDisksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.DiskStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link DiskClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of createSnapshotDisk to 30 seconds: + * + *

+ * 
+ * DiskSettings.Builder diskSettingsBuilder =
+ *     DiskSettings.newBuilder();
+ * diskSettingsBuilder.createSnapshotDiskSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * DiskSettings diskSettings = diskSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DiskSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListDisks. */ + public PagedCallSettings< + AggregatedListDisksHttpRequest, DiskAggregatedList, AggregatedListDisksPagedResponse> + aggregatedListDisksSettings() { + return ((DiskStubSettings) getStubSettings()).aggregatedListDisksSettings(); + } + + /** Returns the object with the settings used for calls to createSnapshotDisk. */ + public UnaryCallSettings createSnapshotDiskSettings() { + return ((DiskStubSettings) getStubSettings()).createSnapshotDiskSettings(); + } + + /** Returns the object with the settings used for calls to deleteDisk. */ + public UnaryCallSettings deleteDiskSettings() { + return ((DiskStubSettings) getStubSettings()).deleteDiskSettings(); + } + + /** Returns the object with the settings used for calls to getDisk. */ + public UnaryCallSettings getDiskSettings() { + return ((DiskStubSettings) getStubSettings()).getDiskSettings(); + } + + /** Returns the object with the settings used for calls to insertDisk. */ + public UnaryCallSettings insertDiskSettings() { + return ((DiskStubSettings) getStubSettings()).insertDiskSettings(); + } + + /** Returns the object with the settings used for calls to listDisks. */ + public PagedCallSettings + listDisksSettings() { + return ((DiskStubSettings) getStubSettings()).listDisksSettings(); + } + + /** Returns the object with the settings used for calls to resizeDisk. */ + public UnaryCallSettings resizeDiskSettings() { + return ((DiskStubSettings) getStubSettings()).resizeDiskSettings(); + } + + /** Returns the object with the settings used for calls to setLabelsDisk. */ + public UnaryCallSettings setLabelsDiskSettings() { + return ((DiskStubSettings) getStubSettings()).setLabelsDiskSettings(); + } + + public static final DiskSettings create(DiskStubSettings stub) throws IOException { + return new DiskSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return DiskStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return DiskStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return DiskStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DiskStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return DiskStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return DiskStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return DiskStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DiskStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected DiskSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for DiskSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(DiskStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(DiskStubSettings.newBuilder()); + } + + protected Builder(DiskSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(DiskStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public DiskStubSettings.Builder getStubSettingsBuilder() { + return ((DiskStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListDisks. */ + public PagedCallSettings.Builder< + AggregatedListDisksHttpRequest, DiskAggregatedList, AggregatedListDisksPagedResponse> + aggregatedListDisksSettings() { + return getStubSettingsBuilder().aggregatedListDisksSettings(); + } + + /** Returns the builder for the settings used for calls to createSnapshotDisk. */ + public UnaryCallSettings.Builder + createSnapshotDiskSettings() { + return getStubSettingsBuilder().createSnapshotDiskSettings(); + } + + /** Returns the builder for the settings used for calls to deleteDisk. */ + public UnaryCallSettings.Builder deleteDiskSettings() { + return getStubSettingsBuilder().deleteDiskSettings(); + } + + /** Returns the builder for the settings used for calls to getDisk. */ + public UnaryCallSettings.Builder getDiskSettings() { + return getStubSettingsBuilder().getDiskSettings(); + } + + /** Returns the builder for the settings used for calls to insertDisk. */ + public UnaryCallSettings.Builder insertDiskSettings() { + return getStubSettingsBuilder().insertDiskSettings(); + } + + /** Returns the builder for the settings used for calls to listDisks. */ + public PagedCallSettings.Builder + listDisksSettings() { + return getStubSettingsBuilder().listDisksSettings(); + } + + /** Returns the builder for the settings used for calls to resizeDisk. */ + public UnaryCallSettings.Builder resizeDiskSettings() { + return getStubSettingsBuilder().resizeDiskSettings(); + } + + /** Returns the builder for the settings used for calls to setLabelsDisk. */ + public UnaryCallSettings.Builder setLabelsDiskSettings() { + return getStubSettingsBuilder().setLabelsDiskSettings(); + } + + @Override + public DiskSettings build() throws IOException { + return new DiskSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskType.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskType.java new file mode 100644 index 000000000000..516285f6e775 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskType.java @@ -0,0 +1,469 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DiskType implements ApiMessage { + private final String creationTimestamp; + private final String defaultDiskSizeGb; + private final DeprecationStatus deprecated; + private final String description; + private final String id; + private final String kind; + private final String name; + private final String region; + private final String selfLink; + private final String validDiskSize; + private final String zone; + + private DiskType() { + this.creationTimestamp = null; + this.defaultDiskSizeGb = null; + this.deprecated = null; + this.description = null; + this.id = null; + this.kind = null; + this.name = null; + this.region = null; + this.selfLink = null; + this.validDiskSize = null; + this.zone = null; + } + + private DiskType( + String creationTimestamp, + String defaultDiskSizeGb, + DeprecationStatus deprecated, + String description, + String id, + String kind, + String name, + String region, + String selfLink, + String validDiskSize, + String zone) { + this.creationTimestamp = creationTimestamp; + this.defaultDiskSizeGb = defaultDiskSizeGb; + this.deprecated = deprecated; + this.description = description; + this.id = id; + this.kind = kind; + this.name = name; + this.region = region; + this.selfLink = selfLink; + this.validDiskSize = validDiskSize; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("defaultDiskSizeGb")) { + return defaultDiskSizeGb; + } + if (fieldName.equals("deprecated")) { + return deprecated; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("validDiskSize")) { + return validDiskSize; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDefaultDiskSizeGb() { + return defaultDiskSizeGb; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public String getValidDiskSize() { + return validDiskSize; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DiskType prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DiskType getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DiskType DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DiskType(); + } + + public static class Builder { + private String creationTimestamp; + private String defaultDiskSizeGb; + private DeprecationStatus deprecated; + private String description; + private String id; + private String kind; + private String name; + private String region; + private String selfLink; + private String validDiskSize; + private String zone; + + Builder() {} + + public Builder mergeFrom(DiskType other) { + if (other == DiskType.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDefaultDiskSizeGb() != null) { + this.defaultDiskSizeGb = other.defaultDiskSizeGb; + } + if (other.getDeprecated() != null) { + this.deprecated = other.deprecated; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getValidDiskSize() != null) { + this.validDiskSize = other.validDiskSize; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(DiskType source) { + this.creationTimestamp = source.creationTimestamp; + this.defaultDiskSizeGb = source.defaultDiskSizeGb; + this.deprecated = source.deprecated; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.region = source.region; + this.selfLink = source.selfLink; + this.validDiskSize = source.validDiskSize; + this.zone = source.zone; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDefaultDiskSizeGb() { + return defaultDiskSizeGb; + } + + public Builder setDefaultDiskSizeGb(String defaultDiskSizeGb) { + this.defaultDiskSizeGb = defaultDiskSizeGb; + return this; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public Builder setDeprecated(DeprecationStatus deprecated) { + this.deprecated = deprecated; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getValidDiskSize() { + return validDiskSize; + } + + public Builder setValidDiskSize(String validDiskSize) { + this.validDiskSize = validDiskSize; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public DiskType build() { + + return new DiskType( + creationTimestamp, + defaultDiskSizeGb, + deprecated, + description, + id, + kind, + name, + region, + selfLink, + validDiskSize, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDefaultDiskSizeGb(this.defaultDiskSizeGb); + newBuilder.setDeprecated(this.deprecated); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setValidDiskSize(this.validDiskSize); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "DiskType{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "defaultDiskSizeGb=" + + defaultDiskSizeGb + + ", " + + "deprecated=" + + deprecated + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + ", " + + "validDiskSize=" + + validDiskSize + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DiskType) { + DiskType that = (DiskType) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.defaultDiskSizeGb, that.getDefaultDiskSizeGb()) + && Objects.equals(this.deprecated, that.getDeprecated()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.validDiskSize, that.getValidDiskSize()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + defaultDiskSizeGb, + deprecated, + description, + id, + kind, + name, + region, + selfLink, + validDiskSize, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeAggregatedList.java new file mode 100644 index 000000000000..74b9171c6866 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DiskTypeAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private DiskTypeAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private DiskTypeAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DiskTypeAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DiskTypeAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DiskTypeAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DiskTypeAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(DiskTypeAggregatedList other) { + if (other == DiskTypeAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(DiskTypeAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public DiskTypeAggregatedList build() { + + return new DiskTypeAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "DiskTypeAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DiskTypeAggregatedList) { + DiskTypeAggregatedList that = (DiskTypeAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeClient.java new file mode 100644 index 000000000000..402d0852a396 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeClient.java @@ -0,0 +1,710 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.DiskTypeStub; +import com.google.cloud.compute.v1.stub.DiskTypeStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+ *   ProjectZoneDiskTypeName diskType = ProjectZoneDiskTypeName.of("[PROJECT]", "[ZONE]", "[DISK_TYPE]");
+ *   DiskType response = diskTypeClient.getDiskType(diskType);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the diskTypeClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of DiskTypeSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * DiskTypeSettings diskTypeSettings =
+ *     DiskTypeSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * DiskTypeClient diskTypeClient =
+ *     DiskTypeClient.create(diskTypeSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * DiskTypeSettings diskTypeSettings =
+ *     DiskTypeSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * DiskTypeClient diskTypeClient =
+ *     DiskTypeClient.create(diskTypeSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DiskTypeClient implements BackgroundResource { + private final DiskTypeSettings settings; + private final DiskTypeStub stub; + + /** Constructs an instance of DiskTypeClient with default settings. */ + public static final DiskTypeClient create() throws IOException { + return create(DiskTypeSettings.newBuilder().build()); + } + + /** + * Constructs an instance of DiskTypeClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final DiskTypeClient create(DiskTypeSettings settings) throws IOException { + return new DiskTypeClient(settings); + } + + /** + * Constructs an instance of DiskTypeClient, using the given stub for making calls. This is for + * advanced usage - prefer to use DiskTypeSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final DiskTypeClient create(DiskTypeStub stub) { + return new DiskTypeClient(stub); + } + + /** + * Constructs an instance of DiskTypeClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected DiskTypeClient(DiskTypeSettings settings) throws IOException { + this.settings = settings; + this.stub = ((DiskTypeStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected DiskTypeClient(DiskTypeStub stub) { + this.settings = null; + this.stub = stub; + } + + public final DiskTypeSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public DiskTypeStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of disk types. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (DiskTypesScopedList element : diskTypeClient.aggregatedListDiskTypes(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListDiskTypesPagedResponse aggregatedListDiskTypes(ProjectName project) { + AggregatedListDiskTypesHttpRequest request = + AggregatedListDiskTypesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListDiskTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of disk types. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (DiskTypesScopedList element : diskTypeClient.aggregatedListDiskTypes(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListDiskTypesPagedResponse aggregatedListDiskTypes(String project) { + AggregatedListDiskTypesHttpRequest request = + AggregatedListDiskTypesHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListDiskTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of disk types. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListDiskTypesHttpRequest request = AggregatedListDiskTypesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (DiskTypesScopedList element : diskTypeClient.aggregatedListDiskTypes(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListDiskTypesPagedResponse aggregatedListDiskTypes( + AggregatedListDiskTypesHttpRequest request) { + return aggregatedListDiskTypesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of disk types. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListDiskTypesHttpRequest request = AggregatedListDiskTypesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListDiskTypesPagedResponse> future = diskTypeClient.aggregatedListDiskTypesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (DiskTypesScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListDiskTypesHttpRequest, AggregatedListDiskTypesPagedResponse> + aggregatedListDiskTypesPagedCallable() { + return stub.aggregatedListDiskTypesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of disk types. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListDiskTypesHttpRequest request = AggregatedListDiskTypesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     DiskTypeAggregatedList response = diskTypeClient.aggregatedListDiskTypesCallable().call(request);
+   *     for (DiskTypesScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListDiskTypesCallable() { + return stub.aggregatedListDiskTypesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified disk type. Gets a list of available disk types by making a list() + * request. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectZoneDiskTypeName diskType = ProjectZoneDiskTypeName.of("[PROJECT]", "[ZONE]", "[DISK_TYPE]");
+   *   DiskType response = diskTypeClient.getDiskType(diskType);
+   * }
+   * 
+ * + * @param diskType Name of the disk type to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final DiskType getDiskType(ProjectZoneDiskTypeName diskType) { + + GetDiskTypeHttpRequest request = + GetDiskTypeHttpRequest.newBuilder() + .setDiskType(diskType == null ? null : diskType.toString()) + .build(); + return getDiskType(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified disk type. Gets a list of available disk types by making a list() + * request. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectZoneDiskTypeName diskType = ProjectZoneDiskTypeName.of("[PROJECT]", "[ZONE]", "[DISK_TYPE]");
+   *   DiskType response = diskTypeClient.getDiskType(diskType.toString());
+   * }
+   * 
+ * + * @param diskType Name of the disk type to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final DiskType getDiskType(String diskType) { + + GetDiskTypeHttpRequest request = + GetDiskTypeHttpRequest.newBuilder().setDiskType(diskType).build(); + return getDiskType(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified disk type. Gets a list of available disk types by making a list() + * request. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectZoneDiskTypeName diskType = ProjectZoneDiskTypeName.of("[PROJECT]", "[ZONE]", "[DISK_TYPE]");
+   *   GetDiskTypeHttpRequest request = GetDiskTypeHttpRequest.newBuilder()
+   *     .setDiskType(diskType.toString())
+   *     .build();
+   *   DiskType response = diskTypeClient.getDiskType(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final DiskType getDiskType(GetDiskTypeHttpRequest request) { + return getDiskTypeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified disk type. Gets a list of available disk types by making a list() + * request. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectZoneDiskTypeName diskType = ProjectZoneDiskTypeName.of("[PROJECT]", "[ZONE]", "[DISK_TYPE]");
+   *   GetDiskTypeHttpRequest request = GetDiskTypeHttpRequest.newBuilder()
+   *     .setDiskType(diskType.toString())
+   *     .build();
+   *   ApiFuture<DiskType> future = diskTypeClient.getDiskTypeCallable().futureCall(request);
+   *   // Do something
+   *   DiskType response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getDiskTypeCallable() { + return stub.getDiskTypeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of disk types available to the specified project. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (DiskType element : diskTypeClient.listDiskTypes(zone).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListDiskTypesPagedResponse listDiskTypes(ProjectZoneName zone) { + ListDiskTypesHttpRequest request = + ListDiskTypesHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .build(); + return listDiskTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of disk types available to the specified project. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (DiskType element : diskTypeClient.listDiskTypes(zone.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListDiskTypesPagedResponse listDiskTypes(String zone) { + ListDiskTypesHttpRequest request = ListDiskTypesHttpRequest.newBuilder().setZone(zone).build(); + return listDiskTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of disk types available to the specified project. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListDiskTypesHttpRequest request = ListDiskTypesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   for (DiskType element : diskTypeClient.listDiskTypes(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListDiskTypesPagedResponse listDiskTypes(ListDiskTypesHttpRequest request) { + return listDiskTypesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of disk types available to the specified project. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListDiskTypesHttpRequest request = ListDiskTypesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   ApiFuture<ListDiskTypesPagedResponse> future = diskTypeClient.listDiskTypesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (DiskType element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listDiskTypesPagedCallable() { + return stub.listDiskTypesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of disk types available to the specified project. + * + *

Sample code: + * + *


+   * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListDiskTypesHttpRequest request = ListDiskTypesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   while (true) {
+   *     DiskTypeList response = diskTypeClient.listDiskTypesCallable().call(request);
+   *     for (DiskType element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listDiskTypesCallable() { + return stub.listDiskTypesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListDiskTypesPagedResponse + extends AbstractPagedListResponse< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, DiskTypesScopedList, + AggregatedListDiskTypesPage, AggregatedListDiskTypesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListDiskTypesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public AggregatedListDiskTypesPagedResponse apply(AggregatedListDiskTypesPage input) { + return new AggregatedListDiskTypesPagedResponse(input); + } + }); + } + + private AggregatedListDiskTypesPagedResponse(AggregatedListDiskTypesPage page) { + super(page, AggregatedListDiskTypesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListDiskTypesPage + extends AbstractPage< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, DiskTypesScopedList, + AggregatedListDiskTypesPage> { + + private AggregatedListDiskTypesPage( + PageContext + context, + DiskTypeAggregatedList response) { + super(context, response); + } + + private static AggregatedListDiskTypesPage createEmptyPage() { + return new AggregatedListDiskTypesPage(null, null); + } + + @Override + protected AggregatedListDiskTypesPage createPage( + PageContext + context, + DiskTypeAggregatedList response) { + return new AggregatedListDiskTypesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListDiskTypesFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, DiskTypesScopedList, + AggregatedListDiskTypesPage, AggregatedListDiskTypesFixedSizeCollection> { + + private AggregatedListDiskTypesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListDiskTypesFixedSizeCollection createEmptyCollection() { + return new AggregatedListDiskTypesFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListDiskTypesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListDiskTypesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListDiskTypesPagedResponse + extends AbstractPagedListResponse< + ListDiskTypesHttpRequest, DiskTypeList, DiskType, ListDiskTypesPage, + ListDiskTypesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListDiskTypesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListDiskTypesPagedResponse apply(ListDiskTypesPage input) { + return new ListDiskTypesPagedResponse(input); + } + }); + } + + private ListDiskTypesPagedResponse(ListDiskTypesPage page) { + super(page, ListDiskTypesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListDiskTypesPage + extends AbstractPage { + + private ListDiskTypesPage( + PageContext context, + DiskTypeList response) { + super(context, response); + } + + private static ListDiskTypesPage createEmptyPage() { + return new ListDiskTypesPage(null, null); + } + + @Override + protected ListDiskTypesPage createPage( + PageContext context, + DiskTypeList response) { + return new ListDiskTypesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListDiskTypesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListDiskTypesHttpRequest, DiskTypeList, DiskType, ListDiskTypesPage, + ListDiskTypesFixedSizeCollection> { + + private ListDiskTypesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListDiskTypesFixedSizeCollection createEmptyCollection() { + return new ListDiskTypesFixedSizeCollection(null, 0); + } + + @Override + protected ListDiskTypesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListDiskTypesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeList.java new file mode 100644 index 000000000000..c22ef5722ef9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DiskTypeList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private DiskTypeList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private DiskTypeList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DiskTypeList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DiskTypeList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DiskTypeList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DiskTypeList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(DiskTypeList other) { + if (other == DiskTypeList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(DiskTypeList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(DiskType items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public DiskTypeList build() { + + return new DiskTypeList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "DiskTypeList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DiskTypeList) { + DiskTypeList that = (DiskTypeList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeSettings.java new file mode 100644 index 000000000000..64dfe1d625a4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypeSettings.java @@ -0,0 +1,212 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.DiskTypeClient.AggregatedListDiskTypesPagedResponse; +import static com.google.cloud.compute.v1.DiskTypeClient.ListDiskTypesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.DiskTypeStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link DiskTypeClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getDiskType to 30 seconds: + * + *

+ * 
+ * DiskTypeSettings.Builder diskTypeSettingsBuilder =
+ *     DiskTypeSettings.newBuilder();
+ * diskTypeSettingsBuilder.getDiskTypeSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * DiskTypeSettings diskTypeSettings = diskTypeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DiskTypeSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListDiskTypes. */ + public PagedCallSettings< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, + AggregatedListDiskTypesPagedResponse> + aggregatedListDiskTypesSettings() { + return ((DiskTypeStubSettings) getStubSettings()).aggregatedListDiskTypesSettings(); + } + + /** Returns the object with the settings used for calls to getDiskType. */ + public UnaryCallSettings getDiskTypeSettings() { + return ((DiskTypeStubSettings) getStubSettings()).getDiskTypeSettings(); + } + + /** Returns the object with the settings used for calls to listDiskTypes. */ + public PagedCallSettings + listDiskTypesSettings() { + return ((DiskTypeStubSettings) getStubSettings()).listDiskTypesSettings(); + } + + public static final DiskTypeSettings create(DiskTypeStubSettings stub) throws IOException { + return new DiskTypeSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return DiskTypeStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return DiskTypeStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return DiskTypeStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DiskTypeStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return DiskTypeStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return DiskTypeStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return DiskTypeStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DiskTypeStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected DiskTypeSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for DiskTypeSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(DiskTypeStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(DiskTypeStubSettings.newBuilder()); + } + + protected Builder(DiskTypeSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(DiskTypeStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public DiskTypeStubSettings.Builder getStubSettingsBuilder() { + return ((DiskTypeStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListDiskTypes. */ + public PagedCallSettings.Builder< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, + AggregatedListDiskTypesPagedResponse> + aggregatedListDiskTypesSettings() { + return getStubSettingsBuilder().aggregatedListDiskTypesSettings(); + } + + /** Returns the builder for the settings used for calls to getDiskType. */ + public UnaryCallSettings.Builder getDiskTypeSettings() { + return getStubSettingsBuilder().getDiskTypeSettings(); + } + + /** Returns the builder for the settings used for calls to listDiskTypes. */ + public PagedCallSettings.Builder< + ListDiskTypesHttpRequest, DiskTypeList, ListDiskTypesPagedResponse> + listDiskTypesSettings() { + return getStubSettingsBuilder().listDiskTypesSettings(); + } + + @Override + public DiskTypeSettings build() throws IOException { + return new DiskTypeSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypesScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypesScopedList.java new file mode 100644 index 000000000000..130e23217f19 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskTypesScopedList.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DiskTypesScopedList implements ApiMessage { + private final List diskTypes; + private final Warning warning; + + private DiskTypesScopedList() { + this.diskTypes = null; + this.warning = null; + } + + private DiskTypesScopedList(List diskTypes, Warning warning) { + this.diskTypes = diskTypes; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("diskTypes")) { + return diskTypes; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getDiskTypesList() { + return diskTypes; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DiskTypesScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DiskTypesScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DiskTypesScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DiskTypesScopedList(); + } + + public static class Builder { + private List diskTypes; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(DiskTypesScopedList other) { + if (other == DiskTypesScopedList.getDefaultInstance()) return this; + if (other.getDiskTypesList() != null) { + this.diskTypes = other.diskTypes; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(DiskTypesScopedList source) { + this.diskTypes = source.diskTypes; + this.warning = source.warning; + } + + public List getDiskTypesList() { + return diskTypes; + } + + public Builder addAllDiskTypes(List diskTypes) { + if (this.diskTypes == null) { + this.diskTypes = new ArrayList<>(diskTypes.size()); + } + this.diskTypes.addAll(diskTypes); + return this; + } + + public Builder addDiskTypes(DiskType diskTypes) { + this.diskTypes.add(diskTypes); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public DiskTypesScopedList build() { + + return new DiskTypesScopedList(diskTypes, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllDiskTypes(this.diskTypes); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "DiskTypesScopedList{" + "diskTypes=" + diskTypes + ", " + "warning=" + warning + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DiskTypesScopedList) { + DiskTypesScopedList that = (DiskTypesScopedList) o; + return Objects.equals(this.diskTypes, that.getDiskTypesList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(diskTypes, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisksResizeRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisksResizeRequest.java new file mode 100644 index 000000000000..24b6df9cdd91 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisksResizeRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DisksResizeRequest implements ApiMessage { + private final String sizeGb; + + private DisksResizeRequest() { + this.sizeGb = null; + } + + private DisksResizeRequest(String sizeGb) { + this.sizeGb = sizeGb; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("sizeGb")) { + return sizeGb; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getSizeGb() { + return sizeGb; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DisksResizeRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DisksResizeRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DisksResizeRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DisksResizeRequest(); + } + + public static class Builder { + private String sizeGb; + + Builder() {} + + public Builder mergeFrom(DisksResizeRequest other) { + if (other == DisksResizeRequest.getDefaultInstance()) return this; + if (other.getSizeGb() != null) { + this.sizeGb = other.sizeGb; + } + return this; + } + + Builder(DisksResizeRequest source) { + this.sizeGb = source.sizeGb; + } + + public String getSizeGb() { + return sizeGb; + } + + public Builder setSizeGb(String sizeGb) { + this.sizeGb = sizeGb; + return this; + } + + public DisksResizeRequest build() { + return new DisksResizeRequest(sizeGb); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setSizeGb(this.sizeGb); + return newBuilder; + } + } + + @Override + public String toString() { + return "DisksResizeRequest{" + "sizeGb=" + sizeGb + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DisksResizeRequest) { + DisksResizeRequest that = (DisksResizeRequest) o; + return Objects.equals(this.sizeGb, that.getSizeGb()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(sizeGb); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisksScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisksScopedList.java new file mode 100644 index 000000000000..8efc36590961 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DisksScopedList.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DisksScopedList implements ApiMessage { + private final List disks; + private final Warning warning; + + private DisksScopedList() { + this.disks = null; + this.warning = null; + } + + private DisksScopedList(List disks, Warning warning) { + this.disks = disks; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("disks")) { + return disks; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getDisksList() { + return disks; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DisksScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DisksScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DisksScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DisksScopedList(); + } + + public static class Builder { + private List disks; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(DisksScopedList other) { + if (other == DisksScopedList.getDefaultInstance()) return this; + if (other.getDisksList() != null) { + this.disks = other.disks; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(DisksScopedList source) { + this.disks = source.disks; + this.warning = source.warning; + } + + public List getDisksList() { + return disks; + } + + public Builder addAllDisks(List disks) { + if (this.disks == null) { + this.disks = new ArrayList<>(disks.size()); + } + this.disks.addAll(disks); + return this; + } + + public Builder addDisks(Disk disks) { + this.disks.add(disks); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public DisksScopedList build() { + + return new DisksScopedList(disks, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllDisks(this.disks); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "DisksScopedList{" + "disks=" + disks + ", " + "warning=" + warning + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DisksScopedList) { + DisksScopedList that = (DisksScopedList) o; + return Objects.equals(this.disks, that.getDisksList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(disks, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/EnableXpnHostProjectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/EnableXpnHostProjectHttpRequest.java new file mode 100644 index 000000000000..439065cdbae3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/EnableXpnHostProjectHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class EnableXpnHostProjectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private EnableXpnHostProjectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private EnableXpnHostProjectHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(EnableXpnHostProjectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static EnableXpnHostProjectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final EnableXpnHostProjectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new EnableXpnHostProjectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(EnableXpnHostProjectHttpRequest other) { + if (other == EnableXpnHostProjectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(EnableXpnHostProjectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public EnableXpnHostProjectHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new EnableXpnHostProjectHttpRequest( + access_token, callback, fields, key, prettyPrint, project, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "EnableXpnHostProjectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof EnableXpnHostProjectHttpRequest) { + EnableXpnHostProjectHttpRequest that = (EnableXpnHostProjectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, project, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/EnableXpnResourceProjectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/EnableXpnResourceProjectHttpRequest.java new file mode 100644 index 000000000000..47b515ca4b1f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/EnableXpnResourceProjectHttpRequest.java @@ -0,0 +1,451 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class EnableXpnResourceProjectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private EnableXpnResourceProjectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.projectsEnableXpnResourceRequestResource = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private EnableXpnResourceProjectHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.projectsEnableXpnResourceRequestResource = projectsEnableXpnResourceRequestResource; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("projectsEnableXpnResourceRequestResource")) { + return projectsEnableXpnResourceRequestResource; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ProjectsEnableXpnResourceRequest getApiMessageRequestBody() { + return projectsEnableXpnResourceRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public ProjectsEnableXpnResourceRequest getProjectsEnableXpnResourceRequestResource() { + return projectsEnableXpnResourceRequestResource; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(EnableXpnResourceProjectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static EnableXpnResourceProjectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final EnableXpnResourceProjectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new EnableXpnResourceProjectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(EnableXpnResourceProjectHttpRequest other) { + if (other == EnableXpnResourceProjectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getProjectsEnableXpnResourceRequestResource() != null) { + this.projectsEnableXpnResourceRequestResource = + other.projectsEnableXpnResourceRequestResource; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(EnableXpnResourceProjectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.projectsEnableXpnResourceRequestResource = + source.projectsEnableXpnResourceRequestResource; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public ProjectsEnableXpnResourceRequest getProjectsEnableXpnResourceRequestResource() { + return projectsEnableXpnResourceRequestResource; + } + + public Builder setProjectsEnableXpnResourceRequestResource( + ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource) { + this.projectsEnableXpnResourceRequestResource = projectsEnableXpnResourceRequestResource; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public EnableXpnResourceProjectHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new EnableXpnResourceProjectHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + project, + projectsEnableXpnResourceRequestResource, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setProjectsEnableXpnResourceRequestResource( + this.projectsEnableXpnResourceRequestResource); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "EnableXpnResourceProjectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "projectsEnableXpnResourceRequestResource=" + + projectsEnableXpnResourceRequestResource + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof EnableXpnResourceProjectHttpRequest) { + EnableXpnResourceProjectHttpRequest that = (EnableXpnResourceProjectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals( + this.projectsEnableXpnResourceRequestResource, + that.getProjectsEnableXpnResourceRequestResource()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + project, + projectsEnableXpnResourceRequestResource, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Error.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Error.java new file mode 100644 index 000000000000..d725f174c601 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Error.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Error implements ApiMessage { + private final List errors; + + private Error() { + this.errors = null; + } + + private Error(List errors) { + this.errors = errors; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("errors")) { + return errors; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getErrorsList() { + return errors; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Error prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Error getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Error DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Error(); + } + + public static class Builder { + private List errors; + + Builder() {} + + public Builder mergeFrom(Error other) { + if (other == Error.getDefaultInstance()) return this; + if (other.getErrorsList() != null) { + this.errors = other.errors; + } + return this; + } + + Builder(Error source) { + this.errors = source.errors; + } + + public List getErrorsList() { + return errors; + } + + public Builder addAllErrors(List errors) { + if (this.errors == null) { + this.errors = new ArrayList<>(errors.size()); + } + this.errors.addAll(errors); + return this; + } + + public Builder addErrors(Errors errors) { + this.errors.add(errors); + return this; + } + + public Error build() { + return new Error(errors); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllErrors(this.errors); + return newBuilder; + } + } + + @Override + public String toString() { + return "Error{" + "errors=" + errors + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Error) { + Error that = (Error) o; + return Objects.equals(this.errors, that.getErrorsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(errors); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Errors.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Errors.java new file mode 100644 index 000000000000..2c492e0b4846 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Errors.java @@ -0,0 +1,204 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Errors implements ApiMessage { + private final String code; + private final String location; + private final String message; + + private Errors() { + this.code = null; + this.location = null; + this.message = null; + } + + private Errors(String code, String location, String message) { + this.code = code; + this.location = location; + this.message = message; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("code")) { + return code; + } + if (fieldName.equals("location")) { + return location; + } + if (fieldName.equals("message")) { + return message; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCode() { + return code; + } + + public String getLocation() { + return location; + } + + public String getMessage() { + return message; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Errors prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Errors getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Errors DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Errors(); + } + + public static class Builder { + private String code; + private String location; + private String message; + + Builder() {} + + public Builder mergeFrom(Errors other) { + if (other == Errors.getDefaultInstance()) return this; + if (other.getCode() != null) { + this.code = other.code; + } + if (other.getLocation() != null) { + this.location = other.location; + } + if (other.getMessage() != null) { + this.message = other.message; + } + return this; + } + + Builder(Errors source) { + this.code = source.code; + this.location = source.location; + this.message = source.message; + } + + public String getCode() { + return code; + } + + public Builder setCode(String code) { + this.code = code; + return this; + } + + public String getLocation() { + return location; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public String getMessage() { + return message; + } + + public Builder setMessage(String message) { + this.message = message; + return this; + } + + public Errors build() { + + return new Errors(code, location, message); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCode(this.code); + newBuilder.setLocation(this.location); + newBuilder.setMessage(this.message); + return newBuilder; + } + } + + @Override + public String toString() { + return "Errors{" + + "code=" + + code + + ", " + + "location=" + + location + + ", " + + "message=" + + message + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Errors) { + Errors that = (Errors) o; + return Objects.equals(this.code, that.getCode()) + && Objects.equals(this.location, that.getLocation()) + && Objects.equals(this.message, that.getMessage()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(code, location, message); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ExpandIpCidrRangeSubnetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ExpandIpCidrRangeSubnetworkHttpRequest.java new file mode 100644 index 000000000000..e0d913f58a59 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ExpandIpCidrRangeSubnetworkHttpRequest.java @@ -0,0 +1,452 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ExpandIpCidrRangeSubnetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String subnetwork; + private final SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource; + private final String userIp; + + private ExpandIpCidrRangeSubnetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.subnetwork = null; + this.subnetworksExpandIpCidrRangeRequestResource = null; + this.userIp = null; + } + + private ExpandIpCidrRangeSubnetworkHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String subnetwork, + SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.subnetwork = subnetwork; + this.subnetworksExpandIpCidrRangeRequestResource = subnetworksExpandIpCidrRangeRequestResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("subnetwork")) { + return subnetwork; + } + if (fieldName.equals("subnetworksExpandIpCidrRangeRequestResource")) { + return subnetworksExpandIpCidrRangeRequestResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public SubnetworksExpandIpCidrRangeRequest getApiMessageRequestBody() { + return subnetworksExpandIpCidrRangeRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getSubnetwork() { + return subnetwork; + } + + public SubnetworksExpandIpCidrRangeRequest getSubnetworksExpandIpCidrRangeRequestResource() { + return subnetworksExpandIpCidrRangeRequestResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ExpandIpCidrRangeSubnetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ExpandIpCidrRangeSubnetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ExpandIpCidrRangeSubnetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ExpandIpCidrRangeSubnetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String subnetwork; + private SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ExpandIpCidrRangeSubnetworkHttpRequest other) { + if (other == ExpandIpCidrRangeSubnetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSubnetwork() != null) { + this.subnetwork = other.subnetwork; + } + if (other.getSubnetworksExpandIpCidrRangeRequestResource() != null) { + this.subnetworksExpandIpCidrRangeRequestResource = + other.subnetworksExpandIpCidrRangeRequestResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ExpandIpCidrRangeSubnetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.subnetwork = source.subnetwork; + this.subnetworksExpandIpCidrRangeRequestResource = + source.subnetworksExpandIpCidrRangeRequestResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getSubnetwork() { + return subnetwork; + } + + public Builder setSubnetwork(String subnetwork) { + this.subnetwork = subnetwork; + return this; + } + + public SubnetworksExpandIpCidrRangeRequest getSubnetworksExpandIpCidrRangeRequestResource() { + return subnetworksExpandIpCidrRangeRequestResource; + } + + public Builder setSubnetworksExpandIpCidrRangeRequestResource( + SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource) { + this.subnetworksExpandIpCidrRangeRequestResource = + subnetworksExpandIpCidrRangeRequestResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ExpandIpCidrRangeSubnetworkHttpRequest build() { + String missing = ""; + + if (subnetwork == null) { + missing += " subnetwork"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ExpandIpCidrRangeSubnetworkHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + subnetwork, + subnetworksExpandIpCidrRangeRequestResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSubnetwork(this.subnetwork); + newBuilder.setSubnetworksExpandIpCidrRangeRequestResource( + this.subnetworksExpandIpCidrRangeRequestResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ExpandIpCidrRangeSubnetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "subnetwork=" + + subnetwork + + ", " + + "subnetworksExpandIpCidrRangeRequestResource=" + + subnetworksExpandIpCidrRangeRequestResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ExpandIpCidrRangeSubnetworkHttpRequest) { + ExpandIpCidrRangeSubnetworkHttpRequest that = (ExpandIpCidrRangeSubnetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.subnetwork, that.getSubnetwork()) + && Objects.equals( + this.subnetworksExpandIpCidrRangeRequestResource, + that.getSubnetworksExpandIpCidrRangeRequestResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + subnetwork, + subnetworksExpandIpCidrRangeRequestResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Firewall.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Firewall.java new file mode 100644 index 000000000000..752346813ce1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Firewall.java @@ -0,0 +1,726 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Firewall implements ApiMessage { + private final List allowed; + private final String creationTimestamp; + private final List denied; + private final String description; + private final List destinationRanges; + private final String direction; + private final String id; + private final String kind; + private final String name; + private final String network; + private final Integer priority; + private final String selfLink; + private final List sourceRanges; + private final List sourceServiceAccounts; + private final List sourceTags; + private final List targetServiceAccounts; + private final List targetTags; + + private Firewall() { + this.allowed = null; + this.creationTimestamp = null; + this.denied = null; + this.description = null; + this.destinationRanges = null; + this.direction = null; + this.id = null; + this.kind = null; + this.name = null; + this.network = null; + this.priority = null; + this.selfLink = null; + this.sourceRanges = null; + this.sourceServiceAccounts = null; + this.sourceTags = null; + this.targetServiceAccounts = null; + this.targetTags = null; + } + + private Firewall( + List allowed, + String creationTimestamp, + List denied, + String description, + List destinationRanges, + String direction, + String id, + String kind, + String name, + String network, + Integer priority, + String selfLink, + List sourceRanges, + List sourceServiceAccounts, + List sourceTags, + List targetServiceAccounts, + List targetTags) { + this.allowed = allowed; + this.creationTimestamp = creationTimestamp; + this.denied = denied; + this.description = description; + this.destinationRanges = destinationRanges; + this.direction = direction; + this.id = id; + this.kind = kind; + this.name = name; + this.network = network; + this.priority = priority; + this.selfLink = selfLink; + this.sourceRanges = sourceRanges; + this.sourceServiceAccounts = sourceServiceAccounts; + this.sourceTags = sourceTags; + this.targetServiceAccounts = targetServiceAccounts; + this.targetTags = targetTags; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("allowed")) { + return allowed; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("denied")) { + return denied; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("destinationRanges")) { + return destinationRanges; + } + if (fieldName.equals("direction")) { + return direction; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("priority")) { + return priority; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("sourceRanges")) { + return sourceRanges; + } + if (fieldName.equals("sourceServiceAccounts")) { + return sourceServiceAccounts; + } + if (fieldName.equals("sourceTags")) { + return sourceTags; + } + if (fieldName.equals("targetServiceAccounts")) { + return targetServiceAccounts; + } + if (fieldName.equals("targetTags")) { + return targetTags; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getAllowedList() { + return allowed; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public List getDeniedList() { + return denied; + } + + public String getDescription() { + return description; + } + + public List getDestinationRangesList() { + return destinationRanges; + } + + public String getDirection() { + return direction; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getNetwork() { + return network; + } + + public Integer getPriority() { + return priority; + } + + public String getSelfLink() { + return selfLink; + } + + public List getSourceRangesList() { + return sourceRanges; + } + + public List getSourceServiceAccountsList() { + return sourceServiceAccounts; + } + + public List getSourceTagsList() { + return sourceTags; + } + + public List getTargetServiceAccountsList() { + return targetServiceAccounts; + } + + public List getTargetTagsList() { + return targetTags; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Firewall prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Firewall getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Firewall DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Firewall(); + } + + public static class Builder { + private List allowed; + private String creationTimestamp; + private List denied; + private String description; + private List destinationRanges; + private String direction; + private String id; + private String kind; + private String name; + private String network; + private Integer priority; + private String selfLink; + private List sourceRanges; + private List sourceServiceAccounts; + private List sourceTags; + private List targetServiceAccounts; + private List targetTags; + + Builder() {} + + public Builder mergeFrom(Firewall other) { + if (other == Firewall.getDefaultInstance()) return this; + if (other.getAllowedList() != null) { + this.allowed = other.allowed; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDeniedList() != null) { + this.denied = other.denied; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getDestinationRangesList() != null) { + this.destinationRanges = other.destinationRanges; + } + if (other.getDirection() != null) { + this.direction = other.direction; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getPriority() != null) { + this.priority = other.priority; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSourceRangesList() != null) { + this.sourceRanges = other.sourceRanges; + } + if (other.getSourceServiceAccountsList() != null) { + this.sourceServiceAccounts = other.sourceServiceAccounts; + } + if (other.getSourceTagsList() != null) { + this.sourceTags = other.sourceTags; + } + if (other.getTargetServiceAccountsList() != null) { + this.targetServiceAccounts = other.targetServiceAccounts; + } + if (other.getTargetTagsList() != null) { + this.targetTags = other.targetTags; + } + return this; + } + + Builder(Firewall source) { + this.allowed = source.allowed; + this.creationTimestamp = source.creationTimestamp; + this.denied = source.denied; + this.description = source.description; + this.destinationRanges = source.destinationRanges; + this.direction = source.direction; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.network = source.network; + this.priority = source.priority; + this.selfLink = source.selfLink; + this.sourceRanges = source.sourceRanges; + this.sourceServiceAccounts = source.sourceServiceAccounts; + this.sourceTags = source.sourceTags; + this.targetServiceAccounts = source.targetServiceAccounts; + this.targetTags = source.targetTags; + } + + public List getAllowedList() { + return allowed; + } + + public Builder addAllAllowed(List allowed) { + if (this.allowed == null) { + this.allowed = new ArrayList<>(allowed.size()); + } + this.allowed.addAll(allowed); + return this; + } + + public Builder addAllowed(Allowed allowed) { + this.allowed.add(allowed); + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public List getDeniedList() { + return denied; + } + + public Builder addAllDenied(List denied) { + if (this.denied == null) { + this.denied = new ArrayList<>(denied.size()); + } + this.denied.addAll(denied); + return this; + } + + public Builder addDenied(Denied denied) { + this.denied.add(denied); + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public List getDestinationRangesList() { + return destinationRanges; + } + + public Builder addAllDestinationRanges(List destinationRanges) { + if (this.destinationRanges == null) { + this.destinationRanges = new ArrayList<>(destinationRanges.size()); + } + this.destinationRanges.addAll(destinationRanges); + return this; + } + + public Builder addDestinationRanges(String destinationRanges) { + this.destinationRanges.add(destinationRanges); + return this; + } + + public String getDirection() { + return direction; + } + + public Builder setDirection(String direction) { + this.direction = direction; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public Integer getPriority() { + return priority; + } + + public Builder setPriority(Integer priority) { + this.priority = priority; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public List getSourceRangesList() { + return sourceRanges; + } + + public Builder addAllSourceRanges(List sourceRanges) { + if (this.sourceRanges == null) { + this.sourceRanges = new ArrayList<>(sourceRanges.size()); + } + this.sourceRanges.addAll(sourceRanges); + return this; + } + + public Builder addSourceRanges(String sourceRanges) { + this.sourceRanges.add(sourceRanges); + return this; + } + + public List getSourceServiceAccountsList() { + return sourceServiceAccounts; + } + + public Builder addAllSourceServiceAccounts(List sourceServiceAccounts) { + if (this.sourceServiceAccounts == null) { + this.sourceServiceAccounts = new ArrayList<>(sourceServiceAccounts.size()); + } + this.sourceServiceAccounts.addAll(sourceServiceAccounts); + return this; + } + + public Builder addSourceServiceAccounts(String sourceServiceAccounts) { + this.sourceServiceAccounts.add(sourceServiceAccounts); + return this; + } + + public List getSourceTagsList() { + return sourceTags; + } + + public Builder addAllSourceTags(List sourceTags) { + if (this.sourceTags == null) { + this.sourceTags = new ArrayList<>(sourceTags.size()); + } + this.sourceTags.addAll(sourceTags); + return this; + } + + public Builder addSourceTags(String sourceTags) { + this.sourceTags.add(sourceTags); + return this; + } + + public List getTargetServiceAccountsList() { + return targetServiceAccounts; + } + + public Builder addAllTargetServiceAccounts(List targetServiceAccounts) { + if (this.targetServiceAccounts == null) { + this.targetServiceAccounts = new ArrayList<>(targetServiceAccounts.size()); + } + this.targetServiceAccounts.addAll(targetServiceAccounts); + return this; + } + + public Builder addTargetServiceAccounts(String targetServiceAccounts) { + this.targetServiceAccounts.add(targetServiceAccounts); + return this; + } + + public List getTargetTagsList() { + return targetTags; + } + + public Builder addAllTargetTags(List targetTags) { + if (this.targetTags == null) { + this.targetTags = new ArrayList<>(targetTags.size()); + } + this.targetTags.addAll(targetTags); + return this; + } + + public Builder addTargetTags(String targetTags) { + this.targetTags.add(targetTags); + return this; + } + + public Firewall build() { + + return new Firewall( + allowed, + creationTimestamp, + denied, + description, + destinationRanges, + direction, + id, + kind, + name, + network, + priority, + selfLink, + sourceRanges, + sourceServiceAccounts, + sourceTags, + targetServiceAccounts, + targetTags); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllAllowed(this.allowed); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.addAllDenied(this.denied); + newBuilder.setDescription(this.description); + newBuilder.addAllDestinationRanges(this.destinationRanges); + newBuilder.setDirection(this.direction); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setNetwork(this.network); + newBuilder.setPriority(this.priority); + newBuilder.setSelfLink(this.selfLink); + newBuilder.addAllSourceRanges(this.sourceRanges); + newBuilder.addAllSourceServiceAccounts(this.sourceServiceAccounts); + newBuilder.addAllSourceTags(this.sourceTags); + newBuilder.addAllTargetServiceAccounts(this.targetServiceAccounts); + newBuilder.addAllTargetTags(this.targetTags); + return newBuilder; + } + } + + @Override + public String toString() { + return "Firewall{" + + "allowed=" + + allowed + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "denied=" + + denied + + ", " + + "description=" + + description + + ", " + + "destinationRanges=" + + destinationRanges + + ", " + + "direction=" + + direction + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "network=" + + network + + ", " + + "priority=" + + priority + + ", " + + "selfLink=" + + selfLink + + ", " + + "sourceRanges=" + + sourceRanges + + ", " + + "sourceServiceAccounts=" + + sourceServiceAccounts + + ", " + + "sourceTags=" + + sourceTags + + ", " + + "targetServiceAccounts=" + + targetServiceAccounts + + ", " + + "targetTags=" + + targetTags + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Firewall) { + Firewall that = (Firewall) o; + return Objects.equals(this.allowed, that.getAllowedList()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.denied, that.getDeniedList()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.destinationRanges, that.getDestinationRangesList()) + && Objects.equals(this.direction, that.getDirection()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.priority, that.getPriority()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.sourceRanges, that.getSourceRangesList()) + && Objects.equals(this.sourceServiceAccounts, that.getSourceServiceAccountsList()) + && Objects.equals(this.sourceTags, that.getSourceTagsList()) + && Objects.equals(this.targetServiceAccounts, that.getTargetServiceAccountsList()) + && Objects.equals(this.targetTags, that.getTargetTagsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + allowed, + creationTimestamp, + denied, + description, + destinationRanges, + direction, + id, + kind, + name, + network, + priority, + selfLink, + sourceRanges, + sourceServiceAccounts, + sourceTags, + targetServiceAccounts, + targetTags); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java new file mode 100644 index 000000000000..73125d7aa21c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java @@ -0,0 +1,926 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.FirewallStub; +import com.google.cloud.compute.v1.stub.FirewallStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (FirewallClient firewallClient = FirewallClient.create()) {
+ *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+ *   Operation response = firewallClient.deleteFirewall(firewall);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the firewallClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of FirewallSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * FirewallSettings firewallSettings =
+ *     FirewallSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * FirewallClient firewallClient =
+ *     FirewallClient.create(firewallSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * FirewallSettings firewallSettings =
+ *     FirewallSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * FirewallClient firewallClient =
+ *     FirewallClient.create(firewallSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class FirewallClient implements BackgroundResource { + private final FirewallSettings settings; + private final FirewallStub stub; + + /** Constructs an instance of FirewallClient with default settings. */ + public static final FirewallClient create() throws IOException { + return create(FirewallSettings.newBuilder().build()); + } + + /** + * Constructs an instance of FirewallClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final FirewallClient create(FirewallSettings settings) throws IOException { + return new FirewallClient(settings); + } + + /** + * Constructs an instance of FirewallClient, using the given stub for making calls. This is for + * advanced usage - prefer to use FirewallSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final FirewallClient create(FirewallStub stub) { + return new FirewallClient(stub); + } + + /** + * Constructs an instance of FirewallClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected FirewallClient(FirewallSettings settings) throws IOException { + this.settings = settings; + this.stub = ((FirewallStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected FirewallClient(FirewallStub stub) { + this.settings = null; + this.stub = stub; + } + + public final FirewallSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public FirewallStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified firewall. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Operation response = firewallClient.deleteFirewall(firewall);
+   * }
+   * 
+ * + * @param firewall Name of the firewall rule to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteFirewall(ProjectGlobalFirewallName firewall) { + + DeleteFirewallHttpRequest request = + DeleteFirewallHttpRequest.newBuilder() + .setFirewall(firewall == null ? null : firewall.toString()) + .build(); + return deleteFirewall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified firewall. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Operation response = firewallClient.deleteFirewall(firewall.toString());
+   * }
+   * 
+ * + * @param firewall Name of the firewall rule to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteFirewall(String firewall) { + + DeleteFirewallHttpRequest request = + DeleteFirewallHttpRequest.newBuilder().setFirewall(firewall).build(); + return deleteFirewall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified firewall. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   DeleteFirewallHttpRequest request = DeleteFirewallHttpRequest.newBuilder()
+   *     .setFirewall(firewall.toString())
+   *     .build();
+   *   Operation response = firewallClient.deleteFirewall(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteFirewall(DeleteFirewallHttpRequest request) { + return deleteFirewallCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified firewall. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   DeleteFirewallHttpRequest request = DeleteFirewallHttpRequest.newBuilder()
+   *     .setFirewall(firewall.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = firewallClient.deleteFirewallCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteFirewallCallable() { + return stub.deleteFirewallCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified firewall. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Firewall response = firewallClient.getFirewall(firewall);
+   * }
+   * 
+ * + * @param firewall Name of the firewall rule to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Firewall getFirewall(ProjectGlobalFirewallName firewall) { + + GetFirewallHttpRequest request = + GetFirewallHttpRequest.newBuilder() + .setFirewall(firewall == null ? null : firewall.toString()) + .build(); + return getFirewall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified firewall. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Firewall response = firewallClient.getFirewall(firewall.toString());
+   * }
+   * 
+ * + * @param firewall Name of the firewall rule to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Firewall getFirewall(String firewall) { + + GetFirewallHttpRequest request = + GetFirewallHttpRequest.newBuilder().setFirewall(firewall).build(); + return getFirewall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified firewall. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   GetFirewallHttpRequest request = GetFirewallHttpRequest.newBuilder()
+   *     .setFirewall(firewall.toString())
+   *     .build();
+   *   Firewall response = firewallClient.getFirewall(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Firewall getFirewall(GetFirewallHttpRequest request) { + return getFirewallCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified firewall. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   GetFirewallHttpRequest request = GetFirewallHttpRequest.newBuilder()
+   *     .setFirewall(firewall.toString())
+   *     .build();
+   *   ApiFuture<Firewall> future = firewallClient.getFirewallCallable().futureCall(request);
+   *   // Do something
+   *   Firewall response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getFirewallCallable() { + return stub.getFirewallCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a firewall rule in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   Operation response = firewallClient.insertFirewall(project, firewallResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param firewallResource Represents a Firewall resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertFirewall(ProjectName project, Firewall firewallResource) { + + InsertFirewallHttpRequest request = + InsertFirewallHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setFirewallResource(firewallResource) + .build(); + return insertFirewall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a firewall rule in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   Operation response = firewallClient.insertFirewall(project.toString(), firewallResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param firewallResource Represents a Firewall resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertFirewall(String project, Firewall firewallResource) { + + InsertFirewallHttpRequest request = + InsertFirewallHttpRequest.newBuilder() + .setProject(project) + .setFirewallResource(firewallResource) + .build(); + return insertFirewall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a firewall rule in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   InsertFirewallHttpRequest request = InsertFirewallHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setFirewallResource(firewallResource)
+   *     .build();
+   *   Operation response = firewallClient.insertFirewall(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertFirewall(InsertFirewallHttpRequest request) { + return insertFirewallCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a firewall rule in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   InsertFirewallHttpRequest request = InsertFirewallHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setFirewallResource(firewallResource)
+   *     .build();
+   *   ApiFuture<Operation> future = firewallClient.insertFirewallCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertFirewallCallable() { + return stub.insertFirewallCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of firewall rules available to the specified project. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Firewall element : firewallClient.listFirewalls(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListFirewallsPagedResponse listFirewalls(ProjectName project) { + ListFirewallsHttpRequest request = + ListFirewallsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listFirewalls(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of firewall rules available to the specified project. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Firewall element : firewallClient.listFirewalls(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListFirewallsPagedResponse listFirewalls(String project) { + ListFirewallsHttpRequest request = + ListFirewallsHttpRequest.newBuilder().setProject(project).build(); + return listFirewalls(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of firewall rules available to the specified project. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListFirewallsHttpRequest request = ListFirewallsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (Firewall element : firewallClient.listFirewalls(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListFirewallsPagedResponse listFirewalls(ListFirewallsHttpRequest request) { + return listFirewallsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of firewall rules available to the specified project. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListFirewallsHttpRequest request = ListFirewallsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListFirewallsPagedResponse> future = firewallClient.listFirewallsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Firewall element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listFirewallsPagedCallable() { + return stub.listFirewallsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of firewall rules available to the specified project. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListFirewallsHttpRequest request = ListFirewallsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     FirewallList response = firewallClient.listFirewallsCallable().call(request);
+   *     for (Firewall element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listFirewallsCallable() { + return stub.listFirewallsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified firewall rule with the data included in the request. This method supports + * PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   Operation response = firewallClient.patchFirewall(firewall, firewallResource);
+   * }
+   * 
+ * + * @param firewall Name of the firewall rule to patch. + * @param firewallResource Represents a Firewall resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchFirewall( + ProjectGlobalFirewallName firewall, Firewall firewallResource) { + + PatchFirewallHttpRequest request = + PatchFirewallHttpRequest.newBuilder() + .setFirewall(firewall == null ? null : firewall.toString()) + .setFirewallResource(firewallResource) + .build(); + return patchFirewall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified firewall rule with the data included in the request. This method supports + * PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   Operation response = firewallClient.patchFirewall(firewall.toString(), firewallResource);
+   * }
+   * 
+ * + * @param firewall Name of the firewall rule to patch. + * @param firewallResource Represents a Firewall resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchFirewall(String firewall, Firewall firewallResource) { + + PatchFirewallHttpRequest request = + PatchFirewallHttpRequest.newBuilder() + .setFirewall(firewall) + .setFirewallResource(firewallResource) + .build(); + return patchFirewall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified firewall rule with the data included in the request. This method supports + * PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   PatchFirewallHttpRequest request = PatchFirewallHttpRequest.newBuilder()
+   *     .setFirewall(firewall.toString())
+   *     .setFirewallResource(firewallResource)
+   *     .build();
+   *   Operation response = firewallClient.patchFirewall(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchFirewall(PatchFirewallHttpRequest request) { + return patchFirewallCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified firewall rule with the data included in the request. This method supports + * PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   PatchFirewallHttpRequest request = PatchFirewallHttpRequest.newBuilder()
+   *     .setFirewall(firewall.toString())
+   *     .setFirewallResource(firewallResource)
+   *     .build();
+   *   ApiFuture<Operation> future = firewallClient.patchFirewallCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable patchFirewallCallable() { + return stub.patchFirewallCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified firewall rule with the data included in the request. The PUT method can + * only update the following fields of firewall rule: allowed, description, sourceRanges, + * sourceTags, targetTags. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   Operation response = firewallClient.updateFirewall(firewall, firewallResource);
+   * }
+   * 
+ * + * @param firewall Name of the firewall rule to update. + * @param firewallResource Represents a Firewall resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateFirewall( + ProjectGlobalFirewallName firewall, Firewall firewallResource) { + + UpdateFirewallHttpRequest request = + UpdateFirewallHttpRequest.newBuilder() + .setFirewall(firewall == null ? null : firewall.toString()) + .setFirewallResource(firewallResource) + .build(); + return updateFirewall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified firewall rule with the data included in the request. The PUT method can + * only update the following fields of firewall rule: allowed, description, sourceRanges, + * sourceTags, targetTags. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   Operation response = firewallClient.updateFirewall(firewall.toString(), firewallResource);
+   * }
+   * 
+ * + * @param firewall Name of the firewall rule to update. + * @param firewallResource Represents a Firewall resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateFirewall(String firewall, Firewall firewallResource) { + + UpdateFirewallHttpRequest request = + UpdateFirewallHttpRequest.newBuilder() + .setFirewall(firewall) + .setFirewallResource(firewallResource) + .build(); + return updateFirewall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified firewall rule with the data included in the request. The PUT method can + * only update the following fields of firewall rule: allowed, description, sourceRanges, + * sourceTags, targetTags. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   UpdateFirewallHttpRequest request = UpdateFirewallHttpRequest.newBuilder()
+   *     .setFirewall(firewall.toString())
+   *     .setFirewallResource(firewallResource)
+   *     .build();
+   *   Operation response = firewallClient.updateFirewall(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateFirewall(UpdateFirewallHttpRequest request) { + return updateFirewallCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified firewall rule with the data included in the request. The PUT method can + * only update the following fields of firewall rule: allowed, description, sourceRanges, + * sourceTags, targetTags. + * + *

Sample code: + * + *


+   * try (FirewallClient firewallClient = FirewallClient.create()) {
+   *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+   *   Firewall firewallResource = Firewall.newBuilder().build();
+   *   UpdateFirewallHttpRequest request = UpdateFirewallHttpRequest.newBuilder()
+   *     .setFirewall(firewall.toString())
+   *     .setFirewallResource(firewallResource)
+   *     .build();
+   *   ApiFuture<Operation> future = firewallClient.updateFirewallCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable updateFirewallCallable() { + return stub.updateFirewallCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListFirewallsPagedResponse + extends AbstractPagedListResponse< + ListFirewallsHttpRequest, FirewallList, Firewall, ListFirewallsPage, + ListFirewallsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListFirewallsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListFirewallsPagedResponse apply(ListFirewallsPage input) { + return new ListFirewallsPagedResponse(input); + } + }); + } + + private ListFirewallsPagedResponse(ListFirewallsPage page) { + super(page, ListFirewallsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListFirewallsPage + extends AbstractPage { + + private ListFirewallsPage( + PageContext context, + FirewallList response) { + super(context, response); + } + + private static ListFirewallsPage createEmptyPage() { + return new ListFirewallsPage(null, null); + } + + @Override + protected ListFirewallsPage createPage( + PageContext context, + FirewallList response) { + return new ListFirewallsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListFirewallsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListFirewallsHttpRequest, FirewallList, Firewall, ListFirewallsPage, + ListFirewallsFixedSizeCollection> { + + private ListFirewallsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListFirewallsFixedSizeCollection createEmptyCollection() { + return new ListFirewallsFixedSizeCollection(null, 0); + } + + @Override + protected ListFirewallsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListFirewallsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallList.java new file mode 100644 index 000000000000..f21ec79e0701 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class FirewallList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private FirewallList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private FirewallList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(FirewallList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static FirewallList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final FirewallList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new FirewallList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(FirewallList other) { + if (other == FirewallList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(FirewallList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Firewall items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public FirewallList build() { + + return new FirewallList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "FirewallList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof FirewallList) { + FirewallList that = (FirewallList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallSettings.java new file mode 100644 index 000000000000..2a0f327e0953 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallSettings.java @@ -0,0 +1,238 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.FirewallClient.ListFirewallsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.FirewallStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link FirewallClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteFirewall to 30 seconds: + * + *

+ * 
+ * FirewallSettings.Builder firewallSettingsBuilder =
+ *     FirewallSettings.newBuilder();
+ * firewallSettingsBuilder.deleteFirewallSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * FirewallSettings firewallSettings = firewallSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class FirewallSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteFirewall. */ + public UnaryCallSettings deleteFirewallSettings() { + return ((FirewallStubSettings) getStubSettings()).deleteFirewallSettings(); + } + + /** Returns the object with the settings used for calls to getFirewall. */ + public UnaryCallSettings getFirewallSettings() { + return ((FirewallStubSettings) getStubSettings()).getFirewallSettings(); + } + + /** Returns the object with the settings used for calls to insertFirewall. */ + public UnaryCallSettings insertFirewallSettings() { + return ((FirewallStubSettings) getStubSettings()).insertFirewallSettings(); + } + + /** Returns the object with the settings used for calls to listFirewalls. */ + public PagedCallSettings + listFirewallsSettings() { + return ((FirewallStubSettings) getStubSettings()).listFirewallsSettings(); + } + + /** Returns the object with the settings used for calls to patchFirewall. */ + public UnaryCallSettings patchFirewallSettings() { + return ((FirewallStubSettings) getStubSettings()).patchFirewallSettings(); + } + + /** Returns the object with the settings used for calls to updateFirewall. */ + public UnaryCallSettings updateFirewallSettings() { + return ((FirewallStubSettings) getStubSettings()).updateFirewallSettings(); + } + + public static final FirewallSettings create(FirewallStubSettings stub) throws IOException { + return new FirewallSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return FirewallStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return FirewallStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return FirewallStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return FirewallStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return FirewallStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return FirewallStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return FirewallStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return FirewallStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected FirewallSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for FirewallSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(FirewallStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(FirewallStubSettings.newBuilder()); + } + + protected Builder(FirewallSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(FirewallStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public FirewallStubSettings.Builder getStubSettingsBuilder() { + return ((FirewallStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteFirewall. */ + public UnaryCallSettings.Builder + deleteFirewallSettings() { + return getStubSettingsBuilder().deleteFirewallSettings(); + } + + /** Returns the builder for the settings used for calls to getFirewall. */ + public UnaryCallSettings.Builder getFirewallSettings() { + return getStubSettingsBuilder().getFirewallSettings(); + } + + /** Returns the builder for the settings used for calls to insertFirewall. */ + public UnaryCallSettings.Builder + insertFirewallSettings() { + return getStubSettingsBuilder().insertFirewallSettings(); + } + + /** Returns the builder for the settings used for calls to listFirewalls. */ + public PagedCallSettings.Builder< + ListFirewallsHttpRequest, FirewallList, ListFirewallsPagedResponse> + listFirewallsSettings() { + return getStubSettingsBuilder().listFirewallsSettings(); + } + + /** Returns the builder for the settings used for calls to patchFirewall. */ + public UnaryCallSettings.Builder patchFirewallSettings() { + return getStubSettingsBuilder().patchFirewallSettings(); + } + + /** Returns the builder for the settings used for calls to updateFirewall. */ + public UnaryCallSettings.Builder + updateFirewallSettings() { + return getStubSettingsBuilder().updateFirewallSettings(); + } + + @Override + public FirewallSettings build() throws IOException { + return new FirewallSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRule.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRule.java new file mode 100644 index 000000000000..e098464b0dde --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRule.java @@ -0,0 +1,670 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ForwardingRule implements ApiMessage { + private final String backendService; + private final String creationTimestamp; + private final String description; + private final String iPAddress; + private final String iPProtocol; + private final String id; + private final String ipVersion; + private final String kind; + private final String loadBalancingScheme; + private final String name; + private final String network; + private final String portRange; + private final List ports; + private final String region; + private final String selfLink; + private final String subnetwork; + private final String target; + + private ForwardingRule() { + this.backendService = null; + this.creationTimestamp = null; + this.description = null; + this.iPAddress = null; + this.iPProtocol = null; + this.id = null; + this.ipVersion = null; + this.kind = null; + this.loadBalancingScheme = null; + this.name = null; + this.network = null; + this.portRange = null; + this.ports = null; + this.region = null; + this.selfLink = null; + this.subnetwork = null; + this.target = null; + } + + private ForwardingRule( + String backendService, + String creationTimestamp, + String description, + String iPAddress, + String iPProtocol, + String id, + String ipVersion, + String kind, + String loadBalancingScheme, + String name, + String network, + String portRange, + List ports, + String region, + String selfLink, + String subnetwork, + String target) { + this.backendService = backendService; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.iPAddress = iPAddress; + this.iPProtocol = iPProtocol; + this.id = id; + this.ipVersion = ipVersion; + this.kind = kind; + this.loadBalancingScheme = loadBalancingScheme; + this.name = name; + this.network = network; + this.portRange = portRange; + this.ports = ports; + this.region = region; + this.selfLink = selfLink; + this.subnetwork = subnetwork; + this.target = target; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("backendService")) { + return backendService; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("iPAddress")) { + return iPAddress; + } + if (fieldName.equals("iPProtocol")) { + return iPProtocol; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("ipVersion")) { + return ipVersion; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("loadBalancingScheme")) { + return loadBalancingScheme; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("portRange")) { + return portRange; + } + if (fieldName.equals("ports")) { + return ports; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("subnetwork")) { + return subnetwork; + } + if (fieldName.equals("target")) { + return target; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getBackendService() { + return backendService; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getIPAddress() { + return iPAddress; + } + + public String getIPProtocol() { + return iPProtocol; + } + + public String getId() { + return id; + } + + public String getIpVersion() { + return ipVersion; + } + + public String getKind() { + return kind; + } + + public String getLoadBalancingScheme() { + return loadBalancingScheme; + } + + public String getName() { + return name; + } + + public String getNetwork() { + return network; + } + + public String getPortRange() { + return portRange; + } + + public List getPortsList() { + return ports; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public String getSubnetwork() { + return subnetwork; + } + + public String getTarget() { + return target; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ForwardingRule prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ForwardingRule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ForwardingRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ForwardingRule(); + } + + public static class Builder { + private String backendService; + private String creationTimestamp; + private String description; + private String iPAddress; + private String iPProtocol; + private String id; + private String ipVersion; + private String kind; + private String loadBalancingScheme; + private String name; + private String network; + private String portRange; + private List ports; + private String region; + private String selfLink; + private String subnetwork; + private String target; + + Builder() {} + + public Builder mergeFrom(ForwardingRule other) { + if (other == ForwardingRule.getDefaultInstance()) return this; + if (other.getBackendService() != null) { + this.backendService = other.backendService; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getIPAddress() != null) { + this.iPAddress = other.iPAddress; + } + if (other.getIPProtocol() != null) { + this.iPProtocol = other.iPProtocol; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getIpVersion() != null) { + this.ipVersion = other.ipVersion; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getLoadBalancingScheme() != null) { + this.loadBalancingScheme = other.loadBalancingScheme; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getPortRange() != null) { + this.portRange = other.portRange; + } + if (other.getPortsList() != null) { + this.ports = other.ports; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSubnetwork() != null) { + this.subnetwork = other.subnetwork; + } + if (other.getTarget() != null) { + this.target = other.target; + } + return this; + } + + Builder(ForwardingRule source) { + this.backendService = source.backendService; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.iPAddress = source.iPAddress; + this.iPProtocol = source.iPProtocol; + this.id = source.id; + this.ipVersion = source.ipVersion; + this.kind = source.kind; + this.loadBalancingScheme = source.loadBalancingScheme; + this.name = source.name; + this.network = source.network; + this.portRange = source.portRange; + this.ports = source.ports; + this.region = source.region; + this.selfLink = source.selfLink; + this.subnetwork = source.subnetwork; + this.target = source.target; + } + + public String getBackendService() { + return backendService; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getIPAddress() { + return iPAddress; + } + + public Builder setIPAddress(String iPAddress) { + this.iPAddress = iPAddress; + return this; + } + + public String getIPProtocol() { + return iPProtocol; + } + + public Builder setIPProtocol(String iPProtocol) { + this.iPProtocol = iPProtocol; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getIpVersion() { + return ipVersion; + } + + public Builder setIpVersion(String ipVersion) { + this.ipVersion = ipVersion; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getLoadBalancingScheme() { + return loadBalancingScheme; + } + + public Builder setLoadBalancingScheme(String loadBalancingScheme) { + this.loadBalancingScheme = loadBalancingScheme; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public String getPortRange() { + return portRange; + } + + public Builder setPortRange(String portRange) { + this.portRange = portRange; + return this; + } + + public List getPortsList() { + return ports; + } + + public Builder addAllPorts(List ports) { + if (this.ports == null) { + this.ports = new ArrayList<>(ports.size()); + } + this.ports.addAll(ports); + return this; + } + + public Builder addPorts(String ports) { + this.ports.add(ports); + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getSubnetwork() { + return subnetwork; + } + + public Builder setSubnetwork(String subnetwork) { + this.subnetwork = subnetwork; + return this; + } + + public String getTarget() { + return target; + } + + public Builder setTarget(String target) { + this.target = target; + return this; + } + + public ForwardingRule build() { + + return new ForwardingRule( + backendService, + creationTimestamp, + description, + iPAddress, + iPProtocol, + id, + ipVersion, + kind, + loadBalancingScheme, + name, + network, + portRange, + ports, + region, + selfLink, + subnetwork, + target); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setBackendService(this.backendService); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setIPAddress(this.iPAddress); + newBuilder.setIPProtocol(this.iPProtocol); + newBuilder.setId(this.id); + newBuilder.setIpVersion(this.ipVersion); + newBuilder.setKind(this.kind); + newBuilder.setLoadBalancingScheme(this.loadBalancingScheme); + newBuilder.setName(this.name); + newBuilder.setNetwork(this.network); + newBuilder.setPortRange(this.portRange); + newBuilder.addAllPorts(this.ports); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setSubnetwork(this.subnetwork); + newBuilder.setTarget(this.target); + return newBuilder; + } + } + + @Override + public String toString() { + return "ForwardingRule{" + + "backendService=" + + backendService + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "iPAddress=" + + iPAddress + + ", " + + "iPProtocol=" + + iPProtocol + + ", " + + "id=" + + id + + ", " + + "ipVersion=" + + ipVersion + + ", " + + "kind=" + + kind + + ", " + + "loadBalancingScheme=" + + loadBalancingScheme + + ", " + + "name=" + + name + + ", " + + "network=" + + network + + ", " + + "portRange=" + + portRange + + ", " + + "ports=" + + ports + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + ", " + + "subnetwork=" + + subnetwork + + ", " + + "target=" + + target + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ForwardingRule) { + ForwardingRule that = (ForwardingRule) o; + return Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.iPAddress, that.getIPAddress()) + && Objects.equals(this.iPProtocol, that.getIPProtocol()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.ipVersion, that.getIpVersion()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.loadBalancingScheme, that.getLoadBalancingScheme()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.portRange, that.getPortRange()) + && Objects.equals(this.ports, that.getPortsList()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.subnetwork, that.getSubnetwork()) + && Objects.equals(this.target, that.getTarget()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + backendService, + creationTimestamp, + description, + iPAddress, + iPProtocol, + id, + ipVersion, + kind, + loadBalancingScheme, + name, + network, + portRange, + ports, + region, + selfLink, + subnetwork, + target); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleAggregatedList.java new file mode 100644 index 000000000000..1f25d325df24 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ForwardingRuleAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private ForwardingRuleAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private ForwardingRuleAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ForwardingRuleAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ForwardingRuleAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ForwardingRuleAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ForwardingRuleAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(ForwardingRuleAggregatedList other) { + if (other == ForwardingRuleAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(ForwardingRuleAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public ForwardingRuleAggregatedList build() { + + return new ForwardingRuleAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "ForwardingRuleAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ForwardingRuleAggregatedList) { + ForwardingRuleAggregatedList that = (ForwardingRuleAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleClient.java new file mode 100644 index 000000000000..9b121c11ccc3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleClient.java @@ -0,0 +1,1070 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.ForwardingRuleStub; +import com.google.cloud.compute.v1.stub.ForwardingRuleStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+ *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+ *   Operation response = forwardingRuleClient.deleteForwardingRule(forwardingRule);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the forwardingRuleClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of ForwardingRuleSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * ForwardingRuleSettings forwardingRuleSettings =
+ *     ForwardingRuleSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ForwardingRuleClient forwardingRuleClient =
+ *     ForwardingRuleClient.create(forwardingRuleSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * ForwardingRuleSettings forwardingRuleSettings =
+ *     ForwardingRuleSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ForwardingRuleClient forwardingRuleClient =
+ *     ForwardingRuleClient.create(forwardingRuleSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ForwardingRuleClient implements BackgroundResource { + private final ForwardingRuleSettings settings; + private final ForwardingRuleStub stub; + + /** Constructs an instance of ForwardingRuleClient with default settings. */ + public static final ForwardingRuleClient create() throws IOException { + return create(ForwardingRuleSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ForwardingRuleClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final ForwardingRuleClient create(ForwardingRuleSettings settings) + throws IOException { + return new ForwardingRuleClient(settings); + } + + /** + * Constructs an instance of ForwardingRuleClient, using the given stub for making calls. This is + * for advanced usage - prefer to use ForwardingRuleSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final ForwardingRuleClient create(ForwardingRuleStub stub) { + return new ForwardingRuleClient(stub); + } + + /** + * Constructs an instance of ForwardingRuleClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected ForwardingRuleClient(ForwardingRuleSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ForwardingRuleStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected ForwardingRuleClient(ForwardingRuleStub stub) { + this.settings = null; + this.stub = stub; + } + + public final ForwardingRuleSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ForwardingRuleStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of forwarding rules. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (ForwardingRulesScopedList element : forwardingRuleClient.aggregatedListForwardingRules(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListForwardingRulesPagedResponse aggregatedListForwardingRules( + ProjectName project) { + AggregatedListForwardingRulesHttpRequest request = + AggregatedListForwardingRulesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListForwardingRules(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of forwarding rules. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (ForwardingRulesScopedList element : forwardingRuleClient.aggregatedListForwardingRules(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListForwardingRulesPagedResponse aggregatedListForwardingRules( + String project) { + AggregatedListForwardingRulesHttpRequest request = + AggregatedListForwardingRulesHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListForwardingRules(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of forwarding rules. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListForwardingRulesHttpRequest request = AggregatedListForwardingRulesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (ForwardingRulesScopedList element : forwardingRuleClient.aggregatedListForwardingRules(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListForwardingRulesPagedResponse aggregatedListForwardingRules( + AggregatedListForwardingRulesHttpRequest request) { + return aggregatedListForwardingRulesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of forwarding rules. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListForwardingRulesHttpRequest request = AggregatedListForwardingRulesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListForwardingRulesPagedResponse> future = forwardingRuleClient.aggregatedListForwardingRulesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (ForwardingRulesScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListForwardingRulesHttpRequest, AggregatedListForwardingRulesPagedResponse> + aggregatedListForwardingRulesPagedCallable() { + return stub.aggregatedListForwardingRulesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of forwarding rules. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListForwardingRulesHttpRequest request = AggregatedListForwardingRulesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     ForwardingRuleAggregatedList response = forwardingRuleClient.aggregatedListForwardingRulesCallable().call(request);
+   *     for (ForwardingRulesScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListForwardingRulesCallable() { + return stub.aggregatedListForwardingRulesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified ForwardingRule resource. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   Operation response = forwardingRuleClient.deleteForwardingRule(forwardingRule);
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteForwardingRule(ProjectRegionForwardingRuleName forwardingRule) { + + DeleteForwardingRuleHttpRequest request = + DeleteForwardingRuleHttpRequest.newBuilder() + .setForwardingRule(forwardingRule == null ? null : forwardingRule.toString()) + .build(); + return deleteForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified ForwardingRule resource. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   Operation response = forwardingRuleClient.deleteForwardingRule(forwardingRule.toString());
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteForwardingRule(String forwardingRule) { + + DeleteForwardingRuleHttpRequest request = + DeleteForwardingRuleHttpRequest.newBuilder().setForwardingRule(forwardingRule).build(); + return deleteForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified ForwardingRule resource. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   DeleteForwardingRuleHttpRequest request = DeleteForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .build();
+   *   Operation response = forwardingRuleClient.deleteForwardingRule(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteForwardingRule(DeleteForwardingRuleHttpRequest request) { + return deleteForwardingRuleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified ForwardingRule resource. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   DeleteForwardingRuleHttpRequest request = DeleteForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = forwardingRuleClient.deleteForwardingRuleCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteForwardingRuleCallable() { + return stub.deleteForwardingRuleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified ForwardingRule resource. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   ForwardingRule response = forwardingRuleClient.getForwardingRule(forwardingRule);
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ForwardingRule getForwardingRule(ProjectRegionForwardingRuleName forwardingRule) { + + GetForwardingRuleHttpRequest request = + GetForwardingRuleHttpRequest.newBuilder() + .setForwardingRule(forwardingRule == null ? null : forwardingRule.toString()) + .build(); + return getForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified ForwardingRule resource. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   ForwardingRule response = forwardingRuleClient.getForwardingRule(forwardingRule.toString());
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ForwardingRule getForwardingRule(String forwardingRule) { + + GetForwardingRuleHttpRequest request = + GetForwardingRuleHttpRequest.newBuilder().setForwardingRule(forwardingRule).build(); + return getForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified ForwardingRule resource. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   GetForwardingRuleHttpRequest request = GetForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .build();
+   *   ForwardingRule response = forwardingRuleClient.getForwardingRule(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ForwardingRule getForwardingRule(GetForwardingRuleHttpRequest request) { + return getForwardingRuleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified ForwardingRule resource. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   GetForwardingRuleHttpRequest request = GetForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .build();
+   *   ApiFuture<ForwardingRule> future = forwardingRuleClient.getForwardingRuleCallable().futureCall(request);
+   *   // Do something
+   *   ForwardingRule response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getForwardingRuleCallable() { + return stub.getForwardingRuleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a ForwardingRule resource in the specified project and region using the data included + * in the request. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
+   *   Operation response = forwardingRuleClient.insertForwardingRule(region, forwardingRuleResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param forwardingRuleResource A ForwardingRule resource. A ForwardingRule resource specifies + * which pool of target virtual machines to forward a packet to if it matches the given + * [IPAddress, IPProtocol, ports] tuple. (== resource_for beta.forwardingRules ==) (== + * resource_for v1.forwardingRules ==) (== resource_for beta.globalForwardingRules ==) (== + * resource_for v1.globalForwardingRules ==) (== resource_for beta.regionForwardingRules ==) + * (== resource_for v1.regionForwardingRules ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertForwardingRule( + ProjectRegionName region, ForwardingRule forwardingRuleResource) { + + InsertForwardingRuleHttpRequest request = + InsertForwardingRuleHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setForwardingRuleResource(forwardingRuleResource) + .build(); + return insertForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a ForwardingRule resource in the specified project and region using the data included + * in the request. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
+   *   Operation response = forwardingRuleClient.insertForwardingRule(region.toString(), forwardingRuleResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param forwardingRuleResource A ForwardingRule resource. A ForwardingRule resource specifies + * which pool of target virtual machines to forward a packet to if it matches the given + * [IPAddress, IPProtocol, ports] tuple. (== resource_for beta.forwardingRules ==) (== + * resource_for v1.forwardingRules ==) (== resource_for beta.globalForwardingRules ==) (== + * resource_for v1.globalForwardingRules ==) (== resource_for beta.regionForwardingRules ==) + * (== resource_for v1.regionForwardingRules ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertForwardingRule( + String region, ForwardingRule forwardingRuleResource) { + + InsertForwardingRuleHttpRequest request = + InsertForwardingRuleHttpRequest.newBuilder() + .setRegion(region) + .setForwardingRuleResource(forwardingRuleResource) + .build(); + return insertForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a ForwardingRule resource in the specified project and region using the data included + * in the request. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
+   *   InsertForwardingRuleHttpRequest request = InsertForwardingRuleHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setForwardingRuleResource(forwardingRuleResource)
+   *     .build();
+   *   Operation response = forwardingRuleClient.insertForwardingRule(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertForwardingRule(InsertForwardingRuleHttpRequest request) { + return insertForwardingRuleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a ForwardingRule resource in the specified project and region using the data included + * in the request. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
+   *   InsertForwardingRuleHttpRequest request = InsertForwardingRuleHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setForwardingRuleResource(forwardingRuleResource)
+   *     .build();
+   *   ApiFuture<Operation> future = forwardingRuleClient.insertForwardingRuleCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertForwardingRuleCallable() { + return stub.insertForwardingRuleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of ForwardingRule resources available to the specified project and region. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (ForwardingRule element : forwardingRuleClient.listForwardingRules(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListForwardingRulesPagedResponse listForwardingRules(ProjectRegionName region) { + ListForwardingRulesHttpRequest request = + ListForwardingRulesHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listForwardingRules(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of ForwardingRule resources available to the specified project and region. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (ForwardingRule element : forwardingRuleClient.listForwardingRules(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListForwardingRulesPagedResponse listForwardingRules(String region) { + ListForwardingRulesHttpRequest request = + ListForwardingRulesHttpRequest.newBuilder().setRegion(region).build(); + return listForwardingRules(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of ForwardingRule resources available to the specified project and region. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListForwardingRulesHttpRequest request = ListForwardingRulesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (ForwardingRule element : forwardingRuleClient.listForwardingRules(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListForwardingRulesPagedResponse listForwardingRules( + ListForwardingRulesHttpRequest request) { + return listForwardingRulesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of ForwardingRule resources available to the specified project and region. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListForwardingRulesHttpRequest request = ListForwardingRulesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListForwardingRulesPagedResponse> future = forwardingRuleClient.listForwardingRulesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (ForwardingRule element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listForwardingRulesPagedCallable() { + return stub.listForwardingRulesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of ForwardingRule resources available to the specified project and region. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListForwardingRulesHttpRequest request = ListForwardingRulesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     ForwardingRuleList response = forwardingRuleClient.listForwardingRulesCallable().call(request);
+   *     for (ForwardingRule element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listForwardingRulesCallable() { + return stub.listForwardingRulesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes target URL for forwarding rule. The new target should be of the same type as the old + * target. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   Operation response = forwardingRuleClient.setTargetForwardingRule(forwardingRule, targetReferenceResource);
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource in which target is to be set. + * @param targetReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetForwardingRule( + ProjectRegionForwardingRuleName forwardingRule, TargetReference targetReferenceResource) { + + SetTargetForwardingRuleHttpRequest request = + SetTargetForwardingRuleHttpRequest.newBuilder() + .setForwardingRule(forwardingRule == null ? null : forwardingRule.toString()) + .setTargetReferenceResource(targetReferenceResource) + .build(); + return setTargetForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes target URL for forwarding rule. The new target should be of the same type as the old + * target. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   Operation response = forwardingRuleClient.setTargetForwardingRule(forwardingRule.toString(), targetReferenceResource);
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource in which target is to be set. + * @param targetReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetForwardingRule( + String forwardingRule, TargetReference targetReferenceResource) { + + SetTargetForwardingRuleHttpRequest request = + SetTargetForwardingRuleHttpRequest.newBuilder() + .setForwardingRule(forwardingRule) + .setTargetReferenceResource(targetReferenceResource) + .build(); + return setTargetForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes target URL for forwarding rule. The new target should be of the same type as the old + * target. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   SetTargetForwardingRuleHttpRequest request = SetTargetForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .setTargetReferenceResource(targetReferenceResource)
+   *     .build();
+   *   Operation response = forwardingRuleClient.setTargetForwardingRule(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetForwardingRule(SetTargetForwardingRuleHttpRequest request) { + return setTargetForwardingRuleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes target URL for forwarding rule. The new target should be of the same type as the old + * target. + * + *

Sample code: + * + *


+   * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+   *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   SetTargetForwardingRuleHttpRequest request = SetTargetForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .setTargetReferenceResource(targetReferenceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = forwardingRuleClient.setTargetForwardingRuleCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setTargetForwardingRuleCallable() { + return stub.setTargetForwardingRuleCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListForwardingRulesPagedResponse + extends AbstractPagedListResponse< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + ForwardingRulesScopedList, AggregatedListForwardingRulesPage, + AggregatedListForwardingRulesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + ForwardingRulesScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListForwardingRulesPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + AggregatedListForwardingRulesPage, AggregatedListForwardingRulesPagedResponse>() { + @Override + public AggregatedListForwardingRulesPagedResponse apply( + AggregatedListForwardingRulesPage input) { + return new AggregatedListForwardingRulesPagedResponse(input); + } + }); + } + + private AggregatedListForwardingRulesPagedResponse(AggregatedListForwardingRulesPage page) { + super(page, AggregatedListForwardingRulesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListForwardingRulesPage + extends AbstractPage< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + ForwardingRulesScopedList, AggregatedListForwardingRulesPage> { + + private AggregatedListForwardingRulesPage( + PageContext< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + ForwardingRulesScopedList> + context, + ForwardingRuleAggregatedList response) { + super(context, response); + } + + private static AggregatedListForwardingRulesPage createEmptyPage() { + return new AggregatedListForwardingRulesPage(null, null); + } + + @Override + protected AggregatedListForwardingRulesPage createPage( + PageContext< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + ForwardingRulesScopedList> + context, + ForwardingRuleAggregatedList response) { + return new AggregatedListForwardingRulesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + ForwardingRulesScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListForwardingRulesFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + ForwardingRulesScopedList, AggregatedListForwardingRulesPage, + AggregatedListForwardingRulesFixedSizeCollection> { + + private AggregatedListForwardingRulesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListForwardingRulesFixedSizeCollection createEmptyCollection() { + return new AggregatedListForwardingRulesFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListForwardingRulesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListForwardingRulesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListForwardingRulesPagedResponse + extends AbstractPagedListResponse< + ListForwardingRulesHttpRequest, ForwardingRuleList, ForwardingRule, + ListForwardingRulesPage, ListForwardingRulesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListForwardingRulesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListForwardingRulesPagedResponse apply(ListForwardingRulesPage input) { + return new ListForwardingRulesPagedResponse(input); + } + }); + } + + private ListForwardingRulesPagedResponse(ListForwardingRulesPage page) { + super(page, ListForwardingRulesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListForwardingRulesPage + extends AbstractPage< + ListForwardingRulesHttpRequest, ForwardingRuleList, ForwardingRule, + ListForwardingRulesPage> { + + private ListForwardingRulesPage( + PageContext context, + ForwardingRuleList response) { + super(context, response); + } + + private static ListForwardingRulesPage createEmptyPage() { + return new ListForwardingRulesPage(null, null); + } + + @Override + protected ListForwardingRulesPage createPage( + PageContext context, + ForwardingRuleList response) { + return new ListForwardingRulesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListForwardingRulesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListForwardingRulesHttpRequest, ForwardingRuleList, ForwardingRule, + ListForwardingRulesPage, ListForwardingRulesFixedSizeCollection> { + + private ListForwardingRulesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListForwardingRulesFixedSizeCollection createEmptyCollection() { + return new ListForwardingRulesFixedSizeCollection(null, 0); + } + + @Override + protected ListForwardingRulesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListForwardingRulesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleList.java new file mode 100644 index 000000000000..a7d25a79118b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ForwardingRuleList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private ForwardingRuleList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private ForwardingRuleList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ForwardingRuleList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ForwardingRuleList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ForwardingRuleList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ForwardingRuleList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(ForwardingRuleList other) { + if (other == ForwardingRuleList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(ForwardingRuleList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(ForwardingRule items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public ForwardingRuleList build() { + + return new ForwardingRuleList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "ForwardingRuleList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ForwardingRuleList) { + ForwardingRuleList that = (ForwardingRuleList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleSettings.java new file mode 100644 index 000000000000..2d5623d91b6a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRuleSettings.java @@ -0,0 +1,252 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.ForwardingRuleClient.AggregatedListForwardingRulesPagedResponse; +import static com.google.cloud.compute.v1.ForwardingRuleClient.ListForwardingRulesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.ForwardingRuleStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link ForwardingRuleClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteForwardingRule to 30 seconds: + * + *

+ * 
+ * ForwardingRuleSettings.Builder forwardingRuleSettingsBuilder =
+ *     ForwardingRuleSettings.newBuilder();
+ * forwardingRuleSettingsBuilder.deleteForwardingRuleSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * ForwardingRuleSettings forwardingRuleSettings = forwardingRuleSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ForwardingRuleSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListForwardingRules. */ + public PagedCallSettings< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + AggregatedListForwardingRulesPagedResponse> + aggregatedListForwardingRulesSettings() { + return ((ForwardingRuleStubSettings) getStubSettings()).aggregatedListForwardingRulesSettings(); + } + + /** Returns the object with the settings used for calls to deleteForwardingRule. */ + public UnaryCallSettings + deleteForwardingRuleSettings() { + return ((ForwardingRuleStubSettings) getStubSettings()).deleteForwardingRuleSettings(); + } + + /** Returns the object with the settings used for calls to getForwardingRule. */ + public UnaryCallSettings + getForwardingRuleSettings() { + return ((ForwardingRuleStubSettings) getStubSettings()).getForwardingRuleSettings(); + } + + /** Returns the object with the settings used for calls to insertForwardingRule. */ + public UnaryCallSettings + insertForwardingRuleSettings() { + return ((ForwardingRuleStubSettings) getStubSettings()).insertForwardingRuleSettings(); + } + + /** Returns the object with the settings used for calls to listForwardingRules. */ + public PagedCallSettings< + ListForwardingRulesHttpRequest, ForwardingRuleList, ListForwardingRulesPagedResponse> + listForwardingRulesSettings() { + return ((ForwardingRuleStubSettings) getStubSettings()).listForwardingRulesSettings(); + } + + /** Returns the object with the settings used for calls to setTargetForwardingRule. */ + public UnaryCallSettings + setTargetForwardingRuleSettings() { + return ((ForwardingRuleStubSettings) getStubSettings()).setTargetForwardingRuleSettings(); + } + + public static final ForwardingRuleSettings create(ForwardingRuleStubSettings stub) + throws IOException { + return new ForwardingRuleSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ForwardingRuleStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ForwardingRuleStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return ForwardingRuleStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ForwardingRuleStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ForwardingRuleStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ForwardingRuleStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ForwardingRuleStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ForwardingRuleStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ForwardingRuleSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ForwardingRuleSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(ForwardingRuleStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(ForwardingRuleStubSettings.newBuilder()); + } + + protected Builder(ForwardingRuleSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ForwardingRuleStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public ForwardingRuleStubSettings.Builder getStubSettingsBuilder() { + return ((ForwardingRuleStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListForwardingRules. */ + public PagedCallSettings.Builder< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + AggregatedListForwardingRulesPagedResponse> + aggregatedListForwardingRulesSettings() { + return getStubSettingsBuilder().aggregatedListForwardingRulesSettings(); + } + + /** Returns the builder for the settings used for calls to deleteForwardingRule. */ + public UnaryCallSettings.Builder + deleteForwardingRuleSettings() { + return getStubSettingsBuilder().deleteForwardingRuleSettings(); + } + + /** Returns the builder for the settings used for calls to getForwardingRule. */ + public UnaryCallSettings.Builder + getForwardingRuleSettings() { + return getStubSettingsBuilder().getForwardingRuleSettings(); + } + + /** Returns the builder for the settings used for calls to insertForwardingRule. */ + public UnaryCallSettings.Builder + insertForwardingRuleSettings() { + return getStubSettingsBuilder().insertForwardingRuleSettings(); + } + + /** Returns the builder for the settings used for calls to listForwardingRules. */ + public PagedCallSettings.Builder< + ListForwardingRulesHttpRequest, ForwardingRuleList, ListForwardingRulesPagedResponse> + listForwardingRulesSettings() { + return getStubSettingsBuilder().listForwardingRulesSettings(); + } + + /** Returns the builder for the settings used for calls to setTargetForwardingRule. */ + public UnaryCallSettings.Builder + setTargetForwardingRuleSettings() { + return getStubSettingsBuilder().setTargetForwardingRuleSettings(); + } + + @Override + public ForwardingRuleSettings build() throws IOException { + return new ForwardingRuleSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRulesScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRulesScopedList.java new file mode 100644 index 000000000000..66aa34626498 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ForwardingRulesScopedList.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ForwardingRulesScopedList implements ApiMessage { + private final List forwardingRules; + private final Warning warning; + + private ForwardingRulesScopedList() { + this.forwardingRules = null; + this.warning = null; + } + + private ForwardingRulesScopedList(List forwardingRules, Warning warning) { + this.forwardingRules = forwardingRules; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("forwardingRules")) { + return forwardingRules; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getForwardingRulesList() { + return forwardingRules; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ForwardingRulesScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ForwardingRulesScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ForwardingRulesScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ForwardingRulesScopedList(); + } + + public static class Builder { + private List forwardingRules; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(ForwardingRulesScopedList other) { + if (other == ForwardingRulesScopedList.getDefaultInstance()) return this; + if (other.getForwardingRulesList() != null) { + this.forwardingRules = other.forwardingRules; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(ForwardingRulesScopedList source) { + this.forwardingRules = source.forwardingRules; + this.warning = source.warning; + } + + public List getForwardingRulesList() { + return forwardingRules; + } + + public Builder addAllForwardingRules(List forwardingRules) { + if (this.forwardingRules == null) { + this.forwardingRules = new ArrayList<>(forwardingRules.size()); + } + this.forwardingRules.addAll(forwardingRules); + return this; + } + + public Builder addForwardingRules(ForwardingRule forwardingRules) { + this.forwardingRules.add(forwardingRules); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public ForwardingRulesScopedList build() { + + return new ForwardingRulesScopedList(forwardingRules, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllForwardingRules(this.forwardingRules); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "ForwardingRulesScopedList{" + + "forwardingRules=" + + forwardingRules + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ForwardingRulesScopedList) { + ForwardingRulesScopedList that = (ForwardingRulesScopedList) o; + return Objects.equals(this.forwardingRules, that.getForwardingRulesList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(forwardingRules, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetAcceleratorTypeHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetAcceleratorTypeHttpRequest.java new file mode 100644 index 000000000000..861c64ea1405 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetAcceleratorTypeHttpRequest.java @@ -0,0 +1,366 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetAcceleratorTypeHttpRequest implements ApiMessage { + private final String acceleratorType; + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetAcceleratorTypeHttpRequest() { + this.acceleratorType = null; + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetAcceleratorTypeHttpRequest( + String acceleratorType, + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.acceleratorType = acceleratorType; + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("acceleratorType")) { + return acceleratorType; + } + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAcceleratorType() { + return acceleratorType; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetAcceleratorTypeHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetAcceleratorTypeHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetAcceleratorTypeHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetAcceleratorTypeHttpRequest(); + } + + public static class Builder { + private String acceleratorType; + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetAcceleratorTypeHttpRequest other) { + if (other == GetAcceleratorTypeHttpRequest.getDefaultInstance()) return this; + if (other.getAcceleratorType() != null) { + this.acceleratorType = other.acceleratorType; + } + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetAcceleratorTypeHttpRequest source) { + this.acceleratorType = source.acceleratorType; + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAcceleratorType() { + return acceleratorType; + } + + public Builder setAcceleratorType(String acceleratorType) { + this.acceleratorType = acceleratorType; + return this; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetAcceleratorTypeHttpRequest build() { + String missing = ""; + if (acceleratorType == null) { + missing += " acceleratorType"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetAcceleratorTypeHttpRequest( + acceleratorType, access_token, callback, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAcceleratorType(this.acceleratorType); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetAcceleratorTypeHttpRequest{" + + "acceleratorType=" + + acceleratorType + + ", " + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetAcceleratorTypeHttpRequest) { + GetAcceleratorTypeHttpRequest that = (GetAcceleratorTypeHttpRequest) o; + return Objects.equals(this.acceleratorType, that.getAcceleratorType()) + && Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + acceleratorType, access_token, callback, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetAddressHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetAddressHttpRequest.java new file mode 100644 index 000000000000..73e1b8de267c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetAddressHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetAddressHttpRequest implements ApiMessage { + private final String access_token; + private final String address; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetAddressHttpRequest() { + this.access_token = null; + this.address = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetAddressHttpRequest( + String access_token, + String address, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.address = address; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("address")) { + return address; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getAddress() { + return address; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetAddressHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetAddressHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetAddressHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetAddressHttpRequest(); + } + + public static class Builder { + private String access_token; + private String address; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetAddressHttpRequest other) { + if (other == GetAddressHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAddress() != null) { + this.address = other.address; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetAddressHttpRequest source) { + this.access_token = source.access_token; + this.address = source.address; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAddress() { + return address; + } + + public Builder setAddress(String address) { + this.address = address; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetAddressHttpRequest build() { + String missing = ""; + + if (address == null) { + missing += " address"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetAddressHttpRequest( + access_token, address, callback, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAddress(this.address); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetAddressHttpRequest{" + + "access_token=" + + access_token + + ", " + + "address=" + + address + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetAddressHttpRequest) { + GetAddressHttpRequest that = (GetAddressHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.address, that.getAddress()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, address, callback, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetAutoscalerHttpRequest.java new file mode 100644 index 000000000000..6dce224ca63f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetAutoscalerHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetAutoscalerHttpRequest implements ApiMessage { + private final String access_token; + private final String autoscaler; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetAutoscalerHttpRequest() { + this.access_token = null; + this.autoscaler = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetAutoscalerHttpRequest( + String access_token, + String autoscaler, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.autoscaler = autoscaler; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("autoscaler")) { + return autoscaler; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getAutoscaler() { + return autoscaler; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetAutoscalerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetAutoscalerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetAutoscalerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetAutoscalerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String autoscaler; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetAutoscalerHttpRequest other) { + if (other == GetAutoscalerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAutoscaler() != null) { + this.autoscaler = other.autoscaler; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetAutoscalerHttpRequest source) { + this.access_token = source.access_token; + this.autoscaler = source.autoscaler; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Builder setAutoscaler(String autoscaler) { + this.autoscaler = autoscaler; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetAutoscalerHttpRequest build() { + String missing = ""; + + if (autoscaler == null) { + missing += " autoscaler"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetAutoscalerHttpRequest( + access_token, autoscaler, callback, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAutoscaler(this.autoscaler); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetAutoscalerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "autoscaler=" + + autoscaler + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetAutoscalerHttpRequest) { + GetAutoscalerHttpRequest that = (GetAutoscalerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.autoscaler, that.getAutoscaler()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, autoscaler, callback, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetBackendBucketHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetBackendBucketHttpRequest.java new file mode 100644 index 000000000000..cf2e28002930 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetBackendBucketHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetBackendBucketHttpRequest implements ApiMessage { + private final String access_token; + private final String backendBucket; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetBackendBucketHttpRequest() { + this.access_token = null; + this.backendBucket = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetBackendBucketHttpRequest( + String access_token, + String backendBucket, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.backendBucket = backendBucket; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendBucket")) { + return backendBucket; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendBucket() { + return backendBucket; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetBackendBucketHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetBackendBucketHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetBackendBucketHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetBackendBucketHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendBucket; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetBackendBucketHttpRequest other) { + if (other == GetBackendBucketHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendBucket() != null) { + this.backendBucket = other.backendBucket; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetBackendBucketHttpRequest source) { + this.access_token = source.access_token; + this.backendBucket = source.backendBucket; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendBucket() { + return backendBucket; + } + + public Builder setBackendBucket(String backendBucket) { + this.backendBucket = backendBucket; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetBackendBucketHttpRequest build() { + String missing = ""; + + if (backendBucket == null) { + missing += " backendBucket"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetBackendBucketHttpRequest( + access_token, backendBucket, callback, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendBucket(this.backendBucket); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetBackendBucketHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendBucket=" + + backendBucket + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetBackendBucketHttpRequest) { + GetBackendBucketHttpRequest that = (GetBackendBucketHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendBucket, that.getBackendBucket()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, backendBucket, callback, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetBackendServiceHttpRequest.java new file mode 100644 index 000000000000..8d8ca9cbe9b4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetBackendServiceHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final String backendService; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetBackendServiceHttpRequest() { + this.access_token = null; + this.backendService = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetBackendServiceHttpRequest( + String access_token, + String backendService, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.backendService = backendService; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendService")) { + return backendService; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendService() { + return backendService; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendService; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetBackendServiceHttpRequest other) { + if (other == GetBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendService() != null) { + this.backendService = other.backendService; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendService = source.backendService; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendService() { + return backendService; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetBackendServiceHttpRequest build() { + String missing = ""; + + if (backendService == null) { + missing += " backendService"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetBackendServiceHttpRequest( + access_token, backendService, callback, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendService(this.backendService); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendService=" + + backendService + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetBackendServiceHttpRequest) { + GetBackendServiceHttpRequest that = (GetBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, backendService, callback, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetDiskHttpRequest.java new file mode 100644 index 000000000000..3ed0f637b373 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetDiskHttpRequest.java @@ -0,0 +1,366 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String disk; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.disk = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetDiskHttpRequest( + String access_token, + String callback, + String disk, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.disk = disk; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("disk")) { + return disk; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getDisk() { + return disk; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String disk; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetDiskHttpRequest other) { + if (other == GetDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDisk() != null) { + this.disk = other.disk; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.disk = source.disk; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDisk() { + return disk; + } + + public Builder setDisk(String disk) { + this.disk = disk; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetDiskHttpRequest build() { + String missing = ""; + + if (disk == null) { + missing += " disk"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetDiskHttpRequest( + access_token, callback, disk, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDisk(this.disk); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "disk=" + + disk + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetDiskHttpRequest) { + GetDiskHttpRequest that = (GetDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.disk, that.getDisk()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(access_token, callback, disk, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetDiskTypeHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetDiskTypeHttpRequest.java new file mode 100644 index 000000000000..dc59d19540bb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetDiskTypeHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetDiskTypeHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String diskType; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetDiskTypeHttpRequest() { + this.access_token = null; + this.callback = null; + this.diskType = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetDiskTypeHttpRequest( + String access_token, + String callback, + String diskType, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.diskType = diskType; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("diskType")) { + return diskType; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getDiskType() { + return diskType; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetDiskTypeHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetDiskTypeHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetDiskTypeHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetDiskTypeHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String diskType; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetDiskTypeHttpRequest other) { + if (other == GetDiskTypeHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDiskType() != null) { + this.diskType = other.diskType; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetDiskTypeHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.diskType = source.diskType; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDiskType() { + return diskType; + } + + public Builder setDiskType(String diskType) { + this.diskType = diskType; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetDiskTypeHttpRequest build() { + String missing = ""; + + if (diskType == null) { + missing += " diskType"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetDiskTypeHttpRequest( + access_token, callback, diskType, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDiskType(this.diskType); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetDiskTypeHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "diskType=" + + diskType + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetDiskTypeHttpRequest) { + GetDiskTypeHttpRequest that = (GetDiskTypeHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.diskType, that.getDiskType()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, diskType, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetFirewallHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetFirewallHttpRequest.java new file mode 100644 index 000000000000..f7941097b523 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetFirewallHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetFirewallHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String firewall; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetFirewallHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.firewall = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetFirewallHttpRequest( + String access_token, + String callback, + String fields, + String firewall, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.firewall = firewall; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("firewall")) { + return firewall; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFirewall() { + return firewall; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetFirewallHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetFirewallHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetFirewallHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetFirewallHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String firewall; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetFirewallHttpRequest other) { + if (other == GetFirewallHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFirewall() != null) { + this.firewall = other.firewall; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetFirewallHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.firewall = source.firewall; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFirewall() { + return firewall; + } + + public Builder setFirewall(String firewall) { + this.firewall = firewall; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetFirewallHttpRequest build() { + String missing = ""; + + if (firewall == null) { + missing += " firewall"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetFirewallHttpRequest( + access_token, callback, fields, firewall, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFirewall(this.firewall); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetFirewallHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "firewall=" + + firewall + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetFirewallHttpRequest) { + GetFirewallHttpRequest that = (GetFirewallHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.firewall, that.getFirewall()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, firewall, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetForwardingRuleHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetForwardingRuleHttpRequest.java new file mode 100644 index 000000000000..72a30fbc8dda --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetForwardingRuleHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetForwardingRuleHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String forwardingRule; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetForwardingRuleHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.forwardingRule = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetForwardingRuleHttpRequest( + String access_token, + String callback, + String fields, + String forwardingRule, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.forwardingRule = forwardingRule; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("forwardingRule")) { + return forwardingRule; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetForwardingRuleHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetForwardingRuleHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetForwardingRuleHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetForwardingRuleHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String forwardingRule; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetForwardingRuleHttpRequest other) { + if (other == GetForwardingRuleHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getForwardingRule() != null) { + this.forwardingRule = other.forwardingRule; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetForwardingRuleHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.forwardingRule = source.forwardingRule; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public Builder setForwardingRule(String forwardingRule) { + this.forwardingRule = forwardingRule; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetForwardingRuleHttpRequest build() { + String missing = ""; + + if (forwardingRule == null) { + missing += " forwardingRule"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetForwardingRuleHttpRequest( + access_token, callback, fields, forwardingRule, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setForwardingRule(this.forwardingRule); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetForwardingRuleHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "forwardingRule=" + + forwardingRule + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetForwardingRuleHttpRequest) { + GetForwardingRuleHttpRequest that = (GetForwardingRuleHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.forwardingRule, that.getForwardingRule()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, forwardingRule, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetFromFamilyImageHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetFromFamilyImageHttpRequest.java new file mode 100644 index 000000000000..cd3168370454 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetFromFamilyImageHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetFromFamilyImageHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String family; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetFromFamilyImageHttpRequest() { + this.access_token = null; + this.callback = null; + this.family = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetFromFamilyImageHttpRequest( + String access_token, + String callback, + String family, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.family = family; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("family")) { + return family; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFamily() { + return family; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetFromFamilyImageHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetFromFamilyImageHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetFromFamilyImageHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetFromFamilyImageHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String family; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetFromFamilyImageHttpRequest other) { + if (other == GetFromFamilyImageHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFamily() != null) { + this.family = other.family; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetFromFamilyImageHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.family = source.family; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFamily() { + return family; + } + + public Builder setFamily(String family) { + this.family = family; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetFromFamilyImageHttpRequest build() { + String missing = ""; + + if (family == null) { + missing += " family"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetFromFamilyImageHttpRequest( + access_token, callback, family, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFamily(this.family); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetFromFamilyImageHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "family=" + + family + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetFromFamilyImageHttpRequest) { + GetFromFamilyImageHttpRequest that = (GetFromFamilyImageHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.family, that.getFamily()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, family, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetGlobalAddressHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetGlobalAddressHttpRequest.java new file mode 100644 index 000000000000..9939700d0fdf --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetGlobalAddressHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetGlobalAddressHttpRequest implements ApiMessage { + private final String access_token; + private final String address; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetGlobalAddressHttpRequest() { + this.access_token = null; + this.address = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetGlobalAddressHttpRequest( + String access_token, + String address, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.address = address; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("address")) { + return address; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getAddress() { + return address; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetGlobalAddressHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetGlobalAddressHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetGlobalAddressHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetGlobalAddressHttpRequest(); + } + + public static class Builder { + private String access_token; + private String address; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetGlobalAddressHttpRequest other) { + if (other == GetGlobalAddressHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAddress() != null) { + this.address = other.address; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetGlobalAddressHttpRequest source) { + this.access_token = source.access_token; + this.address = source.address; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAddress() { + return address; + } + + public Builder setAddress(String address) { + this.address = address; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetGlobalAddressHttpRequest build() { + String missing = ""; + + if (address == null) { + missing += " address"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetGlobalAddressHttpRequest( + access_token, address, callback, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAddress(this.address); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetGlobalAddressHttpRequest{" + + "access_token=" + + access_token + + ", " + + "address=" + + address + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetGlobalAddressHttpRequest) { + GetGlobalAddressHttpRequest that = (GetGlobalAddressHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.address, that.getAddress()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, address, callback, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetGlobalForwardingRuleHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetGlobalForwardingRuleHttpRequest.java new file mode 100644 index 000000000000..499754896dc9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetGlobalForwardingRuleHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetGlobalForwardingRuleHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String forwardingRule; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetGlobalForwardingRuleHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.forwardingRule = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetGlobalForwardingRuleHttpRequest( + String access_token, + String callback, + String fields, + String forwardingRule, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.forwardingRule = forwardingRule; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("forwardingRule")) { + return forwardingRule; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetGlobalForwardingRuleHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetGlobalForwardingRuleHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetGlobalForwardingRuleHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetGlobalForwardingRuleHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String forwardingRule; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetGlobalForwardingRuleHttpRequest other) { + if (other == GetGlobalForwardingRuleHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getForwardingRule() != null) { + this.forwardingRule = other.forwardingRule; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetGlobalForwardingRuleHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.forwardingRule = source.forwardingRule; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public Builder setForwardingRule(String forwardingRule) { + this.forwardingRule = forwardingRule; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetGlobalForwardingRuleHttpRequest build() { + String missing = ""; + + if (forwardingRule == null) { + missing += " forwardingRule"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetGlobalForwardingRuleHttpRequest( + access_token, callback, fields, forwardingRule, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setForwardingRule(this.forwardingRule); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetGlobalForwardingRuleHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "forwardingRule=" + + forwardingRule + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetGlobalForwardingRuleHttpRequest) { + GetGlobalForwardingRuleHttpRequest that = (GetGlobalForwardingRuleHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.forwardingRule, that.getForwardingRule()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, forwardingRule, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetGlobalOperationHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetGlobalOperationHttpRequest.java new file mode 100644 index 000000000000..d324b7e0b662 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetGlobalOperationHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetGlobalOperationHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String operation; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetGlobalOperationHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.operation = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetGlobalOperationHttpRequest( + String access_token, + String callback, + String fields, + String key, + String operation, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.operation = operation; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("operation")) { + return operation; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getOperation() { + return operation; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetGlobalOperationHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetGlobalOperationHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetGlobalOperationHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetGlobalOperationHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String operation; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetGlobalOperationHttpRequest other) { + if (other == GetGlobalOperationHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getOperation() != null) { + this.operation = other.operation; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetGlobalOperationHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.operation = source.operation; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getOperation() { + return operation; + } + + public Builder setOperation(String operation) { + this.operation = operation; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetGlobalOperationHttpRequest build() { + String missing = ""; + + if (operation == null) { + missing += " operation"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetGlobalOperationHttpRequest( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setOperation(this.operation); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetGlobalOperationHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "operation=" + + operation + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetGlobalOperationHttpRequest) { + GetGlobalOperationHttpRequest that = (GetGlobalOperationHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.operation, that.getOperation()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthBackendServiceHttpRequest.java new file mode 100644 index 000000000000..de74c613666a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthBackendServiceHttpRequest.java @@ -0,0 +1,415 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetHealthBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final String backendService; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final ResourceGroupReference resourceGroupReferenceResource; + private final String userIp; + + private GetHealthBackendServiceHttpRequest() { + this.access_token = null; + this.backendService = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.resourceGroupReferenceResource = null; + this.userIp = null; + } + + private GetHealthBackendServiceHttpRequest( + String access_token, + String backendService, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + ResourceGroupReference resourceGroupReferenceResource, + String userIp) { + this.access_token = access_token; + this.backendService = backendService; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.resourceGroupReferenceResource = resourceGroupReferenceResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendService")) { + return backendService; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("resourceGroupReferenceResource")) { + return resourceGroupReferenceResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ResourceGroupReference getApiMessageRequestBody() { + return resourceGroupReferenceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendService() { + return backendService; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public ResourceGroupReference getResourceGroupReferenceResource() { + return resourceGroupReferenceResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetHealthBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetHealthBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetHealthBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetHealthBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendService; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private ResourceGroupReference resourceGroupReferenceResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetHealthBackendServiceHttpRequest other) { + if (other == GetHealthBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendService() != null) { + this.backendService = other.backendService; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getResourceGroupReferenceResource() != null) { + this.resourceGroupReferenceResource = other.resourceGroupReferenceResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetHealthBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendService = source.backendService; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.resourceGroupReferenceResource = source.resourceGroupReferenceResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendService() { + return backendService; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public ResourceGroupReference getResourceGroupReferenceResource() { + return resourceGroupReferenceResource; + } + + public Builder setResourceGroupReferenceResource( + ResourceGroupReference resourceGroupReferenceResource) { + this.resourceGroupReferenceResource = resourceGroupReferenceResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetHealthBackendServiceHttpRequest build() { + String missing = ""; + + if (backendService == null) { + missing += " backendService"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetHealthBackendServiceHttpRequest( + access_token, + backendService, + callback, + fields, + key, + prettyPrint, + quotaUser, + resourceGroupReferenceResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendService(this.backendService); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setResourceGroupReferenceResource(this.resourceGroupReferenceResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetHealthBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendService=" + + backendService + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "resourceGroupReferenceResource=" + + resourceGroupReferenceResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetHealthBackendServiceHttpRequest) { + GetHealthBackendServiceHttpRequest that = (GetHealthBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals( + this.resourceGroupReferenceResource, that.getResourceGroupReferenceResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendService, + callback, + fields, + key, + prettyPrint, + quotaUser, + resourceGroupReferenceResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthCheckHttpRequest.java new file mode 100644 index 000000000000..f03de6e68a7a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthCheckHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String healthCheck; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.healthCheck = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetHealthCheckHttpRequest( + String access_token, + String callback, + String fields, + String healthCheck, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.healthCheck = healthCheck; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("healthCheck")) { + return healthCheck; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHealthCheck() { + return healthCheck; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String healthCheck; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetHealthCheckHttpRequest other) { + if (other == GetHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHealthCheck() != null) { + this.healthCheck = other.healthCheck; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.healthCheck = source.healthCheck; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHealthCheck() { + return healthCheck; + } + + public Builder setHealthCheck(String healthCheck) { + this.healthCheck = healthCheck; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetHealthCheckHttpRequest build() { + String missing = ""; + + if (healthCheck == null) { + missing += " healthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetHealthCheckHttpRequest( + access_token, callback, fields, healthCheck, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setHealthCheck(this.healthCheck); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "healthCheck=" + + healthCheck + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetHealthCheckHttpRequest) { + GetHealthCheckHttpRequest that = (GetHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.healthCheck, that.getHealthCheck()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, healthCheck, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthRegionBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthRegionBackendServiceHttpRequest.java new file mode 100644 index 000000000000..d2411b7e6995 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthRegionBackendServiceHttpRequest.java @@ -0,0 +1,415 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetHealthRegionBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final String backendService; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final ResourceGroupReference resourceGroupReferenceResource; + private final String userIp; + + private GetHealthRegionBackendServiceHttpRequest() { + this.access_token = null; + this.backendService = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.resourceGroupReferenceResource = null; + this.userIp = null; + } + + private GetHealthRegionBackendServiceHttpRequest( + String access_token, + String backendService, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + ResourceGroupReference resourceGroupReferenceResource, + String userIp) { + this.access_token = access_token; + this.backendService = backendService; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.resourceGroupReferenceResource = resourceGroupReferenceResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendService")) { + return backendService; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("resourceGroupReferenceResource")) { + return resourceGroupReferenceResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ResourceGroupReference getApiMessageRequestBody() { + return resourceGroupReferenceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendService() { + return backendService; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public ResourceGroupReference getResourceGroupReferenceResource() { + return resourceGroupReferenceResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetHealthRegionBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetHealthRegionBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetHealthRegionBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetHealthRegionBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendService; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private ResourceGroupReference resourceGroupReferenceResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetHealthRegionBackendServiceHttpRequest other) { + if (other == GetHealthRegionBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendService() != null) { + this.backendService = other.backendService; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getResourceGroupReferenceResource() != null) { + this.resourceGroupReferenceResource = other.resourceGroupReferenceResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetHealthRegionBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendService = source.backendService; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.resourceGroupReferenceResource = source.resourceGroupReferenceResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendService() { + return backendService; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public ResourceGroupReference getResourceGroupReferenceResource() { + return resourceGroupReferenceResource; + } + + public Builder setResourceGroupReferenceResource( + ResourceGroupReference resourceGroupReferenceResource) { + this.resourceGroupReferenceResource = resourceGroupReferenceResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetHealthRegionBackendServiceHttpRequest build() { + String missing = ""; + + if (backendService == null) { + missing += " backendService"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetHealthRegionBackendServiceHttpRequest( + access_token, + backendService, + callback, + fields, + key, + prettyPrint, + quotaUser, + resourceGroupReferenceResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendService(this.backendService); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setResourceGroupReferenceResource(this.resourceGroupReferenceResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetHealthRegionBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendService=" + + backendService + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "resourceGroupReferenceResource=" + + resourceGroupReferenceResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetHealthRegionBackendServiceHttpRequest) { + GetHealthRegionBackendServiceHttpRequest that = (GetHealthRegionBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals( + this.resourceGroupReferenceResource, that.getResourceGroupReferenceResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendService, + callback, + fields, + key, + prettyPrint, + quotaUser, + resourceGroupReferenceResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthTargetPoolHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthTargetPoolHttpRequest.java new file mode 100644 index 000000000000..80adbde9767e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHealthTargetPoolHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetHealthTargetPoolHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final InstanceReference instanceReferenceResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String targetPool; + private final String userIp; + + private GetHealthTargetPoolHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceReferenceResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.targetPool = null; + this.userIp = null; + } + + private GetHealthTargetPoolHttpRequest( + String access_token, + String callback, + String fields, + InstanceReference instanceReferenceResource, + String key, + String prettyPrint, + String quotaUser, + String targetPool, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceReferenceResource = instanceReferenceResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.targetPool = targetPool; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceReferenceResource")) { + return instanceReferenceResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("targetPool")) { + return targetPool; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceReference getApiMessageRequestBody() { + return instanceReferenceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public InstanceReference getInstanceReferenceResource() { + return instanceReferenceResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getTargetPool() { + return targetPool; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetHealthTargetPoolHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetHealthTargetPoolHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetHealthTargetPoolHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetHealthTargetPoolHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private InstanceReference instanceReferenceResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String targetPool; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetHealthTargetPoolHttpRequest other) { + if (other == GetHealthTargetPoolHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceReferenceResource() != null) { + this.instanceReferenceResource = other.instanceReferenceResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getTargetPool() != null) { + this.targetPool = other.targetPool; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetHealthTargetPoolHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceReferenceResource = source.instanceReferenceResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.targetPool = source.targetPool; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public InstanceReference getInstanceReferenceResource() { + return instanceReferenceResource; + } + + public Builder setInstanceReferenceResource(InstanceReference instanceReferenceResource) { + this.instanceReferenceResource = instanceReferenceResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getTargetPool() { + return targetPool; + } + + public Builder setTargetPool(String targetPool) { + this.targetPool = targetPool; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetHealthTargetPoolHttpRequest build() { + String missing = ""; + + if (targetPool == null) { + missing += " targetPool"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetHealthTargetPoolHttpRequest( + access_token, + callback, + fields, + instanceReferenceResource, + key, + prettyPrint, + quotaUser, + targetPool, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceReferenceResource(this.instanceReferenceResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setTargetPool(this.targetPool); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetHealthTargetPoolHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceReferenceResource=" + + instanceReferenceResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "targetPool=" + + targetPool + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetHealthTargetPoolHttpRequest) { + GetHealthTargetPoolHttpRequest that = (GetHealthTargetPoolHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceReferenceResource, that.getInstanceReferenceResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.targetPool, that.getTargetPool()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceReferenceResource, + key, + prettyPrint, + quotaUser, + targetPool, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHttpHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHttpHealthCheckHttpRequest.java new file mode 100644 index 000000000000..f15e79e68f9f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHttpHealthCheckHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetHttpHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String httpHealthCheck; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetHttpHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.httpHealthCheck = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetHttpHealthCheckHttpRequest( + String access_token, + String callback, + String fields, + String httpHealthCheck, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.httpHealthCheck = httpHealthCheck; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("httpHealthCheck")) { + return httpHealthCheck; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHttpHealthCheck() { + return httpHealthCheck; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetHttpHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetHttpHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetHttpHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetHttpHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String httpHealthCheck; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetHttpHealthCheckHttpRequest other) { + if (other == GetHttpHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHttpHealthCheck() != null) { + this.httpHealthCheck = other.httpHealthCheck; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetHttpHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.httpHealthCheck = source.httpHealthCheck; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHttpHealthCheck() { + return httpHealthCheck; + } + + public Builder setHttpHealthCheck(String httpHealthCheck) { + this.httpHealthCheck = httpHealthCheck; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetHttpHealthCheckHttpRequest build() { + String missing = ""; + + if (httpHealthCheck == null) { + missing += " httpHealthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetHttpHealthCheckHttpRequest( + access_token, callback, fields, httpHealthCheck, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setHttpHealthCheck(this.httpHealthCheck); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetHttpHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "httpHealthCheck=" + + httpHealthCheck + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetHttpHealthCheckHttpRequest) { + GetHttpHealthCheckHttpRequest that = (GetHttpHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.httpHealthCheck, that.getHttpHealthCheck()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, httpHealthCheck, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHttpsHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHttpsHealthCheckHttpRequest.java new file mode 100644 index 000000000000..0df43e72848f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetHttpsHealthCheckHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetHttpsHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String httpsHealthCheck; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetHttpsHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.httpsHealthCheck = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetHttpsHealthCheckHttpRequest( + String access_token, + String callback, + String fields, + String httpsHealthCheck, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.httpsHealthCheck = httpsHealthCheck; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("httpsHealthCheck")) { + return httpsHealthCheck; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetHttpsHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetHttpsHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetHttpsHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetHttpsHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String httpsHealthCheck; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetHttpsHealthCheckHttpRequest other) { + if (other == GetHttpsHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHttpsHealthCheck() != null) { + this.httpsHealthCheck = other.httpsHealthCheck; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetHttpsHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.httpsHealthCheck = source.httpsHealthCheck; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public Builder setHttpsHealthCheck(String httpsHealthCheck) { + this.httpsHealthCheck = httpsHealthCheck; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetHttpsHealthCheckHttpRequest build() { + String missing = ""; + + if (httpsHealthCheck == null) { + missing += " httpsHealthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetHttpsHealthCheckHttpRequest( + access_token, callback, fields, httpsHealthCheck, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setHttpsHealthCheck(this.httpsHealthCheck); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetHttpsHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "httpsHealthCheck=" + + httpsHealthCheck + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetHttpsHealthCheckHttpRequest) { + GetHttpsHealthCheckHttpRequest that = (GetHttpsHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.httpsHealthCheck, that.getHttpsHealthCheck()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, httpsHealthCheck, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetImageHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetImageHttpRequest.java new file mode 100644 index 000000000000..159c4c597af0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetImageHttpRequest.java @@ -0,0 +1,366 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetImageHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String image; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetImageHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.image = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetImageHttpRequest( + String access_token, + String callback, + String fields, + String image, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.image = image; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("image")) { + return image; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getImage() { + return image; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetImageHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetImageHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetImageHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetImageHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String image; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetImageHttpRequest other) { + if (other == GetImageHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getImage() != null) { + this.image = other.image; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetImageHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.image = source.image; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getImage() { + return image; + } + + public Builder setImage(String image) { + this.image = image; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetImageHttpRequest build() { + String missing = ""; + + if (image == null) { + missing += " image"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetImageHttpRequest( + access_token, callback, fields, image, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setImage(this.image); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetImageHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "image=" + + image + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetImageHttpRequest) { + GetImageHttpRequest that = (GetImageHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.image, that.getImage()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(access_token, callback, fields, image, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceGroupHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceGroupHttpRequest.java new file mode 100644 index 000000000000..a3ea3a0b3819 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceGroupHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetInstanceGroupHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroup; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetInstanceGroupHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroup = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetInstanceGroupHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroup, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroup = instanceGroup; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroup")) { + return instanceGroup; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetInstanceGroupHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetInstanceGroupHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetInstanceGroupHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetInstanceGroupHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroup; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetInstanceGroupHttpRequest other) { + if (other == GetInstanceGroupHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroup() != null) { + this.instanceGroup = other.instanceGroup; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetInstanceGroupHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroup = source.instanceGroup; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetInstanceGroupHttpRequest build() { + String missing = ""; + + if (instanceGroup == null) { + missing += " instanceGroup"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetInstanceGroupHttpRequest( + access_token, callback, fields, instanceGroup, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroup(this.instanceGroup); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetInstanceGroupHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroup=" + + instanceGroup + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetInstanceGroupHttpRequest) { + GetInstanceGroupHttpRequest that = (GetInstanceGroupHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, instanceGroup, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..1ec4366a7463 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceGroupManagerHttpRequest.java @@ -0,0 +1,374 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetInstanceGroupManagerHttpRequest other) { + if (other == GetInstanceGroupManagerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetInstanceGroupManagerHttpRequest) { + GetInstanceGroupManagerHttpRequest that = (GetInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, instanceGroupManager, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceHttpRequest.java new file mode 100644 index 000000000000..40609939618e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetInstanceHttpRequest other) { + if (other == GetInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetInstanceHttpRequest( + access_token, callback, fields, instance, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetInstanceHttpRequest) { + GetInstanceHttpRequest that = (GetInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, instance, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceTemplateHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceTemplateHttpRequest.java new file mode 100644 index 000000000000..6a605d45dd6d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInstanceTemplateHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetInstanceTemplateHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceTemplate; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetInstanceTemplateHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceTemplate = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetInstanceTemplateHttpRequest( + String access_token, + String callback, + String fields, + String instanceTemplate, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceTemplate = instanceTemplate; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceTemplate")) { + return instanceTemplate; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetInstanceTemplateHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetInstanceTemplateHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetInstanceTemplateHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetInstanceTemplateHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceTemplate; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetInstanceTemplateHttpRequest other) { + if (other == GetInstanceTemplateHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceTemplate() != null) { + this.instanceTemplate = other.instanceTemplate; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetInstanceTemplateHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceTemplate = source.instanceTemplate; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public Builder setInstanceTemplate(String instanceTemplate) { + this.instanceTemplate = instanceTemplate; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetInstanceTemplateHttpRequest build() { + String missing = ""; + + if (instanceTemplate == null) { + missing += " instanceTemplate"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetInstanceTemplateHttpRequest( + access_token, callback, fields, instanceTemplate, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceTemplate(this.instanceTemplate); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetInstanceTemplateHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceTemplate=" + + instanceTemplate + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetInstanceTemplateHttpRequest) { + GetInstanceTemplateHttpRequest that = (GetInstanceTemplateHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceTemplate, that.getInstanceTemplate()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, instanceTemplate, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInterconnectAttachmentHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInterconnectAttachmentHttpRequest.java new file mode 100644 index 000000000000..6b32b78e607c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInterconnectAttachmentHttpRequest.java @@ -0,0 +1,381 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetInterconnectAttachmentHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String interconnectAttachment; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetInterconnectAttachmentHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.interconnectAttachment = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetInterconnectAttachmentHttpRequest( + String access_token, + String callback, + String fields, + String interconnectAttachment, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.interconnectAttachment = interconnectAttachment; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("interconnectAttachment")) { + return interconnectAttachment; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInterconnectAttachment() { + return interconnectAttachment; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetInterconnectAttachmentHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetInterconnectAttachmentHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetInterconnectAttachmentHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetInterconnectAttachmentHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String interconnectAttachment; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetInterconnectAttachmentHttpRequest other) { + if (other == GetInterconnectAttachmentHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInterconnectAttachment() != null) { + this.interconnectAttachment = other.interconnectAttachment; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetInterconnectAttachmentHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.interconnectAttachment = source.interconnectAttachment; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInterconnectAttachment() { + return interconnectAttachment; + } + + public Builder setInterconnectAttachment(String interconnectAttachment) { + this.interconnectAttachment = interconnectAttachment; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetInterconnectAttachmentHttpRequest build() { + String missing = ""; + + if (interconnectAttachment == null) { + missing += " interconnectAttachment"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetInterconnectAttachmentHttpRequest( + access_token, + callback, + fields, + interconnectAttachment, + key, + prettyPrint, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInterconnectAttachment(this.interconnectAttachment); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetInterconnectAttachmentHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "interconnectAttachment=" + + interconnectAttachment + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetInterconnectAttachmentHttpRequest) { + GetInterconnectAttachmentHttpRequest that = (GetInterconnectAttachmentHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.interconnectAttachment, that.getInterconnectAttachment()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + interconnectAttachment, + key, + prettyPrint, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInterconnectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInterconnectHttpRequest.java new file mode 100644 index 000000000000..2c8ec025066d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInterconnectHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetInterconnectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String interconnect; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetInterconnectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.interconnect = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetInterconnectHttpRequest( + String access_token, + String callback, + String fields, + String interconnect, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.interconnect = interconnect; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("interconnect")) { + return interconnect; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInterconnect() { + return interconnect; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetInterconnectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetInterconnectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetInterconnectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetInterconnectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String interconnect; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetInterconnectHttpRequest other) { + if (other == GetInterconnectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInterconnect() != null) { + this.interconnect = other.interconnect; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetInterconnectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.interconnect = source.interconnect; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInterconnect() { + return interconnect; + } + + public Builder setInterconnect(String interconnect) { + this.interconnect = interconnect; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetInterconnectHttpRequest build() { + String missing = ""; + + if (interconnect == null) { + missing += " interconnect"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetInterconnectHttpRequest( + access_token, callback, fields, interconnect, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInterconnect(this.interconnect); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetInterconnectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "interconnect=" + + interconnect + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetInterconnectHttpRequest) { + GetInterconnectHttpRequest that = (GetInterconnectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.interconnect, that.getInterconnect()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, interconnect, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInterconnectLocationHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInterconnectLocationHttpRequest.java new file mode 100644 index 000000000000..5c4f2c3d6990 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetInterconnectLocationHttpRequest.java @@ -0,0 +1,374 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetInterconnectLocationHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String interconnectLocation; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetInterconnectLocationHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.interconnectLocation = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetInterconnectLocationHttpRequest( + String access_token, + String callback, + String fields, + String interconnectLocation, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.interconnectLocation = interconnectLocation; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("interconnectLocation")) { + return interconnectLocation; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInterconnectLocation() { + return interconnectLocation; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetInterconnectLocationHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetInterconnectLocationHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetInterconnectLocationHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetInterconnectLocationHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String interconnectLocation; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetInterconnectLocationHttpRequest other) { + if (other == GetInterconnectLocationHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInterconnectLocation() != null) { + this.interconnectLocation = other.interconnectLocation; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetInterconnectLocationHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.interconnectLocation = source.interconnectLocation; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInterconnectLocation() { + return interconnectLocation; + } + + public Builder setInterconnectLocation(String interconnectLocation) { + this.interconnectLocation = interconnectLocation; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetInterconnectLocationHttpRequest build() { + String missing = ""; + + if (interconnectLocation == null) { + missing += " interconnectLocation"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetInterconnectLocationHttpRequest( + access_token, + callback, + fields, + interconnectLocation, + key, + prettyPrint, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInterconnectLocation(this.interconnectLocation); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetInterconnectLocationHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "interconnectLocation=" + + interconnectLocation + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetInterconnectLocationHttpRequest) { + GetInterconnectLocationHttpRequest that = (GetInterconnectLocationHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.interconnectLocation, that.getInterconnectLocation()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, interconnectLocation, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetLicenseCodeHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetLicenseCodeHttpRequest.java new file mode 100644 index 000000000000..34e074261a60 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetLicenseCodeHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetLicenseCodeHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String licenseCode; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetLicenseCodeHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.licenseCode = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetLicenseCodeHttpRequest( + String access_token, + String callback, + String fields, + String key, + String licenseCode, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.licenseCode = licenseCode; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("licenseCode")) { + return licenseCode; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getLicenseCode() { + return licenseCode; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetLicenseCodeHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetLicenseCodeHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetLicenseCodeHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetLicenseCodeHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String licenseCode; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetLicenseCodeHttpRequest other) { + if (other == GetLicenseCodeHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getLicenseCode() != null) { + this.licenseCode = other.licenseCode; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetLicenseCodeHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.licenseCode = source.licenseCode; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getLicenseCode() { + return licenseCode; + } + + public Builder setLicenseCode(String licenseCode) { + this.licenseCode = licenseCode; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetLicenseCodeHttpRequest build() { + String missing = ""; + + if (licenseCode == null) { + missing += " licenseCode"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetLicenseCodeHttpRequest( + access_token, callback, fields, key, licenseCode, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setLicenseCode(this.licenseCode); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetLicenseCodeHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "licenseCode=" + + licenseCode + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetLicenseCodeHttpRequest) { + GetLicenseCodeHttpRequest that = (GetLicenseCodeHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.licenseCode, that.getLicenseCode()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, licenseCode, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetLicenseHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetLicenseHttpRequest.java new file mode 100644 index 000000000000..cb6cddb8ab7c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetLicenseHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetLicenseHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String license; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetLicenseHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.license = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetLicenseHttpRequest( + String access_token, + String callback, + String fields, + String key, + String license, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.license = license; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("license")) { + return license; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getLicense() { + return license; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetLicenseHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetLicenseHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetLicenseHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetLicenseHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String license; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetLicenseHttpRequest other) { + if (other == GetLicenseHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getLicense() != null) { + this.license = other.license; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetLicenseHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.license = source.license; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getLicense() { + return license; + } + + public Builder setLicense(String license) { + this.license = license; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetLicenseHttpRequest build() { + String missing = ""; + + if (license == null) { + missing += " license"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetLicenseHttpRequest( + access_token, callback, fields, key, license, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setLicense(this.license); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetLicenseHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "license=" + + license + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetLicenseHttpRequest) { + GetLicenseHttpRequest that = (GetLicenseHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.license, that.getLicense()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, license, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetMachineTypeHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetMachineTypeHttpRequest.java new file mode 100644 index 000000000000..5af4426b2ed9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetMachineTypeHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetMachineTypeHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String machineType; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetMachineTypeHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.machineType = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetMachineTypeHttpRequest( + String access_token, + String callback, + String fields, + String key, + String machineType, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.machineType = machineType; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("machineType")) { + return machineType; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getMachineType() { + return machineType; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetMachineTypeHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetMachineTypeHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetMachineTypeHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetMachineTypeHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String machineType; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetMachineTypeHttpRequest other) { + if (other == GetMachineTypeHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMachineType() != null) { + this.machineType = other.machineType; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetMachineTypeHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.machineType = source.machineType; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getMachineType() { + return machineType; + } + + public Builder setMachineType(String machineType) { + this.machineType = machineType; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetMachineTypeHttpRequest build() { + String missing = ""; + + if (machineType == null) { + missing += " machineType"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetMachineTypeHttpRequest( + access_token, callback, fields, key, machineType, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setMachineType(this.machineType); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetMachineTypeHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "machineType=" + + machineType + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetMachineTypeHttpRequest) { + GetMachineTypeHttpRequest that = (GetMachineTypeHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.machineType, that.getMachineType()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, machineType, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetNetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetNetworkHttpRequest.java new file mode 100644 index 000000000000..6dbe5865035a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetNetworkHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetNetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String network; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetNetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.network = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetNetworkHttpRequest( + String access_token, + String callback, + String fields, + String key, + String network, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.network = network; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getNetwork() { + return network; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetNetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetNetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetNetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetNetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String network; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetNetworkHttpRequest other) { + if (other == GetNetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetNetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.network = source.network; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetNetworkHttpRequest build() { + String missing = ""; + + if (network == null) { + missing += " network"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetNetworkHttpRequest( + access_token, callback, fields, key, network, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setNetwork(this.network); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetNetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "network=" + + network + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetNetworkHttpRequest) { + GetNetworkHttpRequest that = (GetNetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, network, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetProjectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetProjectHttpRequest.java new file mode 100644 index 000000000000..ea0958bef2a4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetProjectHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetProjectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private GetProjectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetProjectHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetProjectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetProjectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetProjectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetProjectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetProjectHttpRequest other) { + if (other == GetProjectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetProjectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetProjectHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetProjectHttpRequest( + access_token, callback, fields, key, prettyPrint, project, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetProjectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetProjectHttpRequest) { + GetProjectHttpRequest that = (GetProjectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, project, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionAutoscalerHttpRequest.java new file mode 100644 index 000000000000..a7a2a7ab473c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionAutoscalerHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRegionAutoscalerHttpRequest implements ApiMessage { + private final String access_token; + private final String autoscaler; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetRegionAutoscalerHttpRequest() { + this.access_token = null; + this.autoscaler = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetRegionAutoscalerHttpRequest( + String access_token, + String autoscaler, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.autoscaler = autoscaler; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("autoscaler")) { + return autoscaler; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getAutoscaler() { + return autoscaler; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRegionAutoscalerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRegionAutoscalerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRegionAutoscalerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRegionAutoscalerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String autoscaler; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRegionAutoscalerHttpRequest other) { + if (other == GetRegionAutoscalerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAutoscaler() != null) { + this.autoscaler = other.autoscaler; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRegionAutoscalerHttpRequest source) { + this.access_token = source.access_token; + this.autoscaler = source.autoscaler; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Builder setAutoscaler(String autoscaler) { + this.autoscaler = autoscaler; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRegionAutoscalerHttpRequest build() { + String missing = ""; + + if (autoscaler == null) { + missing += " autoscaler"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRegionAutoscalerHttpRequest( + access_token, autoscaler, callback, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAutoscaler(this.autoscaler); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRegionAutoscalerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "autoscaler=" + + autoscaler + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRegionAutoscalerHttpRequest) { + GetRegionAutoscalerHttpRequest that = (GetRegionAutoscalerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.autoscaler, that.getAutoscaler()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, autoscaler, callback, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionBackendServiceHttpRequest.java new file mode 100644 index 000000000000..32dc24e1172b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionBackendServiceHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRegionBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final String backendService; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetRegionBackendServiceHttpRequest() { + this.access_token = null; + this.backendService = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetRegionBackendServiceHttpRequest( + String access_token, + String backendService, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.backendService = backendService; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendService")) { + return backendService; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendService() { + return backendService; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRegionBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRegionBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRegionBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRegionBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendService; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRegionBackendServiceHttpRequest other) { + if (other == GetRegionBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendService() != null) { + this.backendService = other.backendService; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRegionBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendService = source.backendService; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendService() { + return backendService; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRegionBackendServiceHttpRequest build() { + String missing = ""; + + if (backendService == null) { + missing += " backendService"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRegionBackendServiceHttpRequest( + access_token, backendService, callback, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendService(this.backendService); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRegionBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendService=" + + backendService + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRegionBackendServiceHttpRequest) { + GetRegionBackendServiceHttpRequest that = (GetRegionBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, backendService, callback, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionCommitmentHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionCommitmentHttpRequest.java new file mode 100644 index 000000000000..4e5eb300c90d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionCommitmentHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRegionCommitmentHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String commitment; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetRegionCommitmentHttpRequest() { + this.access_token = null; + this.callback = null; + this.commitment = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetRegionCommitmentHttpRequest( + String access_token, + String callback, + String commitment, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.commitment = commitment; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("commitment")) { + return commitment; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getCommitment() { + return commitment; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRegionCommitmentHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRegionCommitmentHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRegionCommitmentHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRegionCommitmentHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String commitment; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRegionCommitmentHttpRequest other) { + if (other == GetRegionCommitmentHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getCommitment() != null) { + this.commitment = other.commitment; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRegionCommitmentHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.commitment = source.commitment; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getCommitment() { + return commitment; + } + + public Builder setCommitment(String commitment) { + this.commitment = commitment; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRegionCommitmentHttpRequest build() { + String missing = ""; + + if (commitment == null) { + missing += " commitment"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRegionCommitmentHttpRequest( + access_token, callback, commitment, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setCommitment(this.commitment); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRegionCommitmentHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "commitment=" + + commitment + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRegionCommitmentHttpRequest) { + GetRegionCommitmentHttpRequest that = (GetRegionCommitmentHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.commitment, that.getCommitment()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, commitment, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionDiskHttpRequest.java new file mode 100644 index 000000000000..c3f4e636a34a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionDiskHttpRequest.java @@ -0,0 +1,366 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRegionDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String disk; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetRegionDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.disk = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetRegionDiskHttpRequest( + String access_token, + String callback, + String disk, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.disk = disk; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("disk")) { + return disk; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getDisk() { + return disk; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRegionDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRegionDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRegionDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRegionDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String disk; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRegionDiskHttpRequest other) { + if (other == GetRegionDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDisk() != null) { + this.disk = other.disk; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRegionDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.disk = source.disk; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDisk() { + return disk; + } + + public Builder setDisk(String disk) { + this.disk = disk; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRegionDiskHttpRequest build() { + String missing = ""; + + if (disk == null) { + missing += " disk"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRegionDiskHttpRequest( + access_token, callback, disk, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDisk(this.disk); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRegionDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "disk=" + + disk + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRegionDiskHttpRequest) { + GetRegionDiskHttpRequest that = (GetRegionDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.disk, that.getDisk()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(access_token, callback, disk, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionDiskTypeHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionDiskTypeHttpRequest.java new file mode 100644 index 000000000000..f1a0ca9dcec6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionDiskTypeHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRegionDiskTypeHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String diskType; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetRegionDiskTypeHttpRequest() { + this.access_token = null; + this.callback = null; + this.diskType = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetRegionDiskTypeHttpRequest( + String access_token, + String callback, + String diskType, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.diskType = diskType; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("diskType")) { + return diskType; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getDiskType() { + return diskType; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRegionDiskTypeHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRegionDiskTypeHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRegionDiskTypeHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRegionDiskTypeHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String diskType; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRegionDiskTypeHttpRequest other) { + if (other == GetRegionDiskTypeHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDiskType() != null) { + this.diskType = other.diskType; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRegionDiskTypeHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.diskType = source.diskType; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDiskType() { + return diskType; + } + + public Builder setDiskType(String diskType) { + this.diskType = diskType; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRegionDiskTypeHttpRequest build() { + String missing = ""; + + if (diskType == null) { + missing += " diskType"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRegionDiskTypeHttpRequest( + access_token, callback, diskType, fields, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDiskType(this.diskType); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRegionDiskTypeHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "diskType=" + + diskType + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRegionDiskTypeHttpRequest) { + GetRegionDiskTypeHttpRequest that = (GetRegionDiskTypeHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.diskType, that.getDiskType()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, diskType, fields, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionHttpRequest.java new file mode 100644 index 000000000000..e6a53479cce3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRegionHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private GetRegionHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private GetRegionHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRegionHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRegionHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRegionHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRegionHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRegionHttpRequest other) { + if (other == GetRegionHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRegionHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRegionHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRegionHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, region, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRegionHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRegionHttpRequest) { + GetRegionHttpRequest that = (GetRegionHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, region, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionInstanceGroupHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionInstanceGroupHttpRequest.java new file mode 100644 index 000000000000..bd32752142b1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionInstanceGroupHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRegionInstanceGroupHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroup; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetRegionInstanceGroupHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroup = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetRegionInstanceGroupHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroup, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroup = instanceGroup; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroup")) { + return instanceGroup; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRegionInstanceGroupHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRegionInstanceGroupHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRegionInstanceGroupHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRegionInstanceGroupHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroup; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRegionInstanceGroupHttpRequest other) { + if (other == GetRegionInstanceGroupHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroup() != null) { + this.instanceGroup = other.instanceGroup; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRegionInstanceGroupHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroup = source.instanceGroup; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRegionInstanceGroupHttpRequest build() { + String missing = ""; + + if (instanceGroup == null) { + missing += " instanceGroup"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRegionInstanceGroupHttpRequest( + access_token, callback, fields, instanceGroup, key, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroup(this.instanceGroup); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRegionInstanceGroupHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroup=" + + instanceGroup + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRegionInstanceGroupHttpRequest) { + GetRegionInstanceGroupHttpRequest that = (GetRegionInstanceGroupHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, instanceGroup, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..d53a58c42f46 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionInstanceGroupManagerHttpRequest.java @@ -0,0 +1,374 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRegionInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetRegionInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetRegionInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + String key, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRegionInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRegionInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRegionInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRegionInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRegionInstanceGroupManagerHttpRequest other) { + if (other == GetRegionInstanceGroupManagerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRegionInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRegionInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRegionInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRegionInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRegionInstanceGroupManagerHttpRequest) { + GetRegionInstanceGroupManagerHttpRequest that = (GetRegionInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, instanceGroupManager, key, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionOperationHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionOperationHttpRequest.java new file mode 100644 index 000000000000..9354e73dc6c3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRegionOperationHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRegionOperationHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String operation; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetRegionOperationHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.operation = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetRegionOperationHttpRequest( + String access_token, + String callback, + String fields, + String key, + String operation, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.operation = operation; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("operation")) { + return operation; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getOperation() { + return operation; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRegionOperationHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRegionOperationHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRegionOperationHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRegionOperationHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String operation; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRegionOperationHttpRequest other) { + if (other == GetRegionOperationHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getOperation() != null) { + this.operation = other.operation; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRegionOperationHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.operation = source.operation; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getOperation() { + return operation; + } + + public Builder setOperation(String operation) { + this.operation = operation; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRegionOperationHttpRequest build() { + String missing = ""; + + if (operation == null) { + missing += " operation"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRegionOperationHttpRequest( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setOperation(this.operation); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRegionOperationHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "operation=" + + operation + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRegionOperationHttpRequest) { + GetRegionOperationHttpRequest that = (GetRegionOperationHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.operation, that.getOperation()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRouteHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRouteHttpRequest.java new file mode 100644 index 000000000000..91f70cc51d78 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRouteHttpRequest.java @@ -0,0 +1,366 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRouteHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String route; + private final String userIp; + + private GetRouteHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.route = null; + this.userIp = null; + } + + private GetRouteHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String route, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.route = route; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("route")) { + return route; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRoute() { + return route; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRouteHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRouteHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRouteHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRouteHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String route; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRouteHttpRequest other) { + if (other == GetRouteHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRoute() != null) { + this.route = other.route; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRouteHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.route = source.route; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRoute() { + return route; + } + + public Builder setRoute(String route) { + this.route = route; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRouteHttpRequest build() { + String missing = ""; + + if (route == null) { + missing += " route"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRouteHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, route, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRoute(this.route); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRouteHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "route=" + + route + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRouteHttpRequest) { + GetRouteHttpRequest that = (GetRouteHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.route, that.getRoute()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(access_token, callback, fields, key, prettyPrint, quotaUser, route, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRouterHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRouterHttpRequest.java new file mode 100644 index 000000000000..2da040ec96e3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRouterHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRouterHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String router; + private final String userIp; + + private GetRouterHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.router = null; + this.userIp = null; + } + + private GetRouterHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String router, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.router = router; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("router")) { + return router; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRouter() { + return router; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRouterHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRouterHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRouterHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRouterHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String router; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRouterHttpRequest other) { + if (other == GetRouterHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRouter() != null) { + this.router = other.router; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRouterHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.router = source.router; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRouter() { + return router; + } + + public Builder setRouter(String router) { + this.router = router; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRouterHttpRequest build() { + String missing = ""; + + if (router == null) { + missing += " router"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRouterHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, router, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRouter(this.router); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRouterHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "router=" + + router + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRouterHttpRequest) { + GetRouterHttpRequest that = (GetRouterHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.router, that.getRouter()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, router, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRouterStatusRouterHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRouterStatusRouterHttpRequest.java new file mode 100644 index 000000000000..b359cd4020be --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetRouterStatusRouterHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetRouterStatusRouterHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String router; + private final String userIp; + + private GetRouterStatusRouterHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.router = null; + this.userIp = null; + } + + private GetRouterStatusRouterHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String router, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.router = router; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("router")) { + return router; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRouter() { + return router; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetRouterStatusRouterHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetRouterStatusRouterHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetRouterStatusRouterHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetRouterStatusRouterHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String router; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetRouterStatusRouterHttpRequest other) { + if (other == GetRouterStatusRouterHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRouter() != null) { + this.router = other.router; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetRouterStatusRouterHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.router = source.router; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRouter() { + return router; + } + + public Builder setRouter(String router) { + this.router = router; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetRouterStatusRouterHttpRequest build() { + String missing = ""; + + if (router == null) { + missing += " router"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetRouterStatusRouterHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, router, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRouter(this.router); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetRouterStatusRouterHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "router=" + + router + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetRouterStatusRouterHttpRequest) { + GetRouterStatusRouterHttpRequest that = (GetRouterStatusRouterHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.router, that.getRouter()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, router, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSerialPortOutputInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSerialPortOutputInstanceHttpRequest.java new file mode 100644 index 000000000000..9ee831ed202b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSerialPortOutputInstanceHttpRequest.java @@ -0,0 +1,436 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetSerialPortOutputInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final Integer port; + private final String prettyPrint; + private final String quotaUser; + private final String start; + private final String userIp; + + private GetSerialPortOutputInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.port = null; + this.prettyPrint = null; + this.quotaUser = null; + this.start = null; + this.userIp = null; + } + + private GetSerialPortOutputInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + String key, + Integer port, + String prettyPrint, + String quotaUser, + String start, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.port = port; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.start = start; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("port")) { + return port; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("start")) { + return start; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public Integer getPort() { + return port; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getStart() { + return start; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetSerialPortOutputInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetSerialPortOutputInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetSerialPortOutputInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetSerialPortOutputInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private Integer port; + private String prettyPrint; + private String quotaUser; + private String start; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetSerialPortOutputInstanceHttpRequest other) { + if (other == GetSerialPortOutputInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPort() != null) { + this.port = other.port; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getStart() != null) { + this.start = other.start; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetSerialPortOutputInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.port = source.port; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.start = source.start; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getPort() { + return port; + } + + public Builder setPort(Integer port) { + this.port = port; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getStart() { + return start; + } + + public Builder setStart(String start) { + this.start = start; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetSerialPortOutputInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetSerialPortOutputInstanceHttpRequest( + access_token, + callback, + fields, + instance, + key, + port, + prettyPrint, + quotaUser, + start, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setPort(this.port); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setStart(this.start); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetSerialPortOutputInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "port=" + + port + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "start=" + + start + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetSerialPortOutputInstanceHttpRequest) { + GetSerialPortOutputInstanceHttpRequest that = (GetSerialPortOutputInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.port, that.getPort()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.start, that.getStart()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, instance, key, port, prettyPrint, quotaUser, start, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSnapshotHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSnapshotHttpRequest.java new file mode 100644 index 000000000000..5b0822171072 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSnapshotHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetSnapshotHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String snapshot; + private final String userIp; + + private GetSnapshotHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.snapshot = null; + this.userIp = null; + } + + private GetSnapshotHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String snapshot, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.snapshot = snapshot; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("snapshot")) { + return snapshot; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getSnapshot() { + return snapshot; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetSnapshotHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetSnapshotHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetSnapshotHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetSnapshotHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String snapshot; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetSnapshotHttpRequest other) { + if (other == GetSnapshotHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getSnapshot() != null) { + this.snapshot = other.snapshot; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetSnapshotHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.snapshot = source.snapshot; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getSnapshot() { + return snapshot; + } + + public Builder setSnapshot(String snapshot) { + this.snapshot = snapshot; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetSnapshotHttpRequest build() { + String missing = ""; + + if (snapshot == null) { + missing += " snapshot"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetSnapshotHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, snapshot, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setSnapshot(this.snapshot); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetSnapshotHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "snapshot=" + + snapshot + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetSnapshotHttpRequest) { + GetSnapshotHttpRequest that = (GetSnapshotHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.snapshot, that.getSnapshot()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, snapshot, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSslCertificateHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSslCertificateHttpRequest.java new file mode 100644 index 000000000000..f5e8b0c99aa7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSslCertificateHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetSslCertificateHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String sslCertificate; + private final String userIp; + + private GetSslCertificateHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.sslCertificate = null; + this.userIp = null; + } + + private GetSslCertificateHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String sslCertificate, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.sslCertificate = sslCertificate; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("sslCertificate")) { + return sslCertificate; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getSslCertificate() { + return sslCertificate; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetSslCertificateHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetSslCertificateHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetSslCertificateHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetSslCertificateHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String sslCertificate; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetSslCertificateHttpRequest other) { + if (other == GetSslCertificateHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getSslCertificate() != null) { + this.sslCertificate = other.sslCertificate; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetSslCertificateHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.sslCertificate = source.sslCertificate; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getSslCertificate() { + return sslCertificate; + } + + public Builder setSslCertificate(String sslCertificate) { + this.sslCertificate = sslCertificate; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetSslCertificateHttpRequest build() { + String missing = ""; + + if (sslCertificate == null) { + missing += " sslCertificate"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetSslCertificateHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, sslCertificate, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setSslCertificate(this.sslCertificate); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetSslCertificateHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "sslCertificate=" + + sslCertificate + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetSslCertificateHttpRequest) { + GetSslCertificateHttpRequest that = (GetSslCertificateHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.sslCertificate, that.getSslCertificate()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, sslCertificate, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSslPolicyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSslPolicyHttpRequest.java new file mode 100644 index 000000000000..6e7dd8c3f033 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSslPolicyHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetSslPolicyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String sslPolicy; + private final String userIp; + + private GetSslPolicyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.sslPolicy = null; + this.userIp = null; + } + + private GetSslPolicyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String sslPolicy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.sslPolicy = sslPolicy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("sslPolicy")) { + return sslPolicy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetSslPolicyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetSslPolicyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetSslPolicyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetSslPolicyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String sslPolicy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetSslPolicyHttpRequest other) { + if (other == GetSslPolicyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getSslPolicy() != null) { + this.sslPolicy = other.sslPolicy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetSslPolicyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.sslPolicy = source.sslPolicy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public Builder setSslPolicy(String sslPolicy) { + this.sslPolicy = sslPolicy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetSslPolicyHttpRequest build() { + String missing = ""; + + if (sslPolicy == null) { + missing += " sslPolicy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetSslPolicyHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, sslPolicy, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setSslPolicy(this.sslPolicy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetSslPolicyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "sslPolicy=" + + sslPolicy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetSslPolicyHttpRequest) { + GetSslPolicyHttpRequest that = (GetSslPolicyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.sslPolicy, that.getSslPolicy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, sslPolicy, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSubnetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSubnetworkHttpRequest.java new file mode 100644 index 000000000000..32037a6780d0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetSubnetworkHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetSubnetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String subnetwork; + private final String userIp; + + private GetSubnetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.subnetwork = null; + this.userIp = null; + } + + private GetSubnetworkHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String subnetwork, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.subnetwork = subnetwork; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("subnetwork")) { + return subnetwork; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getSubnetwork() { + return subnetwork; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetSubnetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetSubnetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetSubnetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetSubnetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String subnetwork; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetSubnetworkHttpRequest other) { + if (other == GetSubnetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getSubnetwork() != null) { + this.subnetwork = other.subnetwork; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetSubnetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.subnetwork = source.subnetwork; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getSubnetwork() { + return subnetwork; + } + + public Builder setSubnetwork(String subnetwork) { + this.subnetwork = subnetwork; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetSubnetworkHttpRequest build() { + String missing = ""; + + if (subnetwork == null) { + missing += " subnetwork"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetSubnetworkHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, subnetwork, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setSubnetwork(this.subnetwork); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetSubnetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "subnetwork=" + + subnetwork + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetSubnetworkHttpRequest) { + GetSubnetworkHttpRequest that = (GetSubnetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.subnetwork, that.getSubnetwork()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, subnetwork, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetHttpProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetHttpProxyHttpRequest.java new file mode 100644 index 000000000000..e62b679f239b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetHttpProxyHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetTargetHttpProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String targetHttpProxy; + private final String userIp; + + private GetTargetHttpProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.targetHttpProxy = null; + this.userIp = null; + } + + private GetTargetHttpProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String targetHttpProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.targetHttpProxy = targetHttpProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("targetHttpProxy")) { + return targetHttpProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getTargetHttpProxy() { + return targetHttpProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetTargetHttpProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetTargetHttpProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetTargetHttpProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetTargetHttpProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String targetHttpProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetTargetHttpProxyHttpRequest other) { + if (other == GetTargetHttpProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getTargetHttpProxy() != null) { + this.targetHttpProxy = other.targetHttpProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetTargetHttpProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.targetHttpProxy = source.targetHttpProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getTargetHttpProxy() { + return targetHttpProxy; + } + + public Builder setTargetHttpProxy(String targetHttpProxy) { + this.targetHttpProxy = targetHttpProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetTargetHttpProxyHttpRequest build() { + String missing = ""; + + if (targetHttpProxy == null) { + missing += " targetHttpProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetTargetHttpProxyHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, targetHttpProxy, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setTargetHttpProxy(this.targetHttpProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetTargetHttpProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "targetHttpProxy=" + + targetHttpProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetTargetHttpProxyHttpRequest) { + GetTargetHttpProxyHttpRequest that = (GetTargetHttpProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.targetHttpProxy, that.getTargetHttpProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, targetHttpProxy, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetHttpsProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetHttpsProxyHttpRequest.java new file mode 100644 index 000000000000..501ec52d64b2 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetHttpsProxyHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetTargetHttpsProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String targetHttpsProxy; + private final String userIp; + + private GetTargetHttpsProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.targetHttpsProxy = null; + this.userIp = null; + } + + private GetTargetHttpsProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String targetHttpsProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.targetHttpsProxy = targetHttpsProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("targetHttpsProxy")) { + return targetHttpsProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetTargetHttpsProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetTargetHttpsProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetTargetHttpsProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetTargetHttpsProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String targetHttpsProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetTargetHttpsProxyHttpRequest other) { + if (other == GetTargetHttpsProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getTargetHttpsProxy() != null) { + this.targetHttpsProxy = other.targetHttpsProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetTargetHttpsProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.targetHttpsProxy = source.targetHttpsProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public Builder setTargetHttpsProxy(String targetHttpsProxy) { + this.targetHttpsProxy = targetHttpsProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetTargetHttpsProxyHttpRequest build() { + String missing = ""; + + if (targetHttpsProxy == null) { + missing += " targetHttpsProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetTargetHttpsProxyHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, targetHttpsProxy, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setTargetHttpsProxy(this.targetHttpsProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetTargetHttpsProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "targetHttpsProxy=" + + targetHttpsProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetTargetHttpsProxyHttpRequest) { + GetTargetHttpsProxyHttpRequest that = (GetTargetHttpsProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.targetHttpsProxy, that.getTargetHttpsProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, targetHttpsProxy, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetInstanceHttpRequest.java new file mode 100644 index 000000000000..9ef98bb1b6d3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetInstanceHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetTargetInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String targetInstance; + private final String userIp; + + private GetTargetInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.targetInstance = null; + this.userIp = null; + } + + private GetTargetInstanceHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String targetInstance, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.targetInstance = targetInstance; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("targetInstance")) { + return targetInstance; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getTargetInstance() { + return targetInstance; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetTargetInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetTargetInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetTargetInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetTargetInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String targetInstance; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetTargetInstanceHttpRequest other) { + if (other == GetTargetInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getTargetInstance() != null) { + this.targetInstance = other.targetInstance; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetTargetInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.targetInstance = source.targetInstance; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getTargetInstance() { + return targetInstance; + } + + public Builder setTargetInstance(String targetInstance) { + this.targetInstance = targetInstance; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetTargetInstanceHttpRequest build() { + String missing = ""; + + if (targetInstance == null) { + missing += " targetInstance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetTargetInstanceHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, targetInstance, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setTargetInstance(this.targetInstance); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetTargetInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "targetInstance=" + + targetInstance + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetTargetInstanceHttpRequest) { + GetTargetInstanceHttpRequest that = (GetTargetInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.targetInstance, that.getTargetInstance()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, targetInstance, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetPoolHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetPoolHttpRequest.java new file mode 100644 index 000000000000..1b37944d89f9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetPoolHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetTargetPoolHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String targetPool; + private final String userIp; + + private GetTargetPoolHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.targetPool = null; + this.userIp = null; + } + + private GetTargetPoolHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String targetPool, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.targetPool = targetPool; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("targetPool")) { + return targetPool; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getTargetPool() { + return targetPool; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetTargetPoolHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetTargetPoolHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetTargetPoolHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetTargetPoolHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String targetPool; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetTargetPoolHttpRequest other) { + if (other == GetTargetPoolHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getTargetPool() != null) { + this.targetPool = other.targetPool; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetTargetPoolHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.targetPool = source.targetPool; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getTargetPool() { + return targetPool; + } + + public Builder setTargetPool(String targetPool) { + this.targetPool = targetPool; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetTargetPoolHttpRequest build() { + String missing = ""; + + if (targetPool == null) { + missing += " targetPool"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetTargetPoolHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, targetPool, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setTargetPool(this.targetPool); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetTargetPoolHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "targetPool=" + + targetPool + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetTargetPoolHttpRequest) { + GetTargetPoolHttpRequest that = (GetTargetPoolHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.targetPool, that.getTargetPool()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, targetPool, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetSslProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetSslProxyHttpRequest.java new file mode 100644 index 000000000000..547104a99a25 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetSslProxyHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetTargetSslProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String targetSslProxy; + private final String userIp; + + private GetTargetSslProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.targetSslProxy = null; + this.userIp = null; + } + + private GetTargetSslProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String targetSslProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.targetSslProxy = targetSslProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("targetSslProxy")) { + return targetSslProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetTargetSslProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetTargetSslProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetTargetSslProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetTargetSslProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String targetSslProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetTargetSslProxyHttpRequest other) { + if (other == GetTargetSslProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getTargetSslProxy() != null) { + this.targetSslProxy = other.targetSslProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetTargetSslProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.targetSslProxy = source.targetSslProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public Builder setTargetSslProxy(String targetSslProxy) { + this.targetSslProxy = targetSslProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetTargetSslProxyHttpRequest build() { + String missing = ""; + + if (targetSslProxy == null) { + missing += " targetSslProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetTargetSslProxyHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, targetSslProxy, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setTargetSslProxy(this.targetSslProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetTargetSslProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "targetSslProxy=" + + targetSslProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetTargetSslProxyHttpRequest) { + GetTargetSslProxyHttpRequest that = (GetTargetSslProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.targetSslProxy, that.getTargetSslProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, targetSslProxy, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetTcpProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetTcpProxyHttpRequest.java new file mode 100644 index 000000000000..add3781e55d5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetTcpProxyHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetTargetTcpProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String targetTcpProxy; + private final String userIp; + + private GetTargetTcpProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.targetTcpProxy = null; + this.userIp = null; + } + + private GetTargetTcpProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String targetTcpProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.targetTcpProxy = targetTcpProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("targetTcpProxy")) { + return targetTcpProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getTargetTcpProxy() { + return targetTcpProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetTargetTcpProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetTargetTcpProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetTargetTcpProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetTargetTcpProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String targetTcpProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetTargetTcpProxyHttpRequest other) { + if (other == GetTargetTcpProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getTargetTcpProxy() != null) { + this.targetTcpProxy = other.targetTcpProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetTargetTcpProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.targetTcpProxy = source.targetTcpProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getTargetTcpProxy() { + return targetTcpProxy; + } + + public Builder setTargetTcpProxy(String targetTcpProxy) { + this.targetTcpProxy = targetTcpProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetTargetTcpProxyHttpRequest build() { + String missing = ""; + + if (targetTcpProxy == null) { + missing += " targetTcpProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetTargetTcpProxyHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, targetTcpProxy, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setTargetTcpProxy(this.targetTcpProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetTargetTcpProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "targetTcpProxy=" + + targetTcpProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetTargetTcpProxyHttpRequest) { + GetTargetTcpProxyHttpRequest that = (GetTargetTcpProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.targetTcpProxy, that.getTargetTcpProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, targetTcpProxy, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetVpnGatewayHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetVpnGatewayHttpRequest.java new file mode 100644 index 000000000000..b37f4baf5e50 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetTargetVpnGatewayHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetTargetVpnGatewayHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String targetVpnGateway; + private final String userIp; + + private GetTargetVpnGatewayHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.targetVpnGateway = null; + this.userIp = null; + } + + private GetTargetVpnGatewayHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String targetVpnGateway, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.targetVpnGateway = targetVpnGateway; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("targetVpnGateway")) { + return targetVpnGateway; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getTargetVpnGateway() { + return targetVpnGateway; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetTargetVpnGatewayHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetTargetVpnGatewayHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetTargetVpnGatewayHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetTargetVpnGatewayHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String targetVpnGateway; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetTargetVpnGatewayHttpRequest other) { + if (other == GetTargetVpnGatewayHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getTargetVpnGateway() != null) { + this.targetVpnGateway = other.targetVpnGateway; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetTargetVpnGatewayHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.targetVpnGateway = source.targetVpnGateway; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getTargetVpnGateway() { + return targetVpnGateway; + } + + public Builder setTargetVpnGateway(String targetVpnGateway) { + this.targetVpnGateway = targetVpnGateway; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetTargetVpnGatewayHttpRequest build() { + String missing = ""; + + if (targetVpnGateway == null) { + missing += " targetVpnGateway"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetTargetVpnGatewayHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, targetVpnGateway, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setTargetVpnGateway(this.targetVpnGateway); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetTargetVpnGatewayHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "targetVpnGateway=" + + targetVpnGateway + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetTargetVpnGatewayHttpRequest) { + GetTargetVpnGatewayHttpRequest that = (GetTargetVpnGatewayHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.targetVpnGateway, that.getTargetVpnGateway()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, targetVpnGateway, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetUrlMapHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetUrlMapHttpRequest.java new file mode 100644 index 000000000000..af52761d6aa8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetUrlMapHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetUrlMapHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String urlMap; + private final String userIp; + + private GetUrlMapHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.urlMap = null; + this.userIp = null; + } + + private GetUrlMapHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String urlMap, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.urlMap = urlMap; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("urlMap")) { + return urlMap; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUrlMap() { + return urlMap; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetUrlMapHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetUrlMapHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetUrlMapHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetUrlMapHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String urlMap; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetUrlMapHttpRequest other) { + if (other == GetUrlMapHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUrlMap() != null) { + this.urlMap = other.urlMap; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetUrlMapHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.urlMap = source.urlMap; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUrlMap() { + return urlMap; + } + + public Builder setUrlMap(String urlMap) { + this.urlMap = urlMap; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetUrlMapHttpRequest build() { + String missing = ""; + + if (urlMap == null) { + missing += " urlMap"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetUrlMapHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, urlMap, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUrlMap(this.urlMap); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetUrlMapHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "urlMap=" + + urlMap + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetUrlMapHttpRequest) { + GetUrlMapHttpRequest that = (GetUrlMapHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.urlMap, that.getUrlMap()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, urlMap, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetVpnTunnelHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetVpnTunnelHttpRequest.java new file mode 100644 index 000000000000..ed991eda312e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetVpnTunnelHttpRequest.java @@ -0,0 +1,366 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetVpnTunnelHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String vpnTunnel; + + private GetVpnTunnelHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.vpnTunnel = null; + } + + private GetVpnTunnelHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp, + String vpnTunnel) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.vpnTunnel = vpnTunnel; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("vpnTunnel")) { + return vpnTunnel; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getVpnTunnel() { + return vpnTunnel; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetVpnTunnelHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetVpnTunnelHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetVpnTunnelHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetVpnTunnelHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String vpnTunnel; + + Builder() {} + + public Builder mergeFrom(GetVpnTunnelHttpRequest other) { + if (other == GetVpnTunnelHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getVpnTunnel() != null) { + this.vpnTunnel = other.vpnTunnel; + } + return this; + } + + Builder(GetVpnTunnelHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.vpnTunnel = source.vpnTunnel; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getVpnTunnel() { + return vpnTunnel; + } + + public Builder setVpnTunnel(String vpnTunnel) { + this.vpnTunnel = vpnTunnel; + return this; + } + + public GetVpnTunnelHttpRequest build() { + String missing = ""; + + if (vpnTunnel == null) { + missing += " vpnTunnel"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetVpnTunnelHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, userIp, vpnTunnel); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setVpnTunnel(this.vpnTunnel); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetVpnTunnelHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "vpnTunnel=" + + vpnTunnel + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetVpnTunnelHttpRequest) { + GetVpnTunnelHttpRequest that = (GetVpnTunnelHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.vpnTunnel, that.getVpnTunnel()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, quotaUser, userIp, vpnTunnel); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetXpnHostProjectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetXpnHostProjectHttpRequest.java new file mode 100644 index 000000000000..f163158b66f4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetXpnHostProjectHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetXpnHostProjectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private GetXpnHostProjectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetXpnHostProjectHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetXpnHostProjectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetXpnHostProjectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetXpnHostProjectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetXpnHostProjectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetXpnHostProjectHttpRequest other) { + if (other == GetXpnHostProjectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetXpnHostProjectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetXpnHostProjectHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetXpnHostProjectHttpRequest( + access_token, callback, fields, key, prettyPrint, project, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetXpnHostProjectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetXpnHostProjectHttpRequest) { + GetXpnHostProjectHttpRequest that = (GetXpnHostProjectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, prettyPrint, project, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetXpnResourcesProjectsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetXpnResourcesProjectsHttpRequest.java new file mode 100644 index 000000000000..b053e307ed0c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetXpnResourcesProjectsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetXpnResourcesProjectsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private GetXpnResourcesProjectsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetXpnResourcesProjectsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetXpnResourcesProjectsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetXpnResourcesProjectsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetXpnResourcesProjectsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetXpnResourcesProjectsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetXpnResourcesProjectsHttpRequest other) { + if (other == GetXpnResourcesProjectsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetXpnResourcesProjectsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetXpnResourcesProjectsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetXpnResourcesProjectsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetXpnResourcesProjectsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetXpnResourcesProjectsHttpRequest) { + GetXpnResourcesProjectsHttpRequest that = (GetXpnResourcesProjectsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetZoneHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetZoneHttpRequest.java new file mode 100644 index 000000000000..3232d136a0d3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetZoneHttpRequest.java @@ -0,0 +1,365 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetZoneHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String zone; + + private GetZoneHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.zone = null; + } + + private GetZoneHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetZoneHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetZoneHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetZoneHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetZoneHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(GetZoneHttpRequest other) { + if (other == GetZoneHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(GetZoneHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public GetZoneHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetZoneHttpRequest( + access_token, callback, fields, key, prettyPrint, quotaUser, userIp, zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetZoneHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetZoneHttpRequest) { + GetZoneHttpRequest that = (GetZoneHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(access_token, callback, fields, key, prettyPrint, quotaUser, userIp, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetZoneOperationHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetZoneOperationHttpRequest.java new file mode 100644 index 000000000000..bd5fd02a5146 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GetZoneOperationHttpRequest.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GetZoneOperationHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String operation; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private GetZoneOperationHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.operation = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private GetZoneOperationHttpRequest( + String access_token, + String callback, + String fields, + String key, + String operation, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.operation = operation; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("operation")) { + return operation; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getOperation() { + return operation; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GetZoneOperationHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GetZoneOperationHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GetZoneOperationHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GetZoneOperationHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String operation; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(GetZoneOperationHttpRequest other) { + if (other == GetZoneOperationHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getOperation() != null) { + this.operation = other.operation; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(GetZoneOperationHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.operation = source.operation; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getOperation() { + return operation; + } + + public Builder setOperation(String operation) { + this.operation = operation; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public GetZoneOperationHttpRequest build() { + String missing = ""; + + if (operation == null) { + missing += " operation"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new GetZoneOperationHttpRequest( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setOperation(this.operation); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "GetZoneOperationHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "operation=" + + operation + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GetZoneOperationHttpRequest) { + GetZoneOperationHttpRequest that = (GetZoneOperationHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.operation, that.getOperation()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, operation, prettyPrint, quotaUser, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalAddressClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalAddressClient.java new file mode 100644 index 000000000000..28567e8599c8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalAddressClient.java @@ -0,0 +1,710 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.GlobalAddressStub; +import com.google.cloud.compute.v1.stub.GlobalAddressStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+ *   ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
+ *   Operation response = globalAddressClient.deleteGlobalAddress(address);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the globalAddressClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of GlobalAddressSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * GlobalAddressSettings globalAddressSettings =
+ *     GlobalAddressSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * GlobalAddressClient globalAddressClient =
+ *     GlobalAddressClient.create(globalAddressSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * GlobalAddressSettings globalAddressSettings =
+ *     GlobalAddressSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * GlobalAddressClient globalAddressClient =
+ *     GlobalAddressClient.create(globalAddressSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class GlobalAddressClient implements BackgroundResource { + private final GlobalAddressSettings settings; + private final GlobalAddressStub stub; + + /** Constructs an instance of GlobalAddressClient with default settings. */ + public static final GlobalAddressClient create() throws IOException { + return create(GlobalAddressSettings.newBuilder().build()); + } + + /** + * Constructs an instance of GlobalAddressClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final GlobalAddressClient create(GlobalAddressSettings settings) + throws IOException { + return new GlobalAddressClient(settings); + } + + /** + * Constructs an instance of GlobalAddressClient, using the given stub for making calls. This is + * for advanced usage - prefer to use GlobalAddressSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final GlobalAddressClient create(GlobalAddressStub stub) { + return new GlobalAddressClient(stub); + } + + /** + * Constructs an instance of GlobalAddressClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GlobalAddressClient(GlobalAddressSettings settings) throws IOException { + this.settings = settings; + this.stub = ((GlobalAddressStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected GlobalAddressClient(GlobalAddressStub stub) { + this.settings = null; + this.stub = stub; + } + + public final GlobalAddressSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public GlobalAddressStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified address resource. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
+   *   Operation response = globalAddressClient.deleteGlobalAddress(address);
+   * }
+   * 
+ * + * @param address Name of the address resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteGlobalAddress(ProjectGlobalAddressName address) { + + DeleteGlobalAddressHttpRequest request = + DeleteGlobalAddressHttpRequest.newBuilder() + .setAddress(address == null ? null : address.toString()) + .build(); + return deleteGlobalAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified address resource. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
+   *   Operation response = globalAddressClient.deleteGlobalAddress(address.toString());
+   * }
+   * 
+ * + * @param address Name of the address resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteGlobalAddress(String address) { + + DeleteGlobalAddressHttpRequest request = + DeleteGlobalAddressHttpRequest.newBuilder().setAddress(address).build(); + return deleteGlobalAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified address resource. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
+   *   DeleteGlobalAddressHttpRequest request = DeleteGlobalAddressHttpRequest.newBuilder()
+   *     .setAddress(address.toString())
+   *     .build();
+   *   Operation response = globalAddressClient.deleteGlobalAddress(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteGlobalAddress(DeleteGlobalAddressHttpRequest request) { + return deleteGlobalAddressCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified address resource. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
+   *   DeleteGlobalAddressHttpRequest request = DeleteGlobalAddressHttpRequest.newBuilder()
+   *     .setAddress(address.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = globalAddressClient.deleteGlobalAddressCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteGlobalAddressCallable() { + return stub.deleteGlobalAddressCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified address resource. Gets a list of available addresses by making a list() + * request. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
+   *   Address response = globalAddressClient.getGlobalAddress(address);
+   * }
+   * 
+ * + * @param address Name of the address resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Address getGlobalAddress(ProjectGlobalAddressName address) { + + GetGlobalAddressHttpRequest request = + GetGlobalAddressHttpRequest.newBuilder() + .setAddress(address == null ? null : address.toString()) + .build(); + return getGlobalAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified address resource. Gets a list of available addresses by making a list() + * request. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
+   *   Address response = globalAddressClient.getGlobalAddress(address.toString());
+   * }
+   * 
+ * + * @param address Name of the address resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Address getGlobalAddress(String address) { + + GetGlobalAddressHttpRequest request = + GetGlobalAddressHttpRequest.newBuilder().setAddress(address).build(); + return getGlobalAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified address resource. Gets a list of available addresses by making a list() + * request. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
+   *   GetGlobalAddressHttpRequest request = GetGlobalAddressHttpRequest.newBuilder()
+   *     .setAddress(address.toString())
+   *     .build();
+   *   Address response = globalAddressClient.getGlobalAddress(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Address getGlobalAddress(GetGlobalAddressHttpRequest request) { + return getGlobalAddressCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified address resource. Gets a list of available addresses by making a list() + * request. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
+   *   GetGlobalAddressHttpRequest request = GetGlobalAddressHttpRequest.newBuilder()
+   *     .setAddress(address.toString())
+   *     .build();
+   *   ApiFuture<Address> future = globalAddressClient.getGlobalAddressCallable().futureCall(request);
+   *   // Do something
+   *   Address response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getGlobalAddressCallable() { + return stub.getGlobalAddressCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an address resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Address addressResource = Address.newBuilder().build();
+   *   Operation response = globalAddressClient.insertGlobalAddress(project, addressResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param addressResource A reserved address resource. (== resource_for beta.addresses ==) (== + * resource_for v1.addresses ==) (== resource_for beta.globalAddresses ==) (== resource_for + * v1.globalAddresses ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertGlobalAddress(ProjectName project, Address addressResource) { + + InsertGlobalAddressHttpRequest request = + InsertGlobalAddressHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setAddressResource(addressResource) + .build(); + return insertGlobalAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an address resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Address addressResource = Address.newBuilder().build();
+   *   Operation response = globalAddressClient.insertGlobalAddress(project.toString(), addressResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param addressResource A reserved address resource. (== resource_for beta.addresses ==) (== + * resource_for v1.addresses ==) (== resource_for beta.globalAddresses ==) (== resource_for + * v1.globalAddresses ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertGlobalAddress(String project, Address addressResource) { + + InsertGlobalAddressHttpRequest request = + InsertGlobalAddressHttpRequest.newBuilder() + .setProject(project) + .setAddressResource(addressResource) + .build(); + return insertGlobalAddress(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an address resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Address addressResource = Address.newBuilder().build();
+   *   InsertGlobalAddressHttpRequest request = InsertGlobalAddressHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setAddressResource(addressResource)
+   *     .build();
+   *   Operation response = globalAddressClient.insertGlobalAddress(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertGlobalAddress(InsertGlobalAddressHttpRequest request) { + return insertGlobalAddressCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an address resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Address addressResource = Address.newBuilder().build();
+   *   InsertGlobalAddressHttpRequest request = InsertGlobalAddressHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setAddressResource(addressResource)
+   *     .build();
+   *   ApiFuture<Operation> future = globalAddressClient.insertGlobalAddressCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertGlobalAddressCallable() { + return stub.insertGlobalAddressCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of global addresses. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Address element : globalAddressClient.listGlobalAddresses(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListGlobalAddressesPagedResponse listGlobalAddresses(ProjectName project) { + ListGlobalAddressesHttpRequest request = + ListGlobalAddressesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listGlobalAddresses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of global addresses. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Address element : globalAddressClient.listGlobalAddresses(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListGlobalAddressesPagedResponse listGlobalAddresses(String project) { + ListGlobalAddressesHttpRequest request = + ListGlobalAddressesHttpRequest.newBuilder().setProject(project).build(); + return listGlobalAddresses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of global addresses. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListGlobalAddressesHttpRequest request = ListGlobalAddressesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (Address element : globalAddressClient.listGlobalAddresses(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListGlobalAddressesPagedResponse listGlobalAddresses( + ListGlobalAddressesHttpRequest request) { + return listGlobalAddressesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of global addresses. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListGlobalAddressesHttpRequest request = ListGlobalAddressesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListGlobalAddressesPagedResponse> future = globalAddressClient.listGlobalAddressesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Address element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listGlobalAddressesPagedCallable() { + return stub.listGlobalAddressesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of global addresses. + * + *

Sample code: + * + *


+   * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListGlobalAddressesHttpRequest request = ListGlobalAddressesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     AddressList response = globalAddressClient.listGlobalAddressesCallable().call(request);
+   *     for (Address element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listGlobalAddressesCallable() { + return stub.listGlobalAddressesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListGlobalAddressesPagedResponse + extends AbstractPagedListResponse< + ListGlobalAddressesHttpRequest, AddressList, Address, ListGlobalAddressesPage, + ListGlobalAddressesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListGlobalAddressesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListGlobalAddressesPagedResponse apply(ListGlobalAddressesPage input) { + return new ListGlobalAddressesPagedResponse(input); + } + }); + } + + private ListGlobalAddressesPagedResponse(ListGlobalAddressesPage page) { + super(page, ListGlobalAddressesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListGlobalAddressesPage + extends AbstractPage< + ListGlobalAddressesHttpRequest, AddressList, Address, ListGlobalAddressesPage> { + + private ListGlobalAddressesPage( + PageContext context, + AddressList response) { + super(context, response); + } + + private static ListGlobalAddressesPage createEmptyPage() { + return new ListGlobalAddressesPage(null, null); + } + + @Override + protected ListGlobalAddressesPage createPage( + PageContext context, + AddressList response) { + return new ListGlobalAddressesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListGlobalAddressesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListGlobalAddressesHttpRequest, AddressList, Address, ListGlobalAddressesPage, + ListGlobalAddressesFixedSizeCollection> { + + private ListGlobalAddressesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListGlobalAddressesFixedSizeCollection createEmptyCollection() { + return new ListGlobalAddressesFixedSizeCollection(null, 0); + } + + @Override + protected ListGlobalAddressesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListGlobalAddressesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalAddressSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalAddressSettings.java new file mode 100644 index 000000000000..07dc9b12dd06 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalAddressSettings.java @@ -0,0 +1,222 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.GlobalAddressClient.ListGlobalAddressesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.GlobalAddressStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link GlobalAddressClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteGlobalAddress to 30 seconds: + * + *

+ * 
+ * GlobalAddressSettings.Builder globalAddressSettingsBuilder =
+ *     GlobalAddressSettings.newBuilder();
+ * globalAddressSettingsBuilder.deleteGlobalAddressSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * GlobalAddressSettings globalAddressSettings = globalAddressSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class GlobalAddressSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteGlobalAddress. */ + public UnaryCallSettings + deleteGlobalAddressSettings() { + return ((GlobalAddressStubSettings) getStubSettings()).deleteGlobalAddressSettings(); + } + + /** Returns the object with the settings used for calls to getGlobalAddress. */ + public UnaryCallSettings getGlobalAddressSettings() { + return ((GlobalAddressStubSettings) getStubSettings()).getGlobalAddressSettings(); + } + + /** Returns the object with the settings used for calls to insertGlobalAddress. */ + public UnaryCallSettings + insertGlobalAddressSettings() { + return ((GlobalAddressStubSettings) getStubSettings()).insertGlobalAddressSettings(); + } + + /** Returns the object with the settings used for calls to listGlobalAddresses. */ + public PagedCallSettings< + ListGlobalAddressesHttpRequest, AddressList, ListGlobalAddressesPagedResponse> + listGlobalAddressesSettings() { + return ((GlobalAddressStubSettings) getStubSettings()).listGlobalAddressesSettings(); + } + + public static final GlobalAddressSettings create(GlobalAddressStubSettings stub) + throws IOException { + return new GlobalAddressSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return GlobalAddressStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return GlobalAddressStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return GlobalAddressStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return GlobalAddressStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GlobalAddressStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return GlobalAddressStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return GlobalAddressStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return GlobalAddressStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected GlobalAddressSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for GlobalAddressSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(GlobalAddressStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(GlobalAddressStubSettings.newBuilder()); + } + + protected Builder(GlobalAddressSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(GlobalAddressStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public GlobalAddressStubSettings.Builder getStubSettingsBuilder() { + return ((GlobalAddressStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteGlobalAddress. */ + public UnaryCallSettings.Builder + deleteGlobalAddressSettings() { + return getStubSettingsBuilder().deleteGlobalAddressSettings(); + } + + /** Returns the builder for the settings used for calls to getGlobalAddress. */ + public UnaryCallSettings.Builder + getGlobalAddressSettings() { + return getStubSettingsBuilder().getGlobalAddressSettings(); + } + + /** Returns the builder for the settings used for calls to insertGlobalAddress. */ + public UnaryCallSettings.Builder + insertGlobalAddressSettings() { + return getStubSettingsBuilder().insertGlobalAddressSettings(); + } + + /** Returns the builder for the settings used for calls to listGlobalAddresses. */ + public PagedCallSettings.Builder< + ListGlobalAddressesHttpRequest, AddressList, ListGlobalAddressesPagedResponse> + listGlobalAddressesSettings() { + return getStubSettingsBuilder().listGlobalAddressesSettings(); + } + + @Override + public GlobalAddressSettings build() throws IOException { + return new GlobalAddressSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalForwardingRuleClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalForwardingRuleClient.java new file mode 100644 index 000000000000..30a902acdfe2 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalForwardingRuleClient.java @@ -0,0 +1,853 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.GlobalForwardingRuleStub; +import com.google.cloud.compute.v1.stub.GlobalForwardingRuleStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+ *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+ *   Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(forwardingRule);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the globalForwardingRuleClient object to clean up + * resources such as threads. In the example above, try-with-resources is used, which automatically + * calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of GlobalForwardingRuleSettings + * to create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * GlobalForwardingRuleSettings globalForwardingRuleSettings =
+ *     GlobalForwardingRuleSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * GlobalForwardingRuleClient globalForwardingRuleClient =
+ *     GlobalForwardingRuleClient.create(globalForwardingRuleSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * GlobalForwardingRuleSettings globalForwardingRuleSettings =
+ *     GlobalForwardingRuleSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * GlobalForwardingRuleClient globalForwardingRuleClient =
+ *     GlobalForwardingRuleClient.create(globalForwardingRuleSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class GlobalForwardingRuleClient implements BackgroundResource { + private final GlobalForwardingRuleSettings settings; + private final GlobalForwardingRuleStub stub; + + /** Constructs an instance of GlobalForwardingRuleClient with default settings. */ + public static final GlobalForwardingRuleClient create() throws IOException { + return create(GlobalForwardingRuleSettings.newBuilder().build()); + } + + /** + * Constructs an instance of GlobalForwardingRuleClient, using the given settings. The channels + * are created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final GlobalForwardingRuleClient create(GlobalForwardingRuleSettings settings) + throws IOException { + return new GlobalForwardingRuleClient(settings); + } + + /** + * Constructs an instance of GlobalForwardingRuleClient, using the given stub for making calls. + * This is for advanced usage - prefer to use GlobalForwardingRuleSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final GlobalForwardingRuleClient create(GlobalForwardingRuleStub stub) { + return new GlobalForwardingRuleClient(stub); + } + + /** + * Constructs an instance of GlobalForwardingRuleClient, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GlobalForwardingRuleClient(GlobalForwardingRuleSettings settings) throws IOException { + this.settings = settings; + this.stub = ((GlobalForwardingRuleStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected GlobalForwardingRuleClient(GlobalForwardingRuleStub stub) { + this.settings = null; + this.stub = stub; + } + + public final GlobalForwardingRuleSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public GlobalForwardingRuleStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified GlobalForwardingRule resource. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(forwardingRule);
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteGlobalForwardingRule( + ProjectGlobalForwardingRuleName forwardingRule) { + + DeleteGlobalForwardingRuleHttpRequest request = + DeleteGlobalForwardingRuleHttpRequest.newBuilder() + .setForwardingRule(forwardingRule == null ? null : forwardingRule.toString()) + .build(); + return deleteGlobalForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified GlobalForwardingRule resource. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(forwardingRule.toString());
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteGlobalForwardingRule(String forwardingRule) { + + DeleteGlobalForwardingRuleHttpRequest request = + DeleteGlobalForwardingRuleHttpRequest.newBuilder() + .setForwardingRule(forwardingRule) + .build(); + return deleteGlobalForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified GlobalForwardingRule resource. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   DeleteGlobalForwardingRuleHttpRequest request = DeleteGlobalForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .build();
+   *   Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteGlobalForwardingRule(DeleteGlobalForwardingRuleHttpRequest request) { + return deleteGlobalForwardingRuleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified GlobalForwardingRule resource. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   DeleteGlobalForwardingRuleHttpRequest request = DeleteGlobalForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = globalForwardingRuleClient.deleteGlobalForwardingRuleCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteGlobalForwardingRuleCallable() { + return stub.deleteGlobalForwardingRuleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified GlobalForwardingRule resource. Gets a list of available forwarding rules + * by making a list() request. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   ForwardingRule response = globalForwardingRuleClient.getGlobalForwardingRule(forwardingRule);
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ForwardingRule getGlobalForwardingRule( + ProjectGlobalForwardingRuleName forwardingRule) { + + GetGlobalForwardingRuleHttpRequest request = + GetGlobalForwardingRuleHttpRequest.newBuilder() + .setForwardingRule(forwardingRule == null ? null : forwardingRule.toString()) + .build(); + return getGlobalForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified GlobalForwardingRule resource. Gets a list of available forwarding rules + * by making a list() request. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   ForwardingRule response = globalForwardingRuleClient.getGlobalForwardingRule(forwardingRule.toString());
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ForwardingRule getGlobalForwardingRule(String forwardingRule) { + + GetGlobalForwardingRuleHttpRequest request = + GetGlobalForwardingRuleHttpRequest.newBuilder().setForwardingRule(forwardingRule).build(); + return getGlobalForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified GlobalForwardingRule resource. Gets a list of available forwarding rules + * by making a list() request. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   GetGlobalForwardingRuleHttpRequest request = GetGlobalForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .build();
+   *   ForwardingRule response = globalForwardingRuleClient.getGlobalForwardingRule(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ForwardingRule getGlobalForwardingRule(GetGlobalForwardingRuleHttpRequest request) { + return getGlobalForwardingRuleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified GlobalForwardingRule resource. Gets a list of available forwarding rules + * by making a list() request. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   GetGlobalForwardingRuleHttpRequest request = GetGlobalForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .build();
+   *   ApiFuture<ForwardingRule> future = globalForwardingRuleClient.getGlobalForwardingRuleCallable().futureCall(request);
+   *   // Do something
+   *   ForwardingRule response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getGlobalForwardingRuleCallable() { + return stub.getGlobalForwardingRuleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a GlobalForwardingRule resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
+   *   Operation response = globalForwardingRuleClient.insertGlobalForwardingRule(project, forwardingRuleResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param forwardingRuleResource A ForwardingRule resource. A ForwardingRule resource specifies + * which pool of target virtual machines to forward a packet to if it matches the given + * [IPAddress, IPProtocol, ports] tuple. (== resource_for beta.forwardingRules ==) (== + * resource_for v1.forwardingRules ==) (== resource_for beta.globalForwardingRules ==) (== + * resource_for v1.globalForwardingRules ==) (== resource_for beta.regionForwardingRules ==) + * (== resource_for v1.regionForwardingRules ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertGlobalForwardingRule( + ProjectName project, ForwardingRule forwardingRuleResource) { + + InsertGlobalForwardingRuleHttpRequest request = + InsertGlobalForwardingRuleHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setForwardingRuleResource(forwardingRuleResource) + .build(); + return insertGlobalForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a GlobalForwardingRule resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
+   *   Operation response = globalForwardingRuleClient.insertGlobalForwardingRule(project.toString(), forwardingRuleResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param forwardingRuleResource A ForwardingRule resource. A ForwardingRule resource specifies + * which pool of target virtual machines to forward a packet to if it matches the given + * [IPAddress, IPProtocol, ports] tuple. (== resource_for beta.forwardingRules ==) (== + * resource_for v1.forwardingRules ==) (== resource_for beta.globalForwardingRules ==) (== + * resource_for v1.globalForwardingRules ==) (== resource_for beta.regionForwardingRules ==) + * (== resource_for v1.regionForwardingRules ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertGlobalForwardingRule( + String project, ForwardingRule forwardingRuleResource) { + + InsertGlobalForwardingRuleHttpRequest request = + InsertGlobalForwardingRuleHttpRequest.newBuilder() + .setProject(project) + .setForwardingRuleResource(forwardingRuleResource) + .build(); + return insertGlobalForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a GlobalForwardingRule resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
+   *   InsertGlobalForwardingRuleHttpRequest request = InsertGlobalForwardingRuleHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setForwardingRuleResource(forwardingRuleResource)
+   *     .build();
+   *   Operation response = globalForwardingRuleClient.insertGlobalForwardingRule(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertGlobalForwardingRule(InsertGlobalForwardingRuleHttpRequest request) { + return insertGlobalForwardingRuleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a GlobalForwardingRule resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
+   *   InsertGlobalForwardingRuleHttpRequest request = InsertGlobalForwardingRuleHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setForwardingRuleResource(forwardingRuleResource)
+   *     .build();
+   *   ApiFuture<Operation> future = globalForwardingRuleClient.insertGlobalForwardingRuleCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertGlobalForwardingRuleCallable() { + return stub.insertGlobalForwardingRuleCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of GlobalForwardingRule resources available to the specified project. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (ForwardingRule element : globalForwardingRuleClient.listGlobalForwardingRules(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListGlobalForwardingRulesPagedResponse listGlobalForwardingRules( + ProjectName project) { + ListGlobalForwardingRulesHttpRequest request = + ListGlobalForwardingRulesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listGlobalForwardingRules(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of GlobalForwardingRule resources available to the specified project. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (ForwardingRule element : globalForwardingRuleClient.listGlobalForwardingRules(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListGlobalForwardingRulesPagedResponse listGlobalForwardingRules(String project) { + ListGlobalForwardingRulesHttpRequest request = + ListGlobalForwardingRulesHttpRequest.newBuilder().setProject(project).build(); + return listGlobalForwardingRules(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of GlobalForwardingRule resources available to the specified project. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListGlobalForwardingRulesHttpRequest request = ListGlobalForwardingRulesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (ForwardingRule element : globalForwardingRuleClient.listGlobalForwardingRules(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListGlobalForwardingRulesPagedResponse listGlobalForwardingRules( + ListGlobalForwardingRulesHttpRequest request) { + return listGlobalForwardingRulesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of GlobalForwardingRule resources available to the specified project. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListGlobalForwardingRulesHttpRequest request = ListGlobalForwardingRulesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListGlobalForwardingRulesPagedResponse> future = globalForwardingRuleClient.listGlobalForwardingRulesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (ForwardingRule element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListGlobalForwardingRulesHttpRequest, ListGlobalForwardingRulesPagedResponse> + listGlobalForwardingRulesPagedCallable() { + return stub.listGlobalForwardingRulesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of GlobalForwardingRule resources available to the specified project. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListGlobalForwardingRulesHttpRequest request = ListGlobalForwardingRulesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     ForwardingRuleList response = globalForwardingRuleClient.listGlobalForwardingRulesCallable().call(request);
+   *     for (ForwardingRule element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listGlobalForwardingRulesCallable() { + return stub.listGlobalForwardingRulesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes target URL for the GlobalForwardingRule resource. The new target should be of the same + * type as the old target. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   Operation response = globalForwardingRuleClient.setTargetGlobalForwardingRule(forwardingRule, targetReferenceResource);
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource in which target is to be set. + * @param targetReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetGlobalForwardingRule( + ProjectGlobalForwardingRuleName forwardingRule, TargetReference targetReferenceResource) { + + SetTargetGlobalForwardingRuleHttpRequest request = + SetTargetGlobalForwardingRuleHttpRequest.newBuilder() + .setForwardingRule(forwardingRule == null ? null : forwardingRule.toString()) + .setTargetReferenceResource(targetReferenceResource) + .build(); + return setTargetGlobalForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes target URL for the GlobalForwardingRule resource. The new target should be of the same + * type as the old target. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   Operation response = globalForwardingRuleClient.setTargetGlobalForwardingRule(forwardingRule.toString(), targetReferenceResource);
+   * }
+   * 
+ * + * @param forwardingRule Name of the ForwardingRule resource in which target is to be set. + * @param targetReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetGlobalForwardingRule( + String forwardingRule, TargetReference targetReferenceResource) { + + SetTargetGlobalForwardingRuleHttpRequest request = + SetTargetGlobalForwardingRuleHttpRequest.newBuilder() + .setForwardingRule(forwardingRule) + .setTargetReferenceResource(targetReferenceResource) + .build(); + return setTargetGlobalForwardingRule(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes target URL for the GlobalForwardingRule resource. The new target should be of the same + * type as the old target. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   SetTargetGlobalForwardingRuleHttpRequest request = SetTargetGlobalForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .setTargetReferenceResource(targetReferenceResource)
+   *     .build();
+   *   Operation response = globalForwardingRuleClient.setTargetGlobalForwardingRule(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetGlobalForwardingRule( + SetTargetGlobalForwardingRuleHttpRequest request) { + return setTargetGlobalForwardingRuleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes target URL for the GlobalForwardingRule resource. The new target should be of the same + * type as the old target. + * + *

Sample code: + * + *


+   * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+   *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   SetTargetGlobalForwardingRuleHttpRequest request = SetTargetGlobalForwardingRuleHttpRequest.newBuilder()
+   *     .setForwardingRule(forwardingRule.toString())
+   *     .setTargetReferenceResource(targetReferenceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = globalForwardingRuleClient.setTargetGlobalForwardingRuleCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setTargetGlobalForwardingRuleCallable() { + return stub.setTargetGlobalForwardingRuleCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListGlobalForwardingRulesPagedResponse + extends AbstractPagedListResponse< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, ForwardingRule, + ListGlobalForwardingRulesPage, ListGlobalForwardingRulesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListGlobalForwardingRulesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListGlobalForwardingRulesPagedResponse apply( + ListGlobalForwardingRulesPage input) { + return new ListGlobalForwardingRulesPagedResponse(input); + } + }); + } + + private ListGlobalForwardingRulesPagedResponse(ListGlobalForwardingRulesPage page) { + super(page, ListGlobalForwardingRulesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListGlobalForwardingRulesPage + extends AbstractPage< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, ForwardingRule, + ListGlobalForwardingRulesPage> { + + private ListGlobalForwardingRulesPage( + PageContext + context, + ForwardingRuleList response) { + super(context, response); + } + + private static ListGlobalForwardingRulesPage createEmptyPage() { + return new ListGlobalForwardingRulesPage(null, null); + } + + @Override + protected ListGlobalForwardingRulesPage createPage( + PageContext + context, + ForwardingRuleList response) { + return new ListGlobalForwardingRulesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListGlobalForwardingRulesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, ForwardingRule, + ListGlobalForwardingRulesPage, ListGlobalForwardingRulesFixedSizeCollection> { + + private ListGlobalForwardingRulesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListGlobalForwardingRulesFixedSizeCollection createEmptyCollection() { + return new ListGlobalForwardingRulesFixedSizeCollection(null, 0); + } + + @Override + protected ListGlobalForwardingRulesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListGlobalForwardingRulesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalForwardingRuleSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalForwardingRuleSettings.java new file mode 100644 index 000000000000..c7d6c750f1cc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalForwardingRuleSettings.java @@ -0,0 +1,242 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.GlobalForwardingRuleStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link GlobalForwardingRuleClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteGlobalForwardingRule to 30 seconds: + * + *

+ * 
+ * GlobalForwardingRuleSettings.Builder globalForwardingRuleSettingsBuilder =
+ *     GlobalForwardingRuleSettings.newBuilder();
+ * globalForwardingRuleSettingsBuilder.deleteGlobalForwardingRuleSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * GlobalForwardingRuleSettings globalForwardingRuleSettings = globalForwardingRuleSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class GlobalForwardingRuleSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteGlobalForwardingRule. */ + public UnaryCallSettings + deleteGlobalForwardingRuleSettings() { + return ((GlobalForwardingRuleStubSettings) getStubSettings()) + .deleteGlobalForwardingRuleSettings(); + } + + /** Returns the object with the settings used for calls to getGlobalForwardingRule. */ + public UnaryCallSettings + getGlobalForwardingRuleSettings() { + return ((GlobalForwardingRuleStubSettings) getStubSettings()).getGlobalForwardingRuleSettings(); + } + + /** Returns the object with the settings used for calls to insertGlobalForwardingRule. */ + public UnaryCallSettings + insertGlobalForwardingRuleSettings() { + return ((GlobalForwardingRuleStubSettings) getStubSettings()) + .insertGlobalForwardingRuleSettings(); + } + + /** Returns the object with the settings used for calls to listGlobalForwardingRules. */ + public PagedCallSettings< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, + ListGlobalForwardingRulesPagedResponse> + listGlobalForwardingRulesSettings() { + return ((GlobalForwardingRuleStubSettings) getStubSettings()) + .listGlobalForwardingRulesSettings(); + } + + /** Returns the object with the settings used for calls to setTargetGlobalForwardingRule. */ + public UnaryCallSettings + setTargetGlobalForwardingRuleSettings() { + return ((GlobalForwardingRuleStubSettings) getStubSettings()) + .setTargetGlobalForwardingRuleSettings(); + } + + public static final GlobalForwardingRuleSettings create(GlobalForwardingRuleStubSettings stub) + throws IOException { + return new GlobalForwardingRuleSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return GlobalForwardingRuleStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return GlobalForwardingRuleStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return GlobalForwardingRuleStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return GlobalForwardingRuleStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GlobalForwardingRuleStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return GlobalForwardingRuleStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return GlobalForwardingRuleStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return GlobalForwardingRuleStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected GlobalForwardingRuleSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for GlobalForwardingRuleSettings. */ + public static class Builder + extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(GlobalForwardingRuleStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(GlobalForwardingRuleStubSettings.newBuilder()); + } + + protected Builder(GlobalForwardingRuleSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(GlobalForwardingRuleStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public GlobalForwardingRuleStubSettings.Builder getStubSettingsBuilder() { + return ((GlobalForwardingRuleStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteGlobalForwardingRule. */ + public UnaryCallSettings.Builder + deleteGlobalForwardingRuleSettings() { + return getStubSettingsBuilder().deleteGlobalForwardingRuleSettings(); + } + + /** Returns the builder for the settings used for calls to getGlobalForwardingRule. */ + public UnaryCallSettings.Builder + getGlobalForwardingRuleSettings() { + return getStubSettingsBuilder().getGlobalForwardingRuleSettings(); + } + + /** Returns the builder for the settings used for calls to insertGlobalForwardingRule. */ + public UnaryCallSettings.Builder + insertGlobalForwardingRuleSettings() { + return getStubSettingsBuilder().insertGlobalForwardingRuleSettings(); + } + + /** Returns the builder for the settings used for calls to listGlobalForwardingRules. */ + public PagedCallSettings.Builder< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, + ListGlobalForwardingRulesPagedResponse> + listGlobalForwardingRulesSettings() { + return getStubSettingsBuilder().listGlobalForwardingRulesSettings(); + } + + /** Returns the builder for the settings used for calls to setTargetGlobalForwardingRule. */ + public UnaryCallSettings.Builder + setTargetGlobalForwardingRuleSettings() { + return getStubSettingsBuilder().setTargetGlobalForwardingRuleSettings(); + } + + @Override + public GlobalForwardingRuleSettings build() throws IOException { + return new GlobalForwardingRuleSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalOperationClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalOperationClient.java new file mode 100644 index 000000000000..193a28352b8a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalOperationClient.java @@ -0,0 +1,830 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.GlobalOperationStub; +import com.google.cloud.compute.v1.stub.GlobalOperationStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+ *   ProjectGlobalOperationName operation = ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]");
+ *   globalOperationClient.deleteGlobalOperation(operation);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the globalOperationClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of GlobalOperationSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * GlobalOperationSettings globalOperationSettings =
+ *     GlobalOperationSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * GlobalOperationClient globalOperationClient =
+ *     GlobalOperationClient.create(globalOperationSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * GlobalOperationSettings globalOperationSettings =
+ *     GlobalOperationSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * GlobalOperationClient globalOperationClient =
+ *     GlobalOperationClient.create(globalOperationSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class GlobalOperationClient implements BackgroundResource { + private final GlobalOperationSettings settings; + private final GlobalOperationStub stub; + + /** Constructs an instance of GlobalOperationClient with default settings. */ + public static final GlobalOperationClient create() throws IOException { + return create(GlobalOperationSettings.newBuilder().build()); + } + + /** + * Constructs an instance of GlobalOperationClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final GlobalOperationClient create(GlobalOperationSettings settings) + throws IOException { + return new GlobalOperationClient(settings); + } + + /** + * Constructs an instance of GlobalOperationClient, using the given stub for making calls. This is + * for advanced usage - prefer to use GlobalOperationSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final GlobalOperationClient create(GlobalOperationStub stub) { + return new GlobalOperationClient(stub); + } + + /** + * Constructs an instance of GlobalOperationClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GlobalOperationClient(GlobalOperationSettings settings) throws IOException { + this.settings = settings; + this.stub = ((GlobalOperationStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected GlobalOperationClient(GlobalOperationStub stub) { + this.settings = null; + this.stub = stub; + } + + public final GlobalOperationSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public GlobalOperationStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of all operations. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (OperationsScopedList element : globalOperationClient.aggregatedListGlobalOperations(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListGlobalOperationsPagedResponse aggregatedListGlobalOperations( + ProjectName project) { + AggregatedListGlobalOperationsHttpRequest request = + AggregatedListGlobalOperationsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListGlobalOperations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of all operations. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (OperationsScopedList element : globalOperationClient.aggregatedListGlobalOperations(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListGlobalOperationsPagedResponse aggregatedListGlobalOperations( + String project) { + AggregatedListGlobalOperationsHttpRequest request = + AggregatedListGlobalOperationsHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListGlobalOperations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of all operations. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListGlobalOperationsHttpRequest request = AggregatedListGlobalOperationsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (OperationsScopedList element : globalOperationClient.aggregatedListGlobalOperations(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListGlobalOperationsPagedResponse aggregatedListGlobalOperations( + AggregatedListGlobalOperationsHttpRequest request) { + return aggregatedListGlobalOperationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of all operations. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListGlobalOperationsHttpRequest request = AggregatedListGlobalOperationsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListGlobalOperationsPagedResponse> future = globalOperationClient.aggregatedListGlobalOperationsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (OperationsScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListGlobalOperationsHttpRequest, AggregatedListGlobalOperationsPagedResponse> + aggregatedListGlobalOperationsPagedCallable() { + return stub.aggregatedListGlobalOperationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of all operations. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListGlobalOperationsHttpRequest request = AggregatedListGlobalOperationsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     OperationAggregatedList response = globalOperationClient.aggregatedListGlobalOperationsCallable().call(request);
+   *     for (OperationsScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListGlobalOperationsCallable() { + return stub.aggregatedListGlobalOperationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Operations resource. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectGlobalOperationName operation = ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]");
+   *   globalOperationClient.deleteGlobalOperation(operation);
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final void deleteGlobalOperation(ProjectGlobalOperationName operation) { + + DeleteGlobalOperationHttpRequest request = + DeleteGlobalOperationHttpRequest.newBuilder() + .setOperation(operation == null ? null : operation.toString()) + .build(); + deleteGlobalOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Operations resource. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectGlobalOperationName operation = ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]");
+   *   globalOperationClient.deleteGlobalOperation(operation.toString());
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final void deleteGlobalOperation(String operation) { + + DeleteGlobalOperationHttpRequest request = + DeleteGlobalOperationHttpRequest.newBuilder().setOperation(operation).build(); + deleteGlobalOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Operations resource. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectGlobalOperationName operation = ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]");
+   *   DeleteGlobalOperationHttpRequest request = DeleteGlobalOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   globalOperationClient.deleteGlobalOperation(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final void deleteGlobalOperation(DeleteGlobalOperationHttpRequest request) { + deleteGlobalOperationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Operations resource. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectGlobalOperationName operation = ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]");
+   *   DeleteGlobalOperationHttpRequest request = DeleteGlobalOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   ApiFuture<Void> future = globalOperationClient.deleteGlobalOperationCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteGlobalOperationCallable() { + return stub.deleteGlobalOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified Operations resource. Gets a list of operations by making a list() + * request. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectGlobalOperationName operation = ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]");
+   *   Operation response = globalOperationClient.getGlobalOperation(operation);
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation getGlobalOperation(ProjectGlobalOperationName operation) { + + GetGlobalOperationHttpRequest request = + GetGlobalOperationHttpRequest.newBuilder() + .setOperation(operation == null ? null : operation.toString()) + .build(); + return getGlobalOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified Operations resource. Gets a list of operations by making a list() + * request. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectGlobalOperationName operation = ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]");
+   *   Operation response = globalOperationClient.getGlobalOperation(operation.toString());
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation getGlobalOperation(String operation) { + + GetGlobalOperationHttpRequest request = + GetGlobalOperationHttpRequest.newBuilder().setOperation(operation).build(); + return getGlobalOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified Operations resource. Gets a list of operations by making a list() + * request. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectGlobalOperationName operation = ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]");
+   *   GetGlobalOperationHttpRequest request = GetGlobalOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   Operation response = globalOperationClient.getGlobalOperation(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation getGlobalOperation(GetGlobalOperationHttpRequest request) { + return getGlobalOperationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified Operations resource. Gets a list of operations by making a list() + * request. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectGlobalOperationName operation = ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]");
+   *   GetGlobalOperationHttpRequest request = GetGlobalOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = globalOperationClient.getGlobalOperationCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getGlobalOperationCallable() { + return stub.getGlobalOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified project. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Operation element : globalOperationClient.listGlobalOperations(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListGlobalOperationsPagedResponse listGlobalOperations(ProjectName project) { + ListGlobalOperationsHttpRequest request = + ListGlobalOperationsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listGlobalOperations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified project. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Operation element : globalOperationClient.listGlobalOperations(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListGlobalOperationsPagedResponse listGlobalOperations(String project) { + ListGlobalOperationsHttpRequest request = + ListGlobalOperationsHttpRequest.newBuilder().setProject(project).build(); + return listGlobalOperations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified project. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListGlobalOperationsHttpRequest request = ListGlobalOperationsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (Operation element : globalOperationClient.listGlobalOperations(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListGlobalOperationsPagedResponse listGlobalOperations( + ListGlobalOperationsHttpRequest request) { + return listGlobalOperationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified project. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListGlobalOperationsHttpRequest request = ListGlobalOperationsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListGlobalOperationsPagedResponse> future = globalOperationClient.listGlobalOperationsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Operation element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listGlobalOperationsPagedCallable() { + return stub.listGlobalOperationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified project. + * + *

Sample code: + * + *


+   * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListGlobalOperationsHttpRequest request = ListGlobalOperationsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     OperationList response = globalOperationClient.listGlobalOperationsCallable().call(request);
+   *     for (Operation element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listGlobalOperationsCallable() { + return stub.listGlobalOperationsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListGlobalOperationsPagedResponse + extends AbstractPagedListResponse< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, OperationsScopedList, + AggregatedListGlobalOperationsPage, AggregatedListGlobalOperationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + OperationsScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListGlobalOperationsPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + AggregatedListGlobalOperationsPage, AggregatedListGlobalOperationsPagedResponse>() { + @Override + public AggregatedListGlobalOperationsPagedResponse apply( + AggregatedListGlobalOperationsPage input) { + return new AggregatedListGlobalOperationsPagedResponse(input); + } + }); + } + + private AggregatedListGlobalOperationsPagedResponse(AggregatedListGlobalOperationsPage page) { + super(page, AggregatedListGlobalOperationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListGlobalOperationsPage + extends AbstractPage< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, OperationsScopedList, + AggregatedListGlobalOperationsPage> { + + private AggregatedListGlobalOperationsPage( + PageContext< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + OperationsScopedList> + context, + OperationAggregatedList response) { + super(context, response); + } + + private static AggregatedListGlobalOperationsPage createEmptyPage() { + return new AggregatedListGlobalOperationsPage(null, null); + } + + @Override + protected AggregatedListGlobalOperationsPage createPage( + PageContext< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + OperationsScopedList> + context, + OperationAggregatedList response) { + return new AggregatedListGlobalOperationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + OperationsScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListGlobalOperationsFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, OperationsScopedList, + AggregatedListGlobalOperationsPage, AggregatedListGlobalOperationsFixedSizeCollection> { + + private AggregatedListGlobalOperationsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListGlobalOperationsFixedSizeCollection createEmptyCollection() { + return new AggregatedListGlobalOperationsFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListGlobalOperationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListGlobalOperationsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListGlobalOperationsPagedResponse + extends AbstractPagedListResponse< + ListGlobalOperationsHttpRequest, OperationList, Operation, ListGlobalOperationsPage, + ListGlobalOperationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListGlobalOperationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListGlobalOperationsPagedResponse apply(ListGlobalOperationsPage input) { + return new ListGlobalOperationsPagedResponse(input); + } + }); + } + + private ListGlobalOperationsPagedResponse(ListGlobalOperationsPage page) { + super(page, ListGlobalOperationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListGlobalOperationsPage + extends AbstractPage< + ListGlobalOperationsHttpRequest, OperationList, Operation, ListGlobalOperationsPage> { + + private ListGlobalOperationsPage( + PageContext context, + OperationList response) { + super(context, response); + } + + private static ListGlobalOperationsPage createEmptyPage() { + return new ListGlobalOperationsPage(null, null); + } + + @Override + protected ListGlobalOperationsPage createPage( + PageContext context, + OperationList response) { + return new ListGlobalOperationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListGlobalOperationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListGlobalOperationsHttpRequest, OperationList, Operation, ListGlobalOperationsPage, + ListGlobalOperationsFixedSizeCollection> { + + private ListGlobalOperationsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListGlobalOperationsFixedSizeCollection createEmptyCollection() { + return new ListGlobalOperationsFixedSizeCollection(null, 0); + } + + @Override + protected ListGlobalOperationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListGlobalOperationsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalOperationSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalOperationSettings.java new file mode 100644 index 000000000000..91d078b40ba0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalOperationSettings.java @@ -0,0 +1,227 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.GlobalOperationClient.AggregatedListGlobalOperationsPagedResponse; +import static com.google.cloud.compute.v1.GlobalOperationClient.ListGlobalOperationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.GlobalOperationStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link GlobalOperationClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteGlobalOperation to 30 seconds: + * + *

+ * 
+ * GlobalOperationSettings.Builder globalOperationSettingsBuilder =
+ *     GlobalOperationSettings.newBuilder();
+ * globalOperationSettingsBuilder.deleteGlobalOperationSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * GlobalOperationSettings globalOperationSettings = globalOperationSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class GlobalOperationSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListGlobalOperations. */ + public PagedCallSettings< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + AggregatedListGlobalOperationsPagedResponse> + aggregatedListGlobalOperationsSettings() { + return ((GlobalOperationStubSettings) getStubSettings()) + .aggregatedListGlobalOperationsSettings(); + } + + /** Returns the object with the settings used for calls to deleteGlobalOperation. */ + public UnaryCallSettings deleteGlobalOperationSettings() { + return ((GlobalOperationStubSettings) getStubSettings()).deleteGlobalOperationSettings(); + } + + /** Returns the object with the settings used for calls to getGlobalOperation. */ + public UnaryCallSettings getGlobalOperationSettings() { + return ((GlobalOperationStubSettings) getStubSettings()).getGlobalOperationSettings(); + } + + /** Returns the object with the settings used for calls to listGlobalOperations. */ + public PagedCallSettings< + ListGlobalOperationsHttpRequest, OperationList, ListGlobalOperationsPagedResponse> + listGlobalOperationsSettings() { + return ((GlobalOperationStubSettings) getStubSettings()).listGlobalOperationsSettings(); + } + + public static final GlobalOperationSettings create(GlobalOperationStubSettings stub) + throws IOException { + return new GlobalOperationSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return GlobalOperationStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return GlobalOperationStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return GlobalOperationStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return GlobalOperationStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GlobalOperationStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return GlobalOperationStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return GlobalOperationStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return GlobalOperationStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected GlobalOperationSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for GlobalOperationSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(GlobalOperationStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(GlobalOperationStubSettings.newBuilder()); + } + + protected Builder(GlobalOperationSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(GlobalOperationStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public GlobalOperationStubSettings.Builder getStubSettingsBuilder() { + return ((GlobalOperationStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListGlobalOperations. */ + public PagedCallSettings.Builder< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + AggregatedListGlobalOperationsPagedResponse> + aggregatedListGlobalOperationsSettings() { + return getStubSettingsBuilder().aggregatedListGlobalOperationsSettings(); + } + + /** Returns the builder for the settings used for calls to deleteGlobalOperation. */ + public UnaryCallSettings.Builder + deleteGlobalOperationSettings() { + return getStubSettingsBuilder().deleteGlobalOperationSettings(); + } + + /** Returns the builder for the settings used for calls to getGlobalOperation. */ + public UnaryCallSettings.Builder + getGlobalOperationSettings() { + return getStubSettingsBuilder().getGlobalOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listGlobalOperations. */ + public PagedCallSettings.Builder< + ListGlobalOperationsHttpRequest, OperationList, ListGlobalOperationsPagedResponse> + listGlobalOperationsSettings() { + return getStubSettingsBuilder().listGlobalOperationsSettings(); + } + + @Override + public GlobalOperationSettings build() throws IOException { + return new GlobalOperationSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalSetLabelsRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalSetLabelsRequest.java new file mode 100644 index 000000000000..3c1184f61e5f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalSetLabelsRequest.java @@ -0,0 +1,176 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GlobalSetLabelsRequest implements ApiMessage { + private final String labelFingerprint; + private final Map labels; + + private GlobalSetLabelsRequest() { + this.labelFingerprint = null; + this.labels = null; + } + + private GlobalSetLabelsRequest(String labelFingerprint, Map labels) { + this.labelFingerprint = labelFingerprint; + this.labels = labels; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("labelFingerprint")) { + return labelFingerprint; + } + if (fieldName.equals("labels")) { + return labels; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Map getLabelsMap() { + return labels; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GlobalSetLabelsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GlobalSetLabelsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GlobalSetLabelsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GlobalSetLabelsRequest(); + } + + public static class Builder { + private String labelFingerprint; + private Map labels; + + Builder() {} + + public Builder mergeFrom(GlobalSetLabelsRequest other) { + if (other == GlobalSetLabelsRequest.getDefaultInstance()) return this; + if (other.getLabelFingerprint() != null) { + this.labelFingerprint = other.labelFingerprint; + } + if (other.getLabelsMap() != null) { + this.labels = other.labels; + } + return this; + } + + Builder(GlobalSetLabelsRequest source) { + this.labelFingerprint = source.labelFingerprint; + this.labels = source.labels; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Builder setLabelFingerprint(String labelFingerprint) { + this.labelFingerprint = labelFingerprint; + return this; + } + + public Map getLabelsMap() { + return labels; + } + + public Builder putAllLabels(Map labels) { + this.labels = labels; + return this; + } + + public GlobalSetLabelsRequest build() { + + return new GlobalSetLabelsRequest(labelFingerprint, labels); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setLabelFingerprint(this.labelFingerprint); + newBuilder.putAllLabels(this.labels); + return newBuilder; + } + } + + @Override + public String toString() { + return "GlobalSetLabelsRequest{" + + "labelFingerprint=" + + labelFingerprint + + ", " + + "labels=" + + labels + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GlobalSetLabelsRequest) { + GlobalSetLabelsRequest that = (GlobalSetLabelsRequest) o; + return Objects.equals(this.labelFingerprint, that.getLabelFingerprint()) + && Objects.equals(this.labels, that.getLabelsMap()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(labelFingerprint, labels); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GuestOsFeature.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GuestOsFeature.java new file mode 100644 index 000000000000..22ec52f78ce5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GuestOsFeature.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class GuestOsFeature implements ApiMessage { + private final String type; + + private GuestOsFeature() { + this.type = null; + } + + private GuestOsFeature(String type) { + this.type = type; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("type")) { + return type; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getType() { + return type; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(GuestOsFeature prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static GuestOsFeature getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final GuestOsFeature DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new GuestOsFeature(); + } + + public static class Builder { + private String type; + + Builder() {} + + public Builder mergeFrom(GuestOsFeature other) { + if (other == GuestOsFeature.getDefaultInstance()) return this; + if (other.getType() != null) { + this.type = other.type; + } + return this; + } + + Builder(GuestOsFeature source) { + this.type = source.type; + } + + public String getType() { + return type; + } + + public Builder setType(String type) { + this.type = type; + return this; + } + + public GuestOsFeature build() { + return new GuestOsFeature(type); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setType(this.type); + return newBuilder; + } + } + + @Override + public String toString() { + return "GuestOsFeature{" + "type=" + type + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GuestOsFeature) { + GuestOsFeature that = (GuestOsFeature) o; + return Objects.equals(this.type, that.getType()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(type); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheck.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheck.java new file mode 100644 index 000000000000..a7c925ef69ab --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheck.java @@ -0,0 +1,597 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class HealthCheck implements ApiMessage { + private final Integer checkIntervalSec; + private final String creationTimestamp; + private final String description; + private final Integer healthyThreshold; + private final HttpHealthCheck httpHealthCheck; + private final HttpSHealthCheck httpsHealthCheck; + private final String id; + private final String kind; + private final String name; + private final String selfLink; + private final SSLHealthCheck sslHealthCheck; + private final TCPHealthCheck tcpHealthCheck; + private final Integer timeoutSec; + private final String type; + private final Integer unhealthyThreshold; + + private HealthCheck() { + this.checkIntervalSec = null; + this.creationTimestamp = null; + this.description = null; + this.healthyThreshold = null; + this.httpHealthCheck = null; + this.httpsHealthCheck = null; + this.id = null; + this.kind = null; + this.name = null; + this.selfLink = null; + this.sslHealthCheck = null; + this.tcpHealthCheck = null; + this.timeoutSec = null; + this.type = null; + this.unhealthyThreshold = null; + } + + private HealthCheck( + Integer checkIntervalSec, + String creationTimestamp, + String description, + Integer healthyThreshold, + HttpHealthCheck httpHealthCheck, + HttpSHealthCheck httpsHealthCheck, + String id, + String kind, + String name, + String selfLink, + SSLHealthCheck sslHealthCheck, + TCPHealthCheck tcpHealthCheck, + Integer timeoutSec, + String type, + Integer unhealthyThreshold) { + this.checkIntervalSec = checkIntervalSec; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.healthyThreshold = healthyThreshold; + this.httpHealthCheck = httpHealthCheck; + this.httpsHealthCheck = httpsHealthCheck; + this.id = id; + this.kind = kind; + this.name = name; + this.selfLink = selfLink; + this.sslHealthCheck = sslHealthCheck; + this.tcpHealthCheck = tcpHealthCheck; + this.timeoutSec = timeoutSec; + this.type = type; + this.unhealthyThreshold = unhealthyThreshold; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("checkIntervalSec")) { + return checkIntervalSec; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("healthyThreshold")) { + return healthyThreshold; + } + if (fieldName.equals("httpHealthCheck")) { + return httpHealthCheck; + } + if (fieldName.equals("httpsHealthCheck")) { + return httpsHealthCheck; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("sslHealthCheck")) { + return sslHealthCheck; + } + if (fieldName.equals("tcpHealthCheck")) { + return tcpHealthCheck; + } + if (fieldName.equals("timeoutSec")) { + return timeoutSec; + } + if (fieldName.equals("type")) { + return type; + } + if (fieldName.equals("unhealthyThreshold")) { + return unhealthyThreshold; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getCheckIntervalSec() { + return checkIntervalSec; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public Integer getHealthyThreshold() { + return healthyThreshold; + } + + public HttpHealthCheck getHttpHealthCheck() { + return httpHealthCheck; + } + + public HttpSHealthCheck getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getSelfLink() { + return selfLink; + } + + public SSLHealthCheck getSslHealthCheck() { + return sslHealthCheck; + } + + public TCPHealthCheck getTcpHealthCheck() { + return tcpHealthCheck; + } + + public Integer getTimeoutSec() { + return timeoutSec; + } + + public String getType() { + return type; + } + + public Integer getUnhealthyThreshold() { + return unhealthyThreshold; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(HealthCheck prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static HealthCheck getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final HealthCheck DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new HealthCheck(); + } + + public static class Builder { + private Integer checkIntervalSec; + private String creationTimestamp; + private String description; + private Integer healthyThreshold; + private HttpHealthCheck httpHealthCheck; + private HttpSHealthCheck httpsHealthCheck; + private String id; + private String kind; + private String name; + private String selfLink; + private SSLHealthCheck sslHealthCheck; + private TCPHealthCheck tcpHealthCheck; + private Integer timeoutSec; + private String type; + private Integer unhealthyThreshold; + + Builder() {} + + public Builder mergeFrom(HealthCheck other) { + if (other == HealthCheck.getDefaultInstance()) return this; + if (other.getCheckIntervalSec() != null) { + this.checkIntervalSec = other.checkIntervalSec; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getHealthyThreshold() != null) { + this.healthyThreshold = other.healthyThreshold; + } + if (other.getHttpHealthCheck() != null) { + this.httpHealthCheck = other.httpHealthCheck; + } + if (other.getHttpsHealthCheck() != null) { + this.httpsHealthCheck = other.httpsHealthCheck; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSslHealthCheck() != null) { + this.sslHealthCheck = other.sslHealthCheck; + } + if (other.getTcpHealthCheck() != null) { + this.tcpHealthCheck = other.tcpHealthCheck; + } + if (other.getTimeoutSec() != null) { + this.timeoutSec = other.timeoutSec; + } + if (other.getType() != null) { + this.type = other.type; + } + if (other.getUnhealthyThreshold() != null) { + this.unhealthyThreshold = other.unhealthyThreshold; + } + return this; + } + + Builder(HealthCheck source) { + this.checkIntervalSec = source.checkIntervalSec; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.healthyThreshold = source.healthyThreshold; + this.httpHealthCheck = source.httpHealthCheck; + this.httpsHealthCheck = source.httpsHealthCheck; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.selfLink = source.selfLink; + this.sslHealthCheck = source.sslHealthCheck; + this.tcpHealthCheck = source.tcpHealthCheck; + this.timeoutSec = source.timeoutSec; + this.type = source.type; + this.unhealthyThreshold = source.unhealthyThreshold; + } + + public Integer getCheckIntervalSec() { + return checkIntervalSec; + } + + public Builder setCheckIntervalSec(Integer checkIntervalSec) { + this.checkIntervalSec = checkIntervalSec; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public Integer getHealthyThreshold() { + return healthyThreshold; + } + + public Builder setHealthyThreshold(Integer healthyThreshold) { + this.healthyThreshold = healthyThreshold; + return this; + } + + public HttpHealthCheck getHttpHealthCheck() { + return httpHealthCheck; + } + + public Builder setHttpHealthCheck(HttpHealthCheck httpHealthCheck) { + this.httpHealthCheck = httpHealthCheck; + return this; + } + + public HttpSHealthCheck getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public Builder setHttpsHealthCheck(HttpSHealthCheck httpsHealthCheck) { + this.httpsHealthCheck = httpsHealthCheck; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public SSLHealthCheck getSslHealthCheck() { + return sslHealthCheck; + } + + public Builder setSslHealthCheck(SSLHealthCheck sslHealthCheck) { + this.sslHealthCheck = sslHealthCheck; + return this; + } + + public TCPHealthCheck getTcpHealthCheck() { + return tcpHealthCheck; + } + + public Builder setTcpHealthCheck(TCPHealthCheck tcpHealthCheck) { + this.tcpHealthCheck = tcpHealthCheck; + return this; + } + + public Integer getTimeoutSec() { + return timeoutSec; + } + + public Builder setTimeoutSec(Integer timeoutSec) { + this.timeoutSec = timeoutSec; + return this; + } + + public String getType() { + return type; + } + + public Builder setType(String type) { + this.type = type; + return this; + } + + public Integer getUnhealthyThreshold() { + return unhealthyThreshold; + } + + public Builder setUnhealthyThreshold(Integer unhealthyThreshold) { + this.unhealthyThreshold = unhealthyThreshold; + return this; + } + + public HealthCheck build() { + + return new HealthCheck( + checkIntervalSec, + creationTimestamp, + description, + healthyThreshold, + httpHealthCheck, + httpsHealthCheck, + id, + kind, + name, + selfLink, + sslHealthCheck, + tcpHealthCheck, + timeoutSec, + type, + unhealthyThreshold); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCheckIntervalSec(this.checkIntervalSec); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setHealthyThreshold(this.healthyThreshold); + newBuilder.setHttpHealthCheck(this.httpHealthCheck); + newBuilder.setHttpsHealthCheck(this.httpsHealthCheck); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setSslHealthCheck(this.sslHealthCheck); + newBuilder.setTcpHealthCheck(this.tcpHealthCheck); + newBuilder.setTimeoutSec(this.timeoutSec); + newBuilder.setType(this.type); + newBuilder.setUnhealthyThreshold(this.unhealthyThreshold); + return newBuilder; + } + } + + @Override + public String toString() { + return "HealthCheck{" + + "checkIntervalSec=" + + checkIntervalSec + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "healthyThreshold=" + + healthyThreshold + + ", " + + "httpHealthCheck=" + + httpHealthCheck + + ", " + + "httpsHealthCheck=" + + httpsHealthCheck + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "selfLink=" + + selfLink + + ", " + + "sslHealthCheck=" + + sslHealthCheck + + ", " + + "tcpHealthCheck=" + + tcpHealthCheck + + ", " + + "timeoutSec=" + + timeoutSec + + ", " + + "type=" + + type + + ", " + + "unhealthyThreshold=" + + unhealthyThreshold + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof HealthCheck) { + HealthCheck that = (HealthCheck) o; + return Objects.equals(this.checkIntervalSec, that.getCheckIntervalSec()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.healthyThreshold, that.getHealthyThreshold()) + && Objects.equals(this.httpHealthCheck, that.getHttpHealthCheck()) + && Objects.equals(this.httpsHealthCheck, that.getHttpsHealthCheck()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.sslHealthCheck, that.getSslHealthCheck()) + && Objects.equals(this.tcpHealthCheck, that.getTcpHealthCheck()) + && Objects.equals(this.timeoutSec, that.getTimeoutSec()) + && Objects.equals(this.type, that.getType()) + && Objects.equals(this.unhealthyThreshold, that.getUnhealthyThreshold()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + checkIntervalSec, + creationTimestamp, + description, + healthyThreshold, + httpHealthCheck, + httpsHealthCheck, + id, + kind, + name, + selfLink, + sslHealthCheck, + tcpHealthCheck, + timeoutSec, + type, + unhealthyThreshold); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckClient.java new file mode 100644 index 000000000000..ad9834baec92 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckClient.java @@ -0,0 +1,938 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.HealthCheckStub; +import com.google.cloud.compute.v1.stub.HealthCheckStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+ *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+ *   Operation response = healthCheckClient.deleteHealthCheck(healthCheck);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the healthCheckClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of HealthCheckSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * HealthCheckSettings healthCheckSettings =
+ *     HealthCheckSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * HealthCheckClient healthCheckClient =
+ *     HealthCheckClient.create(healthCheckSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * HealthCheckSettings healthCheckSettings =
+ *     HealthCheckSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * HealthCheckClient healthCheckClient =
+ *     HealthCheckClient.create(healthCheckSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class HealthCheckClient implements BackgroundResource { + private final HealthCheckSettings settings; + private final HealthCheckStub stub; + + /** Constructs an instance of HealthCheckClient with default settings. */ + public static final HealthCheckClient create() throws IOException { + return create(HealthCheckSettings.newBuilder().build()); + } + + /** + * Constructs an instance of HealthCheckClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final HealthCheckClient create(HealthCheckSettings settings) throws IOException { + return new HealthCheckClient(settings); + } + + /** + * Constructs an instance of HealthCheckClient, using the given stub for making calls. This is for + * advanced usage - prefer to use HealthCheckSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final HealthCheckClient create(HealthCheckStub stub) { + return new HealthCheckClient(stub); + } + + /** + * Constructs an instance of HealthCheckClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HealthCheckClient(HealthCheckSettings settings) throws IOException { + this.settings = settings; + this.stub = ((HealthCheckStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected HealthCheckClient(HealthCheckStub stub) { + this.settings = null; + this.stub = stub; + } + + public final HealthCheckSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public HealthCheckStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HealthCheck resource. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   Operation response = healthCheckClient.deleteHealthCheck(healthCheck);
+   * }
+   * 
+ * + * @param healthCheck Name of the HealthCheck resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteHealthCheck(ProjectGlobalHealthCheckName healthCheck) { + + DeleteHealthCheckHttpRequest request = + DeleteHealthCheckHttpRequest.newBuilder() + .setHealthCheck(healthCheck == null ? null : healthCheck.toString()) + .build(); + return deleteHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HealthCheck resource. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   Operation response = healthCheckClient.deleteHealthCheck(healthCheck.toString());
+   * }
+   * 
+ * + * @param healthCheck Name of the HealthCheck resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteHealthCheck(String healthCheck) { + + DeleteHealthCheckHttpRequest request = + DeleteHealthCheckHttpRequest.newBuilder().setHealthCheck(healthCheck).build(); + return deleteHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HealthCheck resource. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   DeleteHealthCheckHttpRequest request = DeleteHealthCheckHttpRequest.newBuilder()
+   *     .setHealthCheck(healthCheck.toString())
+   *     .build();
+   *   Operation response = healthCheckClient.deleteHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteHealthCheck(DeleteHealthCheckHttpRequest request) { + return deleteHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HealthCheck resource. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   DeleteHealthCheckHttpRequest request = DeleteHealthCheckHttpRequest.newBuilder()
+   *     .setHealthCheck(healthCheck.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = healthCheckClient.deleteHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteHealthCheckCallable() { + return stub.deleteHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HealthCheck resource. Gets a list of available health checks by making a + * list() request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   HealthCheck response = healthCheckClient.getHealthCheck(healthCheck);
+   * }
+   * 
+ * + * @param healthCheck Name of the HealthCheck resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final HealthCheck getHealthCheck(ProjectGlobalHealthCheckName healthCheck) { + + GetHealthCheckHttpRequest request = + GetHealthCheckHttpRequest.newBuilder() + .setHealthCheck(healthCheck == null ? null : healthCheck.toString()) + .build(); + return getHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HealthCheck resource. Gets a list of available health checks by making a + * list() request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   HealthCheck response = healthCheckClient.getHealthCheck(healthCheck.toString());
+   * }
+   * 
+ * + * @param healthCheck Name of the HealthCheck resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final HealthCheck getHealthCheck(String healthCheck) { + + GetHealthCheckHttpRequest request = + GetHealthCheckHttpRequest.newBuilder().setHealthCheck(healthCheck).build(); + return getHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HealthCheck resource. Gets a list of available health checks by making a + * list() request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   GetHealthCheckHttpRequest request = GetHealthCheckHttpRequest.newBuilder()
+   *     .setHealthCheck(healthCheck.toString())
+   *     .build();
+   *   HealthCheck response = healthCheckClient.getHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final HealthCheck getHealthCheck(GetHealthCheckHttpRequest request) { + return getHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HealthCheck resource. Gets a list of available health checks by making a + * list() request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   GetHealthCheckHttpRequest request = GetHealthCheckHttpRequest.newBuilder()
+   *     .setHealthCheck(healthCheck.toString())
+   *     .build();
+   *   ApiFuture<HealthCheck> future = healthCheckClient.getHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   HealthCheck response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getHealthCheckCallable() { + return stub.getHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HealthCheck resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   Operation response = healthCheckClient.insertHealthCheck(project, healthCheckResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param healthCheckResource An HealthCheck resource. This resource defines a template for how + * individual virtual machines should be checked for health, via one of the supported + * protocols. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertHealthCheck(ProjectName project, HealthCheck healthCheckResource) { + + InsertHealthCheckHttpRequest request = + InsertHealthCheckHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setHealthCheckResource(healthCheckResource) + .build(); + return insertHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HealthCheck resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   Operation response = healthCheckClient.insertHealthCheck(project.toString(), healthCheckResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param healthCheckResource An HealthCheck resource. This resource defines a template for how + * individual virtual machines should be checked for health, via one of the supported + * protocols. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertHealthCheck(String project, HealthCheck healthCheckResource) { + + InsertHealthCheckHttpRequest request = + InsertHealthCheckHttpRequest.newBuilder() + .setProject(project) + .setHealthCheckResource(healthCheckResource) + .build(); + return insertHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HealthCheck resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   InsertHealthCheckHttpRequest request = InsertHealthCheckHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setHealthCheckResource(healthCheckResource)
+   *     .build();
+   *   Operation response = healthCheckClient.insertHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertHealthCheck(InsertHealthCheckHttpRequest request) { + return insertHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HealthCheck resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   InsertHealthCheckHttpRequest request = InsertHealthCheckHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setHealthCheckResource(healthCheckResource)
+   *     .build();
+   *   ApiFuture<Operation> future = healthCheckClient.insertHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertHealthCheckCallable() { + return stub.insertHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (HealthCheck element : healthCheckClient.listHealthChecks(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListHealthChecksPagedResponse listHealthChecks(ProjectName project) { + ListHealthChecksHttpRequest request = + ListHealthChecksHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listHealthChecks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (HealthCheck element : healthCheckClient.listHealthChecks(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListHealthChecksPagedResponse listHealthChecks(String project) { + ListHealthChecksHttpRequest request = + ListHealthChecksHttpRequest.newBuilder().setProject(project).build(); + return listHealthChecks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListHealthChecksHttpRequest request = ListHealthChecksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (HealthCheck element : healthCheckClient.listHealthChecks(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListHealthChecksPagedResponse listHealthChecks(ListHealthChecksHttpRequest request) { + return listHealthChecksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListHealthChecksHttpRequest request = ListHealthChecksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListHealthChecksPagedResponse> future = healthCheckClient.listHealthChecksPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (HealthCheck element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listHealthChecksPagedCallable() { + return stub.listHealthChecksPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListHealthChecksHttpRequest request = ListHealthChecksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     HealthCheckList response = healthCheckClient.listHealthChecksCallable().call(request);
+   *     for (HealthCheck element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listHealthChecksCallable() { + return stub.listHealthChecksCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HealthCheck resource in the specified project using the data included in the request. + * This method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   Operation response = healthCheckClient.patchHealthCheck(healthCheck, healthCheckResource);
+   * }
+   * 
+ * + * @param healthCheck Name of the HealthCheck resource to patch. + * @param healthCheckResource An HealthCheck resource. This resource defines a template for how + * individual virtual machines should be checked for health, via one of the supported + * protocols. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchHealthCheck( + ProjectGlobalHealthCheckName healthCheck, HealthCheck healthCheckResource) { + + PatchHealthCheckHttpRequest request = + PatchHealthCheckHttpRequest.newBuilder() + .setHealthCheck(healthCheck == null ? null : healthCheck.toString()) + .setHealthCheckResource(healthCheckResource) + .build(); + return patchHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HealthCheck resource in the specified project using the data included in the request. + * This method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   Operation response = healthCheckClient.patchHealthCheck(healthCheck.toString(), healthCheckResource);
+   * }
+   * 
+ * + * @param healthCheck Name of the HealthCheck resource to patch. + * @param healthCheckResource An HealthCheck resource. This resource defines a template for how + * individual virtual machines should be checked for health, via one of the supported + * protocols. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchHealthCheck(String healthCheck, HealthCheck healthCheckResource) { + + PatchHealthCheckHttpRequest request = + PatchHealthCheckHttpRequest.newBuilder() + .setHealthCheck(healthCheck) + .setHealthCheckResource(healthCheckResource) + .build(); + return patchHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HealthCheck resource in the specified project using the data included in the request. + * This method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   PatchHealthCheckHttpRequest request = PatchHealthCheckHttpRequest.newBuilder()
+   *     .setHealthCheck(healthCheck.toString())
+   *     .setHealthCheckResource(healthCheckResource)
+   *     .build();
+   *   Operation response = healthCheckClient.patchHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchHealthCheck(PatchHealthCheckHttpRequest request) { + return patchHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HealthCheck resource in the specified project using the data included in the request. + * This method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   PatchHealthCheckHttpRequest request = PatchHealthCheckHttpRequest.newBuilder()
+   *     .setHealthCheck(healthCheck.toString())
+   *     .setHealthCheckResource(healthCheckResource)
+   *     .build();
+   *   ApiFuture<Operation> future = healthCheckClient.patchHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable patchHealthCheckCallable() { + return stub.patchHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HealthCheck resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   Operation response = healthCheckClient.updateHealthCheck(healthCheck, healthCheckResource);
+   * }
+   * 
+ * + * @param healthCheck Name of the HealthCheck resource to update. + * @param healthCheckResource An HealthCheck resource. This resource defines a template for how + * individual virtual machines should be checked for health, via one of the supported + * protocols. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateHealthCheck( + ProjectGlobalHealthCheckName healthCheck, HealthCheck healthCheckResource) { + + UpdateHealthCheckHttpRequest request = + UpdateHealthCheckHttpRequest.newBuilder() + .setHealthCheck(healthCheck == null ? null : healthCheck.toString()) + .setHealthCheckResource(healthCheckResource) + .build(); + return updateHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HealthCheck resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   Operation response = healthCheckClient.updateHealthCheck(healthCheck.toString(), healthCheckResource);
+   * }
+   * 
+ * + * @param healthCheck Name of the HealthCheck resource to update. + * @param healthCheckResource An HealthCheck resource. This resource defines a template for how + * individual virtual machines should be checked for health, via one of the supported + * protocols. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateHealthCheck(String healthCheck, HealthCheck healthCheckResource) { + + UpdateHealthCheckHttpRequest request = + UpdateHealthCheckHttpRequest.newBuilder() + .setHealthCheck(healthCheck) + .setHealthCheckResource(healthCheckResource) + .build(); + return updateHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HealthCheck resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   UpdateHealthCheckHttpRequest request = UpdateHealthCheckHttpRequest.newBuilder()
+   *     .setHealthCheck(healthCheck.toString())
+   *     .setHealthCheckResource(healthCheckResource)
+   *     .build();
+   *   Operation response = healthCheckClient.updateHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateHealthCheck(UpdateHealthCheckHttpRequest request) { + return updateHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HealthCheck resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+   *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+   *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
+   *   UpdateHealthCheckHttpRequest request = UpdateHealthCheckHttpRequest.newBuilder()
+   *     .setHealthCheck(healthCheck.toString())
+   *     .setHealthCheckResource(healthCheckResource)
+   *     .build();
+   *   ApiFuture<Operation> future = healthCheckClient.updateHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable updateHealthCheckCallable() { + return stub.updateHealthCheckCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListHealthChecksPagedResponse + extends AbstractPagedListResponse< + ListHealthChecksHttpRequest, HealthCheckList, HealthCheck, ListHealthChecksPage, + ListHealthChecksFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListHealthChecksPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListHealthChecksPagedResponse apply(ListHealthChecksPage input) { + return new ListHealthChecksPagedResponse(input); + } + }); + } + + private ListHealthChecksPagedResponse(ListHealthChecksPage page) { + super(page, ListHealthChecksFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListHealthChecksPage + extends AbstractPage< + ListHealthChecksHttpRequest, HealthCheckList, HealthCheck, ListHealthChecksPage> { + + private ListHealthChecksPage( + PageContext context, + HealthCheckList response) { + super(context, response); + } + + private static ListHealthChecksPage createEmptyPage() { + return new ListHealthChecksPage(null, null); + } + + @Override + protected ListHealthChecksPage createPage( + PageContext context, + HealthCheckList response) { + return new ListHealthChecksPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListHealthChecksFixedSizeCollection + extends AbstractFixedSizeCollection< + ListHealthChecksHttpRequest, HealthCheckList, HealthCheck, ListHealthChecksPage, + ListHealthChecksFixedSizeCollection> { + + private ListHealthChecksFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListHealthChecksFixedSizeCollection createEmptyCollection() { + return new ListHealthChecksFixedSizeCollection(null, 0); + } + + @Override + protected ListHealthChecksFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListHealthChecksFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckList.java new file mode 100644 index 000000000000..aaab7be4b2a1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class HealthCheckList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private HealthCheckList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private HealthCheckList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(HealthCheckList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static HealthCheckList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final HealthCheckList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new HealthCheckList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(HealthCheckList other) { + if (other == HealthCheckList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(HealthCheckList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(HealthCheck items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public HealthCheckList build() { + + return new HealthCheckList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "HealthCheckList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof HealthCheckList) { + HealthCheckList that = (HealthCheckList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckReference.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckReference.java new file mode 100644 index 000000000000..a32982dbe395 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckReference.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class HealthCheckReference implements ApiMessage { + private final String healthCheck; + + private HealthCheckReference() { + this.healthCheck = null; + } + + private HealthCheckReference(String healthCheck) { + this.healthCheck = healthCheck; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("healthCheck")) { + return healthCheck; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getHealthCheck() { + return healthCheck; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(HealthCheckReference prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static HealthCheckReference getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final HealthCheckReference DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new HealthCheckReference(); + } + + public static class Builder { + private String healthCheck; + + Builder() {} + + public Builder mergeFrom(HealthCheckReference other) { + if (other == HealthCheckReference.getDefaultInstance()) return this; + if (other.getHealthCheck() != null) { + this.healthCheck = other.healthCheck; + } + return this; + } + + Builder(HealthCheckReference source) { + this.healthCheck = source.healthCheck; + } + + public String getHealthCheck() { + return healthCheck; + } + + public Builder setHealthCheck(String healthCheck) { + this.healthCheck = healthCheck; + return this; + } + + public HealthCheckReference build() { + return new HealthCheckReference(healthCheck); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setHealthCheck(this.healthCheck); + return newBuilder; + } + } + + @Override + public String toString() { + return "HealthCheckReference{" + "healthCheck=" + healthCheck + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof HealthCheckReference) { + HealthCheckReference that = (HealthCheckReference) o; + return Objects.equals(this.healthCheck, that.getHealthCheck()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(healthCheck); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckSettings.java new file mode 100644 index 000000000000..26d932ce81f8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckSettings.java @@ -0,0 +1,241 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.HealthCheckClient.ListHealthChecksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.HealthCheckStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link HealthCheckClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteHealthCheck to 30 seconds: + * + *

+ * 
+ * HealthCheckSettings.Builder healthCheckSettingsBuilder =
+ *     HealthCheckSettings.newBuilder();
+ * healthCheckSettingsBuilder.deleteHealthCheckSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * HealthCheckSettings healthCheckSettings = healthCheckSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class HealthCheckSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteHealthCheck. */ + public UnaryCallSettings deleteHealthCheckSettings() { + return ((HealthCheckStubSettings) getStubSettings()).deleteHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to getHealthCheck. */ + public UnaryCallSettings getHealthCheckSettings() { + return ((HealthCheckStubSettings) getStubSettings()).getHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to insertHealthCheck. */ + public UnaryCallSettings insertHealthCheckSettings() { + return ((HealthCheckStubSettings) getStubSettings()).insertHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to listHealthChecks. */ + public PagedCallSettings< + ListHealthChecksHttpRequest, HealthCheckList, ListHealthChecksPagedResponse> + listHealthChecksSettings() { + return ((HealthCheckStubSettings) getStubSettings()).listHealthChecksSettings(); + } + + /** Returns the object with the settings used for calls to patchHealthCheck. */ + public UnaryCallSettings patchHealthCheckSettings() { + return ((HealthCheckStubSettings) getStubSettings()).patchHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to updateHealthCheck. */ + public UnaryCallSettings updateHealthCheckSettings() { + return ((HealthCheckStubSettings) getStubSettings()).updateHealthCheckSettings(); + } + + public static final HealthCheckSettings create(HealthCheckStubSettings stub) throws IOException { + return new HealthCheckSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return HealthCheckStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return HealthCheckStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return HealthCheckStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return HealthCheckStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return HealthCheckStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return HealthCheckStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return HealthCheckStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return HealthCheckStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected HealthCheckSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for HealthCheckSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(HealthCheckStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(HealthCheckStubSettings.newBuilder()); + } + + protected Builder(HealthCheckSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(HealthCheckStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public HealthCheckStubSettings.Builder getStubSettingsBuilder() { + return ((HealthCheckStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteHealthCheck. */ + public UnaryCallSettings.Builder + deleteHealthCheckSettings() { + return getStubSettingsBuilder().deleteHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to getHealthCheck. */ + public UnaryCallSettings.Builder + getHealthCheckSettings() { + return getStubSettingsBuilder().getHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to insertHealthCheck. */ + public UnaryCallSettings.Builder + insertHealthCheckSettings() { + return getStubSettingsBuilder().insertHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to listHealthChecks. */ + public PagedCallSettings.Builder< + ListHealthChecksHttpRequest, HealthCheckList, ListHealthChecksPagedResponse> + listHealthChecksSettings() { + return getStubSettingsBuilder().listHealthChecksSettings(); + } + + /** Returns the builder for the settings used for calls to patchHealthCheck. */ + public UnaryCallSettings.Builder + patchHealthCheckSettings() { + return getStubSettingsBuilder().patchHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to updateHealthCheck. */ + public UnaryCallSettings.Builder + updateHealthCheckSettings() { + return getStubSettingsBuilder().updateHealthCheckSettings(); + } + + @Override + public HealthCheckSettings build() throws IOException { + return new HealthCheckSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthStatus.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthStatus.java new file mode 100644 index 000000000000..b70aabb2e31e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthStatus.java @@ -0,0 +1,233 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class HealthStatus implements ApiMessage { + private final String healthState; + private final String instance; + private final String ipAddress; + private final Integer port; + + private HealthStatus() { + this.healthState = null; + this.instance = null; + this.ipAddress = null; + this.port = null; + } + + private HealthStatus(String healthState, String instance, String ipAddress, Integer port) { + this.healthState = healthState; + this.instance = instance; + this.ipAddress = ipAddress; + this.port = port; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("healthState")) { + return healthState; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("ipAddress")) { + return ipAddress; + } + if (fieldName.equals("port")) { + return port; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getHealthState() { + return healthState; + } + + public String getInstance() { + return instance; + } + + public String getIpAddress() { + return ipAddress; + } + + public Integer getPort() { + return port; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(HealthStatus prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static HealthStatus getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final HealthStatus DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new HealthStatus(); + } + + public static class Builder { + private String healthState; + private String instance; + private String ipAddress; + private Integer port; + + Builder() {} + + public Builder mergeFrom(HealthStatus other) { + if (other == HealthStatus.getDefaultInstance()) return this; + if (other.getHealthState() != null) { + this.healthState = other.healthState; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getIpAddress() != null) { + this.ipAddress = other.ipAddress; + } + if (other.getPort() != null) { + this.port = other.port; + } + return this; + } + + Builder(HealthStatus source) { + this.healthState = source.healthState; + this.instance = source.instance; + this.ipAddress = source.ipAddress; + this.port = source.port; + } + + public String getHealthState() { + return healthState; + } + + public Builder setHealthState(String healthState) { + this.healthState = healthState; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getIpAddress() { + return ipAddress; + } + + public Builder setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + public Integer getPort() { + return port; + } + + public Builder setPort(Integer port) { + this.port = port; + return this; + } + + public HealthStatus build() { + + return new HealthStatus(healthState, instance, ipAddress, port); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setHealthState(this.healthState); + newBuilder.setInstance(this.instance); + newBuilder.setIpAddress(this.ipAddress); + newBuilder.setPort(this.port); + return newBuilder; + } + } + + @Override + public String toString() { + return "HealthStatus{" + + "healthState=" + + healthState + + ", " + + "instance=" + + instance + + ", " + + "ipAddress=" + + ipAddress + + ", " + + "port=" + + port + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof HealthStatus) { + HealthStatus that = (HealthStatus) o; + return Objects.equals(this.healthState, that.getHealthState()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.ipAddress, that.getIpAddress()) + && Objects.equals(this.port, that.getPort()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(healthState, instance, ipAddress, port); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HostRule.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HostRule.java new file mode 100644 index 000000000000..42e8e9b62bb0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HostRule.java @@ -0,0 +1,213 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class HostRule implements ApiMessage { + private final String description; + private final List hosts; + private final String pathMatcher; + + private HostRule() { + this.description = null; + this.hosts = null; + this.pathMatcher = null; + } + + private HostRule(String description, List hosts, String pathMatcher) { + this.description = description; + this.hosts = hosts; + this.pathMatcher = pathMatcher; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("hosts")) { + return hosts; + } + if (fieldName.equals("pathMatcher")) { + return pathMatcher; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getDescription() { + return description; + } + + public List getHostsList() { + return hosts; + } + + public String getPathMatcher() { + return pathMatcher; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(HostRule prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static HostRule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final HostRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new HostRule(); + } + + public static class Builder { + private String description; + private List hosts; + private String pathMatcher; + + Builder() {} + + public Builder mergeFrom(HostRule other) { + if (other == HostRule.getDefaultInstance()) return this; + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getHostsList() != null) { + this.hosts = other.hosts; + } + if (other.getPathMatcher() != null) { + this.pathMatcher = other.pathMatcher; + } + return this; + } + + Builder(HostRule source) { + this.description = source.description; + this.hosts = source.hosts; + this.pathMatcher = source.pathMatcher; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public List getHostsList() { + return hosts; + } + + public Builder addAllHosts(List hosts) { + if (this.hosts == null) { + this.hosts = new ArrayList<>(hosts.size()); + } + this.hosts.addAll(hosts); + return this; + } + + public Builder addHosts(String hosts) { + this.hosts.add(hosts); + return this; + } + + public String getPathMatcher() { + return pathMatcher; + } + + public Builder setPathMatcher(String pathMatcher) { + this.pathMatcher = pathMatcher; + return this; + } + + public HostRule build() { + + return new HostRule(description, hosts, pathMatcher); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDescription(this.description); + newBuilder.addAllHosts(this.hosts); + newBuilder.setPathMatcher(this.pathMatcher); + return newBuilder; + } + } + + @Override + public String toString() { + return "HostRule{" + + "description=" + + description + + ", " + + "hosts=" + + hosts + + ", " + + "pathMatcher=" + + pathMatcher + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof HostRule) { + HostRule that = (HostRule) o; + return Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.hosts, that.getHostsList()) + && Objects.equals(this.pathMatcher, that.getPathMatcher()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(description, hosts, pathMatcher); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheck.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheck.java new file mode 100644 index 000000000000..d9cf64e2df11 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheck.java @@ -0,0 +1,263 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class HttpHealthCheck implements ApiMessage { + private final String host; + private final Integer port; + private final String portName; + private final String proxyHeader; + private final String requestPath; + + private HttpHealthCheck() { + this.host = null; + this.port = null; + this.portName = null; + this.proxyHeader = null; + this.requestPath = null; + } + + private HttpHealthCheck( + String host, Integer port, String portName, String proxyHeader, String requestPath) { + this.host = host; + this.port = port; + this.portName = portName; + this.proxyHeader = proxyHeader; + this.requestPath = requestPath; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("host")) { + return host; + } + if (fieldName.equals("port")) { + return port; + } + if (fieldName.equals("portName")) { + return portName; + } + if (fieldName.equals("proxyHeader")) { + return proxyHeader; + } + if (fieldName.equals("requestPath")) { + return requestPath; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getHost() { + return host; + } + + public Integer getPort() { + return port; + } + + public String getPortName() { + return portName; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public String getRequestPath() { + return requestPath; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(HttpHealthCheck prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static HttpHealthCheck getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final HttpHealthCheck DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new HttpHealthCheck(); + } + + public static class Builder { + private String host; + private Integer port; + private String portName; + private String proxyHeader; + private String requestPath; + + Builder() {} + + public Builder mergeFrom(HttpHealthCheck other) { + if (other == HttpHealthCheck.getDefaultInstance()) return this; + if (other.getHost() != null) { + this.host = other.host; + } + if (other.getPort() != null) { + this.port = other.port; + } + if (other.getPortName() != null) { + this.portName = other.portName; + } + if (other.getProxyHeader() != null) { + this.proxyHeader = other.proxyHeader; + } + if (other.getRequestPath() != null) { + this.requestPath = other.requestPath; + } + return this; + } + + Builder(HttpHealthCheck source) { + this.host = source.host; + this.port = source.port; + this.portName = source.portName; + this.proxyHeader = source.proxyHeader; + this.requestPath = source.requestPath; + } + + public String getHost() { + return host; + } + + public Builder setHost(String host) { + this.host = host; + return this; + } + + public Integer getPort() { + return port; + } + + public Builder setPort(Integer port) { + this.port = port; + return this; + } + + public String getPortName() { + return portName; + } + + public Builder setPortName(String portName) { + this.portName = portName; + return this; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public Builder setProxyHeader(String proxyHeader) { + this.proxyHeader = proxyHeader; + return this; + } + + public String getRequestPath() { + return requestPath; + } + + public Builder setRequestPath(String requestPath) { + this.requestPath = requestPath; + return this; + } + + public HttpHealthCheck build() { + + return new HttpHealthCheck(host, port, portName, proxyHeader, requestPath); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setHost(this.host); + newBuilder.setPort(this.port); + newBuilder.setPortName(this.portName); + newBuilder.setProxyHeader(this.proxyHeader); + newBuilder.setRequestPath(this.requestPath); + return newBuilder; + } + } + + @Override + public String toString() { + return "HttpHealthCheck{" + + "host=" + + host + + ", " + + "port=" + + port + + ", " + + "portName=" + + portName + + ", " + + "proxyHeader=" + + proxyHeader + + ", " + + "requestPath=" + + requestPath + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof HttpHealthCheck) { + HttpHealthCheck that = (HttpHealthCheck) o; + return Objects.equals(this.host, that.getHost()) + && Objects.equals(this.port, that.getPort()) + && Objects.equals(this.portName, that.getPortName()) + && Objects.equals(this.proxyHeader, that.getProxyHeader()) + && Objects.equals(this.requestPath, that.getRequestPath()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(host, port, portName, proxyHeader, requestPath); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheck2.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheck2.java new file mode 100644 index 000000000000..315a881cebd4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheck2.java @@ -0,0 +1,533 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class HttpHealthCheck2 implements ApiMessage { + private final Integer checkIntervalSec; + private final String creationTimestamp; + private final String description; + private final Integer healthyThreshold; + private final String host; + private final String id; + private final String kind; + private final String name; + private final Integer port; + private final String requestPath; + private final String selfLink; + private final Integer timeoutSec; + private final Integer unhealthyThreshold; + + private HttpHealthCheck2() { + this.checkIntervalSec = null; + this.creationTimestamp = null; + this.description = null; + this.healthyThreshold = null; + this.host = null; + this.id = null; + this.kind = null; + this.name = null; + this.port = null; + this.requestPath = null; + this.selfLink = null; + this.timeoutSec = null; + this.unhealthyThreshold = null; + } + + private HttpHealthCheck2( + Integer checkIntervalSec, + String creationTimestamp, + String description, + Integer healthyThreshold, + String host, + String id, + String kind, + String name, + Integer port, + String requestPath, + String selfLink, + Integer timeoutSec, + Integer unhealthyThreshold) { + this.checkIntervalSec = checkIntervalSec; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.healthyThreshold = healthyThreshold; + this.host = host; + this.id = id; + this.kind = kind; + this.name = name; + this.port = port; + this.requestPath = requestPath; + this.selfLink = selfLink; + this.timeoutSec = timeoutSec; + this.unhealthyThreshold = unhealthyThreshold; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("checkIntervalSec")) { + return checkIntervalSec; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("healthyThreshold")) { + return healthyThreshold; + } + if (fieldName.equals("host")) { + return host; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("port")) { + return port; + } + if (fieldName.equals("requestPath")) { + return requestPath; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("timeoutSec")) { + return timeoutSec; + } + if (fieldName.equals("unhealthyThreshold")) { + return unhealthyThreshold; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getCheckIntervalSec() { + return checkIntervalSec; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public Integer getHealthyThreshold() { + return healthyThreshold; + } + + public String getHost() { + return host; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public Integer getPort() { + return port; + } + + public String getRequestPath() { + return requestPath; + } + + public String getSelfLink() { + return selfLink; + } + + public Integer getTimeoutSec() { + return timeoutSec; + } + + public Integer getUnhealthyThreshold() { + return unhealthyThreshold; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(HttpHealthCheck2 prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static HttpHealthCheck2 getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final HttpHealthCheck2 DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new HttpHealthCheck2(); + } + + public static class Builder { + private Integer checkIntervalSec; + private String creationTimestamp; + private String description; + private Integer healthyThreshold; + private String host; + private String id; + private String kind; + private String name; + private Integer port; + private String requestPath; + private String selfLink; + private Integer timeoutSec; + private Integer unhealthyThreshold; + + Builder() {} + + public Builder mergeFrom(HttpHealthCheck2 other) { + if (other == HttpHealthCheck2.getDefaultInstance()) return this; + if (other.getCheckIntervalSec() != null) { + this.checkIntervalSec = other.checkIntervalSec; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getHealthyThreshold() != null) { + this.healthyThreshold = other.healthyThreshold; + } + if (other.getHost() != null) { + this.host = other.host; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPort() != null) { + this.port = other.port; + } + if (other.getRequestPath() != null) { + this.requestPath = other.requestPath; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getTimeoutSec() != null) { + this.timeoutSec = other.timeoutSec; + } + if (other.getUnhealthyThreshold() != null) { + this.unhealthyThreshold = other.unhealthyThreshold; + } + return this; + } + + Builder(HttpHealthCheck2 source) { + this.checkIntervalSec = source.checkIntervalSec; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.healthyThreshold = source.healthyThreshold; + this.host = source.host; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.port = source.port; + this.requestPath = source.requestPath; + this.selfLink = source.selfLink; + this.timeoutSec = source.timeoutSec; + this.unhealthyThreshold = source.unhealthyThreshold; + } + + public Integer getCheckIntervalSec() { + return checkIntervalSec; + } + + public Builder setCheckIntervalSec(Integer checkIntervalSec) { + this.checkIntervalSec = checkIntervalSec; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public Integer getHealthyThreshold() { + return healthyThreshold; + } + + public Builder setHealthyThreshold(Integer healthyThreshold) { + this.healthyThreshold = healthyThreshold; + return this; + } + + public String getHost() { + return host; + } + + public Builder setHost(String host) { + this.host = host; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Integer getPort() { + return port; + } + + public Builder setPort(Integer port) { + this.port = port; + return this; + } + + public String getRequestPath() { + return requestPath; + } + + public Builder setRequestPath(String requestPath) { + this.requestPath = requestPath; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Integer getTimeoutSec() { + return timeoutSec; + } + + public Builder setTimeoutSec(Integer timeoutSec) { + this.timeoutSec = timeoutSec; + return this; + } + + public Integer getUnhealthyThreshold() { + return unhealthyThreshold; + } + + public Builder setUnhealthyThreshold(Integer unhealthyThreshold) { + this.unhealthyThreshold = unhealthyThreshold; + return this; + } + + public HttpHealthCheck2 build() { + + return new HttpHealthCheck2( + checkIntervalSec, + creationTimestamp, + description, + healthyThreshold, + host, + id, + kind, + name, + port, + requestPath, + selfLink, + timeoutSec, + unhealthyThreshold); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCheckIntervalSec(this.checkIntervalSec); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setHealthyThreshold(this.healthyThreshold); + newBuilder.setHost(this.host); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setPort(this.port); + newBuilder.setRequestPath(this.requestPath); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setTimeoutSec(this.timeoutSec); + newBuilder.setUnhealthyThreshold(this.unhealthyThreshold); + return newBuilder; + } + } + + @Override + public String toString() { + return "HttpHealthCheck2{" + + "checkIntervalSec=" + + checkIntervalSec + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "healthyThreshold=" + + healthyThreshold + + ", " + + "host=" + + host + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "port=" + + port + + ", " + + "requestPath=" + + requestPath + + ", " + + "selfLink=" + + selfLink + + ", " + + "timeoutSec=" + + timeoutSec + + ", " + + "unhealthyThreshold=" + + unhealthyThreshold + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof HttpHealthCheck2) { + HttpHealthCheck2 that = (HttpHealthCheck2) o; + return Objects.equals(this.checkIntervalSec, that.getCheckIntervalSec()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.healthyThreshold, that.getHealthyThreshold()) + && Objects.equals(this.host, that.getHost()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.port, that.getPort()) + && Objects.equals(this.requestPath, that.getRequestPath()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.timeoutSec, that.getTimeoutSec()) + && Objects.equals(this.unhealthyThreshold, that.getUnhealthyThreshold()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + checkIntervalSec, + creationTimestamp, + description, + healthyThreshold, + host, + id, + kind, + name, + port, + requestPath, + selfLink, + timeoutSec, + unhealthyThreshold); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckClient.java new file mode 100644 index 000000000000..a73efe768568 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckClient.java @@ -0,0 +1,958 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.HttpHealthCheckStub; +import com.google.cloud.compute.v1.stub.HttpHealthCheckStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+ *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+ *   Operation response = httpHealthCheckClient.deleteHttpHealthCheck(httpHealthCheck);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the httpHealthCheckClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of HttpHealthCheckSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * HttpHealthCheckSettings httpHealthCheckSettings =
+ *     HttpHealthCheckSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * HttpHealthCheckClient httpHealthCheckClient =
+ *     HttpHealthCheckClient.create(httpHealthCheckSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * HttpHealthCheckSettings httpHealthCheckSettings =
+ *     HttpHealthCheckSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * HttpHealthCheckClient httpHealthCheckClient =
+ *     HttpHealthCheckClient.create(httpHealthCheckSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class HttpHealthCheckClient implements BackgroundResource { + private final HttpHealthCheckSettings settings; + private final HttpHealthCheckStub stub; + + /** Constructs an instance of HttpHealthCheckClient with default settings. */ + public static final HttpHealthCheckClient create() throws IOException { + return create(HttpHealthCheckSettings.newBuilder().build()); + } + + /** + * Constructs an instance of HttpHealthCheckClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final HttpHealthCheckClient create(HttpHealthCheckSettings settings) + throws IOException { + return new HttpHealthCheckClient(settings); + } + + /** + * Constructs an instance of HttpHealthCheckClient, using the given stub for making calls. This is + * for advanced usage - prefer to use HttpHealthCheckSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final HttpHealthCheckClient create(HttpHealthCheckStub stub) { + return new HttpHealthCheckClient(stub); + } + + /** + * Constructs an instance of HttpHealthCheckClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpHealthCheckClient(HttpHealthCheckSettings settings) throws IOException { + this.settings = settings; + this.stub = ((HttpHealthCheckStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected HttpHealthCheckClient(HttpHealthCheckStub stub) { + this.settings = null; + this.stub = stub; + } + + public final HttpHealthCheckSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public HttpHealthCheckStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HttpHealthCheck resource. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   Operation response = httpHealthCheckClient.deleteHttpHealthCheck(httpHealthCheck);
+   * }
+   * 
+ * + * @param httpHealthCheck Name of the HttpHealthCheck resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteHttpHealthCheck(ProjectGlobalHttpHealthCheckName httpHealthCheck) { + + DeleteHttpHealthCheckHttpRequest request = + DeleteHttpHealthCheckHttpRequest.newBuilder() + .setHttpHealthCheck(httpHealthCheck == null ? null : httpHealthCheck.toString()) + .build(); + return deleteHttpHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HttpHealthCheck resource. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   Operation response = httpHealthCheckClient.deleteHttpHealthCheck(httpHealthCheck.toString());
+   * }
+   * 
+ * + * @param httpHealthCheck Name of the HttpHealthCheck resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteHttpHealthCheck(String httpHealthCheck) { + + DeleteHttpHealthCheckHttpRequest request = + DeleteHttpHealthCheckHttpRequest.newBuilder().setHttpHealthCheck(httpHealthCheck).build(); + return deleteHttpHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HttpHealthCheck resource. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   DeleteHttpHealthCheckHttpRequest request = DeleteHttpHealthCheckHttpRequest.newBuilder()
+   *     .setHttpHealthCheck(httpHealthCheck.toString())
+   *     .build();
+   *   Operation response = httpHealthCheckClient.deleteHttpHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteHttpHealthCheck(DeleteHttpHealthCheckHttpRequest request) { + return deleteHttpHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HttpHealthCheck resource. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   DeleteHttpHealthCheckHttpRequest request = DeleteHttpHealthCheckHttpRequest.newBuilder()
+   *     .setHttpHealthCheck(httpHealthCheck.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = httpHealthCheckClient.deleteHttpHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteHttpHealthCheckCallable() { + return stub.deleteHttpHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HttpHealthCheck resource. Gets a list of available HTTP health checks by + * making a list() request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   HttpHealthCheck2 response = httpHealthCheckClient.getHttpHealthCheck(httpHealthCheck);
+   * }
+   * 
+ * + * @param httpHealthCheck Name of the HttpHealthCheck resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final HttpHealthCheck2 getHttpHealthCheck( + ProjectGlobalHttpHealthCheckName httpHealthCheck) { + + GetHttpHealthCheckHttpRequest request = + GetHttpHealthCheckHttpRequest.newBuilder() + .setHttpHealthCheck(httpHealthCheck == null ? null : httpHealthCheck.toString()) + .build(); + return getHttpHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HttpHealthCheck resource. Gets a list of available HTTP health checks by + * making a list() request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   HttpHealthCheck2 response = httpHealthCheckClient.getHttpHealthCheck(httpHealthCheck.toString());
+   * }
+   * 
+ * + * @param httpHealthCheck Name of the HttpHealthCheck resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final HttpHealthCheck2 getHttpHealthCheck(String httpHealthCheck) { + + GetHttpHealthCheckHttpRequest request = + GetHttpHealthCheckHttpRequest.newBuilder().setHttpHealthCheck(httpHealthCheck).build(); + return getHttpHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HttpHealthCheck resource. Gets a list of available HTTP health checks by + * making a list() request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   GetHttpHealthCheckHttpRequest request = GetHttpHealthCheckHttpRequest.newBuilder()
+   *     .setHttpHealthCheck(httpHealthCheck.toString())
+   *     .build();
+   *   HttpHealthCheck2 response = httpHealthCheckClient.getHttpHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final HttpHealthCheck2 getHttpHealthCheck(GetHttpHealthCheckHttpRequest request) { + return getHttpHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HttpHealthCheck resource. Gets a list of available HTTP health checks by + * making a list() request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   GetHttpHealthCheckHttpRequest request = GetHttpHealthCheckHttpRequest.newBuilder()
+   *     .setHttpHealthCheck(httpHealthCheck.toString())
+   *     .build();
+   *   ApiFuture<HttpHealthCheck2> future = httpHealthCheckClient.getHttpHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   HttpHealthCheck2 response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getHttpHealthCheckCallable() { + return stub.getHttpHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HttpHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   Operation response = httpHealthCheckClient.insertHttpHealthCheck(project, httpHealthCheckResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param httpHealthCheckResource An HttpHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTP. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertHttpHealthCheck( + ProjectName project, HttpHealthCheck2 httpHealthCheckResource) { + + InsertHttpHealthCheckHttpRequest request = + InsertHttpHealthCheckHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setHttpHealthCheckResource(httpHealthCheckResource) + .build(); + return insertHttpHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HttpHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   Operation response = httpHealthCheckClient.insertHttpHealthCheck(project.toString(), httpHealthCheckResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param httpHealthCheckResource An HttpHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTP. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertHttpHealthCheck( + String project, HttpHealthCheck2 httpHealthCheckResource) { + + InsertHttpHealthCheckHttpRequest request = + InsertHttpHealthCheckHttpRequest.newBuilder() + .setProject(project) + .setHttpHealthCheckResource(httpHealthCheckResource) + .build(); + return insertHttpHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HttpHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   InsertHttpHealthCheckHttpRequest request = InsertHttpHealthCheckHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setHttpHealthCheckResource(httpHealthCheckResource)
+   *     .build();
+   *   Operation response = httpHealthCheckClient.insertHttpHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertHttpHealthCheck(InsertHttpHealthCheckHttpRequest request) { + return insertHttpHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HttpHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   InsertHttpHealthCheckHttpRequest request = InsertHttpHealthCheckHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setHttpHealthCheckResource(httpHealthCheckResource)
+   *     .build();
+   *   ApiFuture<Operation> future = httpHealthCheckClient.insertHttpHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertHttpHealthCheckCallable() { + return stub.insertHttpHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HttpHealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (HttpHealthCheck2 element : httpHealthCheckClient.listHttpHealthChecks(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListHttpHealthChecksPagedResponse listHttpHealthChecks(ProjectName project) { + ListHttpHealthChecksHttpRequest request = + ListHttpHealthChecksHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listHttpHealthChecks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HttpHealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (HttpHealthCheck2 element : httpHealthCheckClient.listHttpHealthChecks(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListHttpHealthChecksPagedResponse listHttpHealthChecks(String project) { + ListHttpHealthChecksHttpRequest request = + ListHttpHealthChecksHttpRequest.newBuilder().setProject(project).build(); + return listHttpHealthChecks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HttpHealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListHttpHealthChecksHttpRequest request = ListHttpHealthChecksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (HttpHealthCheck2 element : httpHealthCheckClient.listHttpHealthChecks(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListHttpHealthChecksPagedResponse listHttpHealthChecks( + ListHttpHealthChecksHttpRequest request) { + return listHttpHealthChecksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HttpHealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListHttpHealthChecksHttpRequest request = ListHttpHealthChecksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListHttpHealthChecksPagedResponse> future = httpHealthCheckClient.listHttpHealthChecksPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (HttpHealthCheck2 element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listHttpHealthChecksPagedCallable() { + return stub.listHttpHealthChecksPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HttpHealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListHttpHealthChecksHttpRequest request = ListHttpHealthChecksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     HttpHealthCheckList response = httpHealthCheckClient.listHttpHealthChecksCallable().call(request);
+   *     for (HttpHealthCheck2 element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listHttpHealthChecksCallable() { + return stub.listHttpHealthChecksCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpHealthCheck resource in the specified project using the data included in the + * request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   Operation response = httpHealthCheckClient.patchHttpHealthCheck(httpHealthCheck, httpHealthCheckResource);
+   * }
+   * 
+ * + * @param httpHealthCheck Name of the HttpHealthCheck resource to patch. + * @param httpHealthCheckResource An HttpHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTP. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchHttpHealthCheck( + ProjectGlobalHttpHealthCheckName httpHealthCheck, HttpHealthCheck2 httpHealthCheckResource) { + + PatchHttpHealthCheckHttpRequest request = + PatchHttpHealthCheckHttpRequest.newBuilder() + .setHttpHealthCheck(httpHealthCheck == null ? null : httpHealthCheck.toString()) + .setHttpHealthCheckResource(httpHealthCheckResource) + .build(); + return patchHttpHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpHealthCheck resource in the specified project using the data included in the + * request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   Operation response = httpHealthCheckClient.patchHttpHealthCheck(httpHealthCheck.toString(), httpHealthCheckResource);
+   * }
+   * 
+ * + * @param httpHealthCheck Name of the HttpHealthCheck resource to patch. + * @param httpHealthCheckResource An HttpHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTP. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchHttpHealthCheck( + String httpHealthCheck, HttpHealthCheck2 httpHealthCheckResource) { + + PatchHttpHealthCheckHttpRequest request = + PatchHttpHealthCheckHttpRequest.newBuilder() + .setHttpHealthCheck(httpHealthCheck) + .setHttpHealthCheckResource(httpHealthCheckResource) + .build(); + return patchHttpHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpHealthCheck resource in the specified project using the data included in the + * request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   PatchHttpHealthCheckHttpRequest request = PatchHttpHealthCheckHttpRequest.newBuilder()
+   *     .setHttpHealthCheck(httpHealthCheck.toString())
+   *     .setHttpHealthCheckResource(httpHealthCheckResource)
+   *     .build();
+   *   Operation response = httpHealthCheckClient.patchHttpHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchHttpHealthCheck(PatchHttpHealthCheckHttpRequest request) { + return patchHttpHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpHealthCheck resource in the specified project using the data included in the + * request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   PatchHttpHealthCheckHttpRequest request = PatchHttpHealthCheckHttpRequest.newBuilder()
+   *     .setHttpHealthCheck(httpHealthCheck.toString())
+   *     .setHttpHealthCheckResource(httpHealthCheckResource)
+   *     .build();
+   *   ApiFuture<Operation> future = httpHealthCheckClient.patchHttpHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + patchHttpHealthCheckCallable() { + return stub.patchHttpHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   Operation response = httpHealthCheckClient.updateHttpHealthCheck(httpHealthCheck, httpHealthCheckResource);
+   * }
+   * 
+ * + * @param httpHealthCheck Name of the HttpHealthCheck resource to update. + * @param httpHealthCheckResource An HttpHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTP. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateHttpHealthCheck( + ProjectGlobalHttpHealthCheckName httpHealthCheck, HttpHealthCheck2 httpHealthCheckResource) { + + UpdateHttpHealthCheckHttpRequest request = + UpdateHttpHealthCheckHttpRequest.newBuilder() + .setHttpHealthCheck(httpHealthCheck == null ? null : httpHealthCheck.toString()) + .setHttpHealthCheckResource(httpHealthCheckResource) + .build(); + return updateHttpHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   Operation response = httpHealthCheckClient.updateHttpHealthCheck(httpHealthCheck.toString(), httpHealthCheckResource);
+   * }
+   * 
+ * + * @param httpHealthCheck Name of the HttpHealthCheck resource to update. + * @param httpHealthCheckResource An HttpHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTP. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateHttpHealthCheck( + String httpHealthCheck, HttpHealthCheck2 httpHealthCheckResource) { + + UpdateHttpHealthCheckHttpRequest request = + UpdateHttpHealthCheckHttpRequest.newBuilder() + .setHttpHealthCheck(httpHealthCheck) + .setHttpHealthCheckResource(httpHealthCheckResource) + .build(); + return updateHttpHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   UpdateHttpHealthCheckHttpRequest request = UpdateHttpHealthCheckHttpRequest.newBuilder()
+   *     .setHttpHealthCheck(httpHealthCheck.toString())
+   *     .setHttpHealthCheckResource(httpHealthCheckResource)
+   *     .build();
+   *   Operation response = httpHealthCheckClient.updateHttpHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateHttpHealthCheck(UpdateHttpHealthCheckHttpRequest request) { + return updateHttpHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+   *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+   *   HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build();
+   *   UpdateHttpHealthCheckHttpRequest request = UpdateHttpHealthCheckHttpRequest.newBuilder()
+   *     .setHttpHealthCheck(httpHealthCheck.toString())
+   *     .setHttpHealthCheckResource(httpHealthCheckResource)
+   *     .build();
+   *   ApiFuture<Operation> future = httpHealthCheckClient.updateHttpHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + updateHttpHealthCheckCallable() { + return stub.updateHttpHealthCheckCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListHttpHealthChecksPagedResponse + extends AbstractPagedListResponse< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, HttpHealthCheck2, + ListHttpHealthChecksPage, ListHttpHealthChecksFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListHttpHealthChecksPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListHttpHealthChecksPagedResponse apply(ListHttpHealthChecksPage input) { + return new ListHttpHealthChecksPagedResponse(input); + } + }); + } + + private ListHttpHealthChecksPagedResponse(ListHttpHealthChecksPage page) { + super(page, ListHttpHealthChecksFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListHttpHealthChecksPage + extends AbstractPage< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, HttpHealthCheck2, + ListHttpHealthChecksPage> { + + private ListHttpHealthChecksPage( + PageContext context, + HttpHealthCheckList response) { + super(context, response); + } + + private static ListHttpHealthChecksPage createEmptyPage() { + return new ListHttpHealthChecksPage(null, null); + } + + @Override + protected ListHttpHealthChecksPage createPage( + PageContext context, + HttpHealthCheckList response) { + return new ListHttpHealthChecksPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListHttpHealthChecksFixedSizeCollection + extends AbstractFixedSizeCollection< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, HttpHealthCheck2, + ListHttpHealthChecksPage, ListHttpHealthChecksFixedSizeCollection> { + + private ListHttpHealthChecksFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListHttpHealthChecksFixedSizeCollection createEmptyCollection() { + return new ListHttpHealthChecksFixedSizeCollection(null, 0); + } + + @Override + protected ListHttpHealthChecksFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListHttpHealthChecksFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckList.java new file mode 100644 index 000000000000..9daa88ffc761 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class HttpHealthCheckList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private HttpHealthCheckList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private HttpHealthCheckList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(HttpHealthCheckList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static HttpHealthCheckList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final HttpHealthCheckList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new HttpHealthCheckList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(HttpHealthCheckList other) { + if (other == HttpHealthCheckList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(HttpHealthCheckList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(HttpHealthCheck2 items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public HttpHealthCheckList build() { + + return new HttpHealthCheckList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "HttpHealthCheckList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof HttpHealthCheckList) { + HttpHealthCheckList that = (HttpHealthCheckList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckSettings.java new file mode 100644 index 000000000000..889c5a7a07db --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpHealthCheckSettings.java @@ -0,0 +1,247 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.HttpHealthCheckClient.ListHttpHealthChecksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.HttpHealthCheckStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link HttpHealthCheckClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteHttpHealthCheck to 30 seconds: + * + *

+ * 
+ * HttpHealthCheckSettings.Builder httpHealthCheckSettingsBuilder =
+ *     HttpHealthCheckSettings.newBuilder();
+ * httpHealthCheckSettingsBuilder.deleteHttpHealthCheckSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * HttpHealthCheckSettings httpHealthCheckSettings = httpHealthCheckSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class HttpHealthCheckSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteHttpHealthCheck. */ + public UnaryCallSettings + deleteHttpHealthCheckSettings() { + return ((HttpHealthCheckStubSettings) getStubSettings()).deleteHttpHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to getHttpHealthCheck. */ + public UnaryCallSettings + getHttpHealthCheckSettings() { + return ((HttpHealthCheckStubSettings) getStubSettings()).getHttpHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to insertHttpHealthCheck. */ + public UnaryCallSettings + insertHttpHealthCheckSettings() { + return ((HttpHealthCheckStubSettings) getStubSettings()).insertHttpHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to listHttpHealthChecks. */ + public PagedCallSettings< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, ListHttpHealthChecksPagedResponse> + listHttpHealthChecksSettings() { + return ((HttpHealthCheckStubSettings) getStubSettings()).listHttpHealthChecksSettings(); + } + + /** Returns the object with the settings used for calls to patchHttpHealthCheck. */ + public UnaryCallSettings + patchHttpHealthCheckSettings() { + return ((HttpHealthCheckStubSettings) getStubSettings()).patchHttpHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to updateHttpHealthCheck. */ + public UnaryCallSettings + updateHttpHealthCheckSettings() { + return ((HttpHealthCheckStubSettings) getStubSettings()).updateHttpHealthCheckSettings(); + } + + public static final HttpHealthCheckSettings create(HttpHealthCheckStubSettings stub) + throws IOException { + return new HttpHealthCheckSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return HttpHealthCheckStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return HttpHealthCheckStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return HttpHealthCheckStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return HttpHealthCheckStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return HttpHealthCheckStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return HttpHealthCheckStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return HttpHealthCheckStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return HttpHealthCheckStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected HttpHealthCheckSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for HttpHealthCheckSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(HttpHealthCheckStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(HttpHealthCheckStubSettings.newBuilder()); + } + + protected Builder(HttpHealthCheckSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(HttpHealthCheckStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public HttpHealthCheckStubSettings.Builder getStubSettingsBuilder() { + return ((HttpHealthCheckStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteHttpHealthCheck. */ + public UnaryCallSettings.Builder + deleteHttpHealthCheckSettings() { + return getStubSettingsBuilder().deleteHttpHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to getHttpHealthCheck. */ + public UnaryCallSettings.Builder + getHttpHealthCheckSettings() { + return getStubSettingsBuilder().getHttpHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to insertHttpHealthCheck. */ + public UnaryCallSettings.Builder + insertHttpHealthCheckSettings() { + return getStubSettingsBuilder().insertHttpHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to listHttpHealthChecks. */ + public PagedCallSettings.Builder< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, ListHttpHealthChecksPagedResponse> + listHttpHealthChecksSettings() { + return getStubSettingsBuilder().listHttpHealthChecksSettings(); + } + + /** Returns the builder for the settings used for calls to patchHttpHealthCheck. */ + public UnaryCallSettings.Builder + patchHttpHealthCheckSettings() { + return getStubSettingsBuilder().patchHttpHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to updateHttpHealthCheck. */ + public UnaryCallSettings.Builder + updateHttpHealthCheckSettings() { + return getStubSettingsBuilder().updateHttpHealthCheckSettings(); + } + + @Override + public HttpHealthCheckSettings build() throws IOException { + return new HttpHealthCheckSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpSHealthCheck.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpSHealthCheck.java new file mode 100644 index 000000000000..3631367073bd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpSHealthCheck.java @@ -0,0 +1,263 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class HttpSHealthCheck implements ApiMessage { + private final String host; + private final Integer port; + private final String portName; + private final String proxyHeader; + private final String requestPath; + + private HttpSHealthCheck() { + this.host = null; + this.port = null; + this.portName = null; + this.proxyHeader = null; + this.requestPath = null; + } + + private HttpSHealthCheck( + String host, Integer port, String portName, String proxyHeader, String requestPath) { + this.host = host; + this.port = port; + this.portName = portName; + this.proxyHeader = proxyHeader; + this.requestPath = requestPath; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("host")) { + return host; + } + if (fieldName.equals("port")) { + return port; + } + if (fieldName.equals("portName")) { + return portName; + } + if (fieldName.equals("proxyHeader")) { + return proxyHeader; + } + if (fieldName.equals("requestPath")) { + return requestPath; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getHost() { + return host; + } + + public Integer getPort() { + return port; + } + + public String getPortName() { + return portName; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public String getRequestPath() { + return requestPath; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(HttpSHealthCheck prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static HttpSHealthCheck getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final HttpSHealthCheck DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new HttpSHealthCheck(); + } + + public static class Builder { + private String host; + private Integer port; + private String portName; + private String proxyHeader; + private String requestPath; + + Builder() {} + + public Builder mergeFrom(HttpSHealthCheck other) { + if (other == HttpSHealthCheck.getDefaultInstance()) return this; + if (other.getHost() != null) { + this.host = other.host; + } + if (other.getPort() != null) { + this.port = other.port; + } + if (other.getPortName() != null) { + this.portName = other.portName; + } + if (other.getProxyHeader() != null) { + this.proxyHeader = other.proxyHeader; + } + if (other.getRequestPath() != null) { + this.requestPath = other.requestPath; + } + return this; + } + + Builder(HttpSHealthCheck source) { + this.host = source.host; + this.port = source.port; + this.portName = source.portName; + this.proxyHeader = source.proxyHeader; + this.requestPath = source.requestPath; + } + + public String getHost() { + return host; + } + + public Builder setHost(String host) { + this.host = host; + return this; + } + + public Integer getPort() { + return port; + } + + public Builder setPort(Integer port) { + this.port = port; + return this; + } + + public String getPortName() { + return portName; + } + + public Builder setPortName(String portName) { + this.portName = portName; + return this; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public Builder setProxyHeader(String proxyHeader) { + this.proxyHeader = proxyHeader; + return this; + } + + public String getRequestPath() { + return requestPath; + } + + public Builder setRequestPath(String requestPath) { + this.requestPath = requestPath; + return this; + } + + public HttpSHealthCheck build() { + + return new HttpSHealthCheck(host, port, portName, proxyHeader, requestPath); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setHost(this.host); + newBuilder.setPort(this.port); + newBuilder.setPortName(this.portName); + newBuilder.setProxyHeader(this.proxyHeader); + newBuilder.setRequestPath(this.requestPath); + return newBuilder; + } + } + + @Override + public String toString() { + return "HttpSHealthCheck{" + + "host=" + + host + + ", " + + "port=" + + port + + ", " + + "portName=" + + portName + + ", " + + "proxyHeader=" + + proxyHeader + + ", " + + "requestPath=" + + requestPath + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof HttpSHealthCheck) { + HttpSHealthCheck that = (HttpSHealthCheck) o; + return Objects.equals(this.host, that.getHost()) + && Objects.equals(this.port, that.getPort()) + && Objects.equals(this.portName, that.getPortName()) + && Objects.equals(this.proxyHeader, that.getProxyHeader()) + && Objects.equals(this.requestPath, that.getRequestPath()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(host, port, portName, proxyHeader, requestPath); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheck2.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheck2.java new file mode 100644 index 000000000000..704fe75934c8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheck2.java @@ -0,0 +1,533 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class HttpsHealthCheck2 implements ApiMessage { + private final Integer checkIntervalSec; + private final String creationTimestamp; + private final String description; + private final Integer healthyThreshold; + private final String host; + private final String id; + private final String kind; + private final String name; + private final Integer port; + private final String requestPath; + private final String selfLink; + private final Integer timeoutSec; + private final Integer unhealthyThreshold; + + private HttpsHealthCheck2() { + this.checkIntervalSec = null; + this.creationTimestamp = null; + this.description = null; + this.healthyThreshold = null; + this.host = null; + this.id = null; + this.kind = null; + this.name = null; + this.port = null; + this.requestPath = null; + this.selfLink = null; + this.timeoutSec = null; + this.unhealthyThreshold = null; + } + + private HttpsHealthCheck2( + Integer checkIntervalSec, + String creationTimestamp, + String description, + Integer healthyThreshold, + String host, + String id, + String kind, + String name, + Integer port, + String requestPath, + String selfLink, + Integer timeoutSec, + Integer unhealthyThreshold) { + this.checkIntervalSec = checkIntervalSec; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.healthyThreshold = healthyThreshold; + this.host = host; + this.id = id; + this.kind = kind; + this.name = name; + this.port = port; + this.requestPath = requestPath; + this.selfLink = selfLink; + this.timeoutSec = timeoutSec; + this.unhealthyThreshold = unhealthyThreshold; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("checkIntervalSec")) { + return checkIntervalSec; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("healthyThreshold")) { + return healthyThreshold; + } + if (fieldName.equals("host")) { + return host; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("port")) { + return port; + } + if (fieldName.equals("requestPath")) { + return requestPath; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("timeoutSec")) { + return timeoutSec; + } + if (fieldName.equals("unhealthyThreshold")) { + return unhealthyThreshold; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getCheckIntervalSec() { + return checkIntervalSec; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public Integer getHealthyThreshold() { + return healthyThreshold; + } + + public String getHost() { + return host; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public Integer getPort() { + return port; + } + + public String getRequestPath() { + return requestPath; + } + + public String getSelfLink() { + return selfLink; + } + + public Integer getTimeoutSec() { + return timeoutSec; + } + + public Integer getUnhealthyThreshold() { + return unhealthyThreshold; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(HttpsHealthCheck2 prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static HttpsHealthCheck2 getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final HttpsHealthCheck2 DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new HttpsHealthCheck2(); + } + + public static class Builder { + private Integer checkIntervalSec; + private String creationTimestamp; + private String description; + private Integer healthyThreshold; + private String host; + private String id; + private String kind; + private String name; + private Integer port; + private String requestPath; + private String selfLink; + private Integer timeoutSec; + private Integer unhealthyThreshold; + + Builder() {} + + public Builder mergeFrom(HttpsHealthCheck2 other) { + if (other == HttpsHealthCheck2.getDefaultInstance()) return this; + if (other.getCheckIntervalSec() != null) { + this.checkIntervalSec = other.checkIntervalSec; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getHealthyThreshold() != null) { + this.healthyThreshold = other.healthyThreshold; + } + if (other.getHost() != null) { + this.host = other.host; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPort() != null) { + this.port = other.port; + } + if (other.getRequestPath() != null) { + this.requestPath = other.requestPath; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getTimeoutSec() != null) { + this.timeoutSec = other.timeoutSec; + } + if (other.getUnhealthyThreshold() != null) { + this.unhealthyThreshold = other.unhealthyThreshold; + } + return this; + } + + Builder(HttpsHealthCheck2 source) { + this.checkIntervalSec = source.checkIntervalSec; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.healthyThreshold = source.healthyThreshold; + this.host = source.host; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.port = source.port; + this.requestPath = source.requestPath; + this.selfLink = source.selfLink; + this.timeoutSec = source.timeoutSec; + this.unhealthyThreshold = source.unhealthyThreshold; + } + + public Integer getCheckIntervalSec() { + return checkIntervalSec; + } + + public Builder setCheckIntervalSec(Integer checkIntervalSec) { + this.checkIntervalSec = checkIntervalSec; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public Integer getHealthyThreshold() { + return healthyThreshold; + } + + public Builder setHealthyThreshold(Integer healthyThreshold) { + this.healthyThreshold = healthyThreshold; + return this; + } + + public String getHost() { + return host; + } + + public Builder setHost(String host) { + this.host = host; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Integer getPort() { + return port; + } + + public Builder setPort(Integer port) { + this.port = port; + return this; + } + + public String getRequestPath() { + return requestPath; + } + + public Builder setRequestPath(String requestPath) { + this.requestPath = requestPath; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Integer getTimeoutSec() { + return timeoutSec; + } + + public Builder setTimeoutSec(Integer timeoutSec) { + this.timeoutSec = timeoutSec; + return this; + } + + public Integer getUnhealthyThreshold() { + return unhealthyThreshold; + } + + public Builder setUnhealthyThreshold(Integer unhealthyThreshold) { + this.unhealthyThreshold = unhealthyThreshold; + return this; + } + + public HttpsHealthCheck2 build() { + + return new HttpsHealthCheck2( + checkIntervalSec, + creationTimestamp, + description, + healthyThreshold, + host, + id, + kind, + name, + port, + requestPath, + selfLink, + timeoutSec, + unhealthyThreshold); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCheckIntervalSec(this.checkIntervalSec); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setHealthyThreshold(this.healthyThreshold); + newBuilder.setHost(this.host); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setPort(this.port); + newBuilder.setRequestPath(this.requestPath); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setTimeoutSec(this.timeoutSec); + newBuilder.setUnhealthyThreshold(this.unhealthyThreshold); + return newBuilder; + } + } + + @Override + public String toString() { + return "HttpsHealthCheck2{" + + "checkIntervalSec=" + + checkIntervalSec + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "healthyThreshold=" + + healthyThreshold + + ", " + + "host=" + + host + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "port=" + + port + + ", " + + "requestPath=" + + requestPath + + ", " + + "selfLink=" + + selfLink + + ", " + + "timeoutSec=" + + timeoutSec + + ", " + + "unhealthyThreshold=" + + unhealthyThreshold + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof HttpsHealthCheck2) { + HttpsHealthCheck2 that = (HttpsHealthCheck2) o; + return Objects.equals(this.checkIntervalSec, that.getCheckIntervalSec()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.healthyThreshold, that.getHealthyThreshold()) + && Objects.equals(this.host, that.getHost()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.port, that.getPort()) + && Objects.equals(this.requestPath, that.getRequestPath()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.timeoutSec, that.getTimeoutSec()) + && Objects.equals(this.unhealthyThreshold, that.getUnhealthyThreshold()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + checkIntervalSec, + creationTimestamp, + description, + healthyThreshold, + host, + id, + kind, + name, + port, + requestPath, + selfLink, + timeoutSec, + unhealthyThreshold); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckClient.java new file mode 100644 index 000000000000..d400dbc49faf --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckClient.java @@ -0,0 +1,967 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.HttpsHealthCheckStub; +import com.google.cloud.compute.v1.stub.HttpsHealthCheckStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+ *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+ *   Operation response = httpsHealthCheckClient.deleteHttpsHealthCheck(httpsHealthCheck);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the httpsHealthCheckClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of HttpsHealthCheckSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * HttpsHealthCheckSettings httpsHealthCheckSettings =
+ *     HttpsHealthCheckSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * HttpsHealthCheckClient httpsHealthCheckClient =
+ *     HttpsHealthCheckClient.create(httpsHealthCheckSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * HttpsHealthCheckSettings httpsHealthCheckSettings =
+ *     HttpsHealthCheckSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * HttpsHealthCheckClient httpsHealthCheckClient =
+ *     HttpsHealthCheckClient.create(httpsHealthCheckSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class HttpsHealthCheckClient implements BackgroundResource { + private final HttpsHealthCheckSettings settings; + private final HttpsHealthCheckStub stub; + + /** Constructs an instance of HttpsHealthCheckClient with default settings. */ + public static final HttpsHealthCheckClient create() throws IOException { + return create(HttpsHealthCheckSettings.newBuilder().build()); + } + + /** + * Constructs an instance of HttpsHealthCheckClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final HttpsHealthCheckClient create(HttpsHealthCheckSettings settings) + throws IOException { + return new HttpsHealthCheckClient(settings); + } + + /** + * Constructs an instance of HttpsHealthCheckClient, using the given stub for making calls. This + * is for advanced usage - prefer to use HttpsHealthCheckSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final HttpsHealthCheckClient create(HttpsHealthCheckStub stub) { + return new HttpsHealthCheckClient(stub); + } + + /** + * Constructs an instance of HttpsHealthCheckClient, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpsHealthCheckClient(HttpsHealthCheckSettings settings) throws IOException { + this.settings = settings; + this.stub = ((HttpsHealthCheckStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected HttpsHealthCheckClient(HttpsHealthCheckStub stub) { + this.settings = null; + this.stub = stub; + } + + public final HttpsHealthCheckSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public HttpsHealthCheckStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HttpsHealthCheck resource. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   Operation response = httpsHealthCheckClient.deleteHttpsHealthCheck(httpsHealthCheck);
+   * }
+   * 
+ * + * @param httpsHealthCheck Name of the HttpsHealthCheck resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteHttpsHealthCheck( + ProjectGlobalHttpsHealthCheckName httpsHealthCheck) { + + DeleteHttpsHealthCheckHttpRequest request = + DeleteHttpsHealthCheckHttpRequest.newBuilder() + .setHttpsHealthCheck(httpsHealthCheck == null ? null : httpsHealthCheck.toString()) + .build(); + return deleteHttpsHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HttpsHealthCheck resource. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   Operation response = httpsHealthCheckClient.deleteHttpsHealthCheck(httpsHealthCheck.toString());
+   * }
+   * 
+ * + * @param httpsHealthCheck Name of the HttpsHealthCheck resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteHttpsHealthCheck(String httpsHealthCheck) { + + DeleteHttpsHealthCheckHttpRequest request = + DeleteHttpsHealthCheckHttpRequest.newBuilder() + .setHttpsHealthCheck(httpsHealthCheck) + .build(); + return deleteHttpsHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HttpsHealthCheck resource. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   DeleteHttpsHealthCheckHttpRequest request = DeleteHttpsHealthCheckHttpRequest.newBuilder()
+   *     .setHttpsHealthCheck(httpsHealthCheck.toString())
+   *     .build();
+   *   Operation response = httpsHealthCheckClient.deleteHttpsHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteHttpsHealthCheck(DeleteHttpsHealthCheckHttpRequest request) { + return deleteHttpsHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified HttpsHealthCheck resource. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   DeleteHttpsHealthCheckHttpRequest request = DeleteHttpsHealthCheckHttpRequest.newBuilder()
+   *     .setHttpsHealthCheck(httpsHealthCheck.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = httpsHealthCheckClient.deleteHttpsHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteHttpsHealthCheckCallable() { + return stub.deleteHttpsHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HttpsHealthCheck resource. Gets a list of available HTTPS health checks + * by making a list() request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   HttpsHealthCheck2 response = httpsHealthCheckClient.getHttpsHealthCheck(httpsHealthCheck);
+   * }
+   * 
+ * + * @param httpsHealthCheck Name of the HttpsHealthCheck resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final HttpsHealthCheck2 getHttpsHealthCheck( + ProjectGlobalHttpsHealthCheckName httpsHealthCheck) { + + GetHttpsHealthCheckHttpRequest request = + GetHttpsHealthCheckHttpRequest.newBuilder() + .setHttpsHealthCheck(httpsHealthCheck == null ? null : httpsHealthCheck.toString()) + .build(); + return getHttpsHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HttpsHealthCheck resource. Gets a list of available HTTPS health checks + * by making a list() request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   HttpsHealthCheck2 response = httpsHealthCheckClient.getHttpsHealthCheck(httpsHealthCheck.toString());
+   * }
+   * 
+ * + * @param httpsHealthCheck Name of the HttpsHealthCheck resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final HttpsHealthCheck2 getHttpsHealthCheck(String httpsHealthCheck) { + + GetHttpsHealthCheckHttpRequest request = + GetHttpsHealthCheckHttpRequest.newBuilder().setHttpsHealthCheck(httpsHealthCheck).build(); + return getHttpsHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HttpsHealthCheck resource. Gets a list of available HTTPS health checks + * by making a list() request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   GetHttpsHealthCheckHttpRequest request = GetHttpsHealthCheckHttpRequest.newBuilder()
+   *     .setHttpsHealthCheck(httpsHealthCheck.toString())
+   *     .build();
+   *   HttpsHealthCheck2 response = httpsHealthCheckClient.getHttpsHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final HttpsHealthCheck2 getHttpsHealthCheck(GetHttpsHealthCheckHttpRequest request) { + return getHttpsHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified HttpsHealthCheck resource. Gets a list of available HTTPS health checks + * by making a list() request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   GetHttpsHealthCheckHttpRequest request = GetHttpsHealthCheckHttpRequest.newBuilder()
+   *     .setHttpsHealthCheck(httpsHealthCheck.toString())
+   *     .build();
+   *   ApiFuture<HttpsHealthCheck2> future = httpsHealthCheckClient.getHttpsHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   HttpsHealthCheck2 response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getHttpsHealthCheckCallable() { + return stub.getHttpsHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HttpsHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   Operation response = httpsHealthCheckClient.insertHttpsHealthCheck(project, httpsHealthCheckResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param httpsHealthCheckResource An HttpsHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTPS. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertHttpsHealthCheck( + ProjectName project, HttpsHealthCheck2 httpsHealthCheckResource) { + + InsertHttpsHealthCheckHttpRequest request = + InsertHttpsHealthCheckHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setHttpsHealthCheckResource(httpsHealthCheckResource) + .build(); + return insertHttpsHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HttpsHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   Operation response = httpsHealthCheckClient.insertHttpsHealthCheck(project.toString(), httpsHealthCheckResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param httpsHealthCheckResource An HttpsHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTPS. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertHttpsHealthCheck( + String project, HttpsHealthCheck2 httpsHealthCheckResource) { + + InsertHttpsHealthCheckHttpRequest request = + InsertHttpsHealthCheckHttpRequest.newBuilder() + .setProject(project) + .setHttpsHealthCheckResource(httpsHealthCheckResource) + .build(); + return insertHttpsHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HttpsHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   InsertHttpsHealthCheckHttpRequest request = InsertHttpsHealthCheckHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setHttpsHealthCheckResource(httpsHealthCheckResource)
+   *     .build();
+   *   Operation response = httpsHealthCheckClient.insertHttpsHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertHttpsHealthCheck(InsertHttpsHealthCheckHttpRequest request) { + return insertHttpsHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a HttpsHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   InsertHttpsHealthCheckHttpRequest request = InsertHttpsHealthCheckHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setHttpsHealthCheckResource(httpsHealthCheckResource)
+   *     .build();
+   *   ApiFuture<Operation> future = httpsHealthCheckClient.insertHttpsHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertHttpsHealthCheckCallable() { + return stub.insertHttpsHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HttpsHealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (HttpsHealthCheck2 element : httpsHealthCheckClient.listHttpsHealthChecks(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListHttpsHealthChecksPagedResponse listHttpsHealthChecks(ProjectName project) { + ListHttpsHealthChecksHttpRequest request = + ListHttpsHealthChecksHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listHttpsHealthChecks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HttpsHealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (HttpsHealthCheck2 element : httpsHealthCheckClient.listHttpsHealthChecks(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListHttpsHealthChecksPagedResponse listHttpsHealthChecks(String project) { + ListHttpsHealthChecksHttpRequest request = + ListHttpsHealthChecksHttpRequest.newBuilder().setProject(project).build(); + return listHttpsHealthChecks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HttpsHealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListHttpsHealthChecksHttpRequest request = ListHttpsHealthChecksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (HttpsHealthCheck2 element : httpsHealthCheckClient.listHttpsHealthChecks(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListHttpsHealthChecksPagedResponse listHttpsHealthChecks( + ListHttpsHealthChecksHttpRequest request) { + return listHttpsHealthChecksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HttpsHealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListHttpsHealthChecksHttpRequest request = ListHttpsHealthChecksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListHttpsHealthChecksPagedResponse> future = httpsHealthCheckClient.listHttpsHealthChecksPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (HttpsHealthCheck2 element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listHttpsHealthChecksPagedCallable() { + return stub.listHttpsHealthChecksPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of HttpsHealthCheck resources available to the specified project. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListHttpsHealthChecksHttpRequest request = ListHttpsHealthChecksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     HttpsHealthCheckList response = httpsHealthCheckClient.listHttpsHealthChecksCallable().call(request);
+   *     for (HttpsHealthCheck2 element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listHttpsHealthChecksCallable() { + return stub.listHttpsHealthChecksCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpsHealthCheck resource in the specified project using the data included in the + * request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   Operation response = httpsHealthCheckClient.patchHttpsHealthCheck(httpsHealthCheck, httpsHealthCheckResource);
+   * }
+   * 
+ * + * @param httpsHealthCheck Name of the HttpsHealthCheck resource to patch. + * @param httpsHealthCheckResource An HttpsHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTPS. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchHttpsHealthCheck( + ProjectGlobalHttpsHealthCheckName httpsHealthCheck, + HttpsHealthCheck2 httpsHealthCheckResource) { + + PatchHttpsHealthCheckHttpRequest request = + PatchHttpsHealthCheckHttpRequest.newBuilder() + .setHttpsHealthCheck(httpsHealthCheck == null ? null : httpsHealthCheck.toString()) + .setHttpsHealthCheckResource(httpsHealthCheckResource) + .build(); + return patchHttpsHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpsHealthCheck resource in the specified project using the data included in the + * request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   Operation response = httpsHealthCheckClient.patchHttpsHealthCheck(httpsHealthCheck.toString(), httpsHealthCheckResource);
+   * }
+   * 
+ * + * @param httpsHealthCheck Name of the HttpsHealthCheck resource to patch. + * @param httpsHealthCheckResource An HttpsHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTPS. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchHttpsHealthCheck( + String httpsHealthCheck, HttpsHealthCheck2 httpsHealthCheckResource) { + + PatchHttpsHealthCheckHttpRequest request = + PatchHttpsHealthCheckHttpRequest.newBuilder() + .setHttpsHealthCheck(httpsHealthCheck) + .setHttpsHealthCheckResource(httpsHealthCheckResource) + .build(); + return patchHttpsHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpsHealthCheck resource in the specified project using the data included in the + * request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   PatchHttpsHealthCheckHttpRequest request = PatchHttpsHealthCheckHttpRequest.newBuilder()
+   *     .setHttpsHealthCheck(httpsHealthCheck.toString())
+   *     .setHttpsHealthCheckResource(httpsHealthCheckResource)
+   *     .build();
+   *   Operation response = httpsHealthCheckClient.patchHttpsHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchHttpsHealthCheck(PatchHttpsHealthCheckHttpRequest request) { + return patchHttpsHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpsHealthCheck resource in the specified project using the data included in the + * request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   PatchHttpsHealthCheckHttpRequest request = PatchHttpsHealthCheckHttpRequest.newBuilder()
+   *     .setHttpsHealthCheck(httpsHealthCheck.toString())
+   *     .setHttpsHealthCheckResource(httpsHealthCheckResource)
+   *     .build();
+   *   ApiFuture<Operation> future = httpsHealthCheckClient.patchHttpsHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + patchHttpsHealthCheckCallable() { + return stub.patchHttpsHealthCheckCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpsHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   Operation response = httpsHealthCheckClient.updateHttpsHealthCheck(httpsHealthCheck, httpsHealthCheckResource);
+   * }
+   * 
+ * + * @param httpsHealthCheck Name of the HttpsHealthCheck resource to update. + * @param httpsHealthCheckResource An HttpsHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTPS. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateHttpsHealthCheck( + ProjectGlobalHttpsHealthCheckName httpsHealthCheck, + HttpsHealthCheck2 httpsHealthCheckResource) { + + UpdateHttpsHealthCheckHttpRequest request = + UpdateHttpsHealthCheckHttpRequest.newBuilder() + .setHttpsHealthCheck(httpsHealthCheck == null ? null : httpsHealthCheck.toString()) + .setHttpsHealthCheckResource(httpsHealthCheckResource) + .build(); + return updateHttpsHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpsHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   Operation response = httpsHealthCheckClient.updateHttpsHealthCheck(httpsHealthCheck.toString(), httpsHealthCheckResource);
+   * }
+   * 
+ * + * @param httpsHealthCheck Name of the HttpsHealthCheck resource to update. + * @param httpsHealthCheckResource An HttpsHealthCheck resource. This resource defines a template + * for how individual instances should be checked for health, via HTTPS. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateHttpsHealthCheck( + String httpsHealthCheck, HttpsHealthCheck2 httpsHealthCheckResource) { + + UpdateHttpsHealthCheckHttpRequest request = + UpdateHttpsHealthCheckHttpRequest.newBuilder() + .setHttpsHealthCheck(httpsHealthCheck) + .setHttpsHealthCheckResource(httpsHealthCheckResource) + .build(); + return updateHttpsHealthCheck(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpsHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   UpdateHttpsHealthCheckHttpRequest request = UpdateHttpsHealthCheckHttpRequest.newBuilder()
+   *     .setHttpsHealthCheck(httpsHealthCheck.toString())
+   *     .setHttpsHealthCheckResource(httpsHealthCheckResource)
+   *     .build();
+   *   Operation response = httpsHealthCheckClient.updateHttpsHealthCheck(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateHttpsHealthCheck(UpdateHttpsHealthCheckHttpRequest request) { + return updateHttpsHealthCheckCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a HttpsHealthCheck resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+   *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+   *   HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build();
+   *   UpdateHttpsHealthCheckHttpRequest request = UpdateHttpsHealthCheckHttpRequest.newBuilder()
+   *     .setHttpsHealthCheck(httpsHealthCheck.toString())
+   *     .setHttpsHealthCheckResource(httpsHealthCheckResource)
+   *     .build();
+   *   ApiFuture<Operation> future = httpsHealthCheckClient.updateHttpsHealthCheckCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + updateHttpsHealthCheckCallable() { + return stub.updateHttpsHealthCheckCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListHttpsHealthChecksPagedResponse + extends AbstractPagedListResponse< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, HttpsHealthCheck2, + ListHttpsHealthChecksPage, ListHttpsHealthChecksFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListHttpsHealthChecksPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListHttpsHealthChecksPagedResponse apply(ListHttpsHealthChecksPage input) { + return new ListHttpsHealthChecksPagedResponse(input); + } + }); + } + + private ListHttpsHealthChecksPagedResponse(ListHttpsHealthChecksPage page) { + super(page, ListHttpsHealthChecksFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListHttpsHealthChecksPage + extends AbstractPage< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, HttpsHealthCheck2, + ListHttpsHealthChecksPage> { + + private ListHttpsHealthChecksPage( + PageContext + context, + HttpsHealthCheckList response) { + super(context, response); + } + + private static ListHttpsHealthChecksPage createEmptyPage() { + return new ListHttpsHealthChecksPage(null, null); + } + + @Override + protected ListHttpsHealthChecksPage createPage( + PageContext + context, + HttpsHealthCheckList response) { + return new ListHttpsHealthChecksPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListHttpsHealthChecksFixedSizeCollection + extends AbstractFixedSizeCollection< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, HttpsHealthCheck2, + ListHttpsHealthChecksPage, ListHttpsHealthChecksFixedSizeCollection> { + + private ListHttpsHealthChecksFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListHttpsHealthChecksFixedSizeCollection createEmptyCollection() { + return new ListHttpsHealthChecksFixedSizeCollection(null, 0); + } + + @Override + protected ListHttpsHealthChecksFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListHttpsHealthChecksFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckList.java new file mode 100644 index 000000000000..8f27fd034a82 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class HttpsHealthCheckList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private HttpsHealthCheckList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private HttpsHealthCheckList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(HttpsHealthCheckList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static HttpsHealthCheckList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final HttpsHealthCheckList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new HttpsHealthCheckList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(HttpsHealthCheckList other) { + if (other == HttpsHealthCheckList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(HttpsHealthCheckList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(HttpsHealthCheck2 items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public HttpsHealthCheckList build() { + + return new HttpsHealthCheckList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "HttpsHealthCheckList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof HttpsHealthCheckList) { + HttpsHealthCheckList that = (HttpsHealthCheckList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckSettings.java new file mode 100644 index 000000000000..485682fea0f3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HttpsHealthCheckSettings.java @@ -0,0 +1,249 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.HttpsHealthCheckClient.ListHttpsHealthChecksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.HttpsHealthCheckStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link HttpsHealthCheckClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteHttpsHealthCheck to 30 seconds: + * + *

+ * 
+ * HttpsHealthCheckSettings.Builder httpsHealthCheckSettingsBuilder =
+ *     HttpsHealthCheckSettings.newBuilder();
+ * httpsHealthCheckSettingsBuilder.deleteHttpsHealthCheckSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * HttpsHealthCheckSettings httpsHealthCheckSettings = httpsHealthCheckSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class HttpsHealthCheckSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteHttpsHealthCheck. */ + public UnaryCallSettings + deleteHttpsHealthCheckSettings() { + return ((HttpsHealthCheckStubSettings) getStubSettings()).deleteHttpsHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to getHttpsHealthCheck. */ + public UnaryCallSettings + getHttpsHealthCheckSettings() { + return ((HttpsHealthCheckStubSettings) getStubSettings()).getHttpsHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to insertHttpsHealthCheck. */ + public UnaryCallSettings + insertHttpsHealthCheckSettings() { + return ((HttpsHealthCheckStubSettings) getStubSettings()).insertHttpsHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to listHttpsHealthChecks. */ + public PagedCallSettings< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, + ListHttpsHealthChecksPagedResponse> + listHttpsHealthChecksSettings() { + return ((HttpsHealthCheckStubSettings) getStubSettings()).listHttpsHealthChecksSettings(); + } + + /** Returns the object with the settings used for calls to patchHttpsHealthCheck. */ + public UnaryCallSettings + patchHttpsHealthCheckSettings() { + return ((HttpsHealthCheckStubSettings) getStubSettings()).patchHttpsHealthCheckSettings(); + } + + /** Returns the object with the settings used for calls to updateHttpsHealthCheck. */ + public UnaryCallSettings + updateHttpsHealthCheckSettings() { + return ((HttpsHealthCheckStubSettings) getStubSettings()).updateHttpsHealthCheckSettings(); + } + + public static final HttpsHealthCheckSettings create(HttpsHealthCheckStubSettings stub) + throws IOException { + return new HttpsHealthCheckSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return HttpsHealthCheckStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return HttpsHealthCheckStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return HttpsHealthCheckStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return HttpsHealthCheckStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return HttpsHealthCheckStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return HttpsHealthCheckStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return HttpsHealthCheckStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return HttpsHealthCheckStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected HttpsHealthCheckSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for HttpsHealthCheckSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(HttpsHealthCheckStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(HttpsHealthCheckStubSettings.newBuilder()); + } + + protected Builder(HttpsHealthCheckSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(HttpsHealthCheckStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public HttpsHealthCheckStubSettings.Builder getStubSettingsBuilder() { + return ((HttpsHealthCheckStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteHttpsHealthCheck. */ + public UnaryCallSettings.Builder + deleteHttpsHealthCheckSettings() { + return getStubSettingsBuilder().deleteHttpsHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to getHttpsHealthCheck. */ + public UnaryCallSettings.Builder + getHttpsHealthCheckSettings() { + return getStubSettingsBuilder().getHttpsHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to insertHttpsHealthCheck. */ + public UnaryCallSettings.Builder + insertHttpsHealthCheckSettings() { + return getStubSettingsBuilder().insertHttpsHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to listHttpsHealthChecks. */ + public PagedCallSettings.Builder< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, + ListHttpsHealthChecksPagedResponse> + listHttpsHealthChecksSettings() { + return getStubSettingsBuilder().listHttpsHealthChecksSettings(); + } + + /** Returns the builder for the settings used for calls to patchHttpsHealthCheck. */ + public UnaryCallSettings.Builder + patchHttpsHealthCheckSettings() { + return getStubSettingsBuilder().patchHttpsHealthCheckSettings(); + } + + /** Returns the builder for the settings used for calls to updateHttpsHealthCheck. */ + public UnaryCallSettings.Builder + updateHttpsHealthCheckSettings() { + return getStubSettingsBuilder().updateHttpsHealthCheckSettings(); + } + + @Override + public HttpsHealthCheckSettings build() throws IOException { + return new HttpsHealthCheckSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Image.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Image.java new file mode 100644 index 000000000000..293e38cf15ea --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Image.java @@ -0,0 +1,1040 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Image implements ApiMessage { + private final String archiveSizeBytes; + private final String creationTimestamp; + private final DeprecationStatus deprecated; + private final String description; + private final String diskSizeGb; + private final String family; + private final List guestOsFeatures; + private final String id; + private final CustomerEncryptionKey imageEncryptionKey; + private final String kind; + private final String labelFingerprint; + private final Map labels; + private final List licenseCodes; + private final List licenses; + private final String name; + private final RawDisk rawDisk; + private final String selfLink; + private final String sourceDisk; + private final CustomerEncryptionKey sourceDiskEncryptionKey; + private final String sourceDiskId; + private final String sourceImage; + private final CustomerEncryptionKey sourceImageEncryptionKey; + private final String sourceImageId; + private final String sourceSnapshot; + private final CustomerEncryptionKey sourceSnapshotEncryptionKey; + private final String sourceSnapshotId; + private final String sourceType; + private final String status; + + private Image() { + this.archiveSizeBytes = null; + this.creationTimestamp = null; + this.deprecated = null; + this.description = null; + this.diskSizeGb = null; + this.family = null; + this.guestOsFeatures = null; + this.id = null; + this.imageEncryptionKey = null; + this.kind = null; + this.labelFingerprint = null; + this.labels = null; + this.licenseCodes = null; + this.licenses = null; + this.name = null; + this.rawDisk = null; + this.selfLink = null; + this.sourceDisk = null; + this.sourceDiskEncryptionKey = null; + this.sourceDiskId = null; + this.sourceImage = null; + this.sourceImageEncryptionKey = null; + this.sourceImageId = null; + this.sourceSnapshot = null; + this.sourceSnapshotEncryptionKey = null; + this.sourceSnapshotId = null; + this.sourceType = null; + this.status = null; + } + + private Image( + String archiveSizeBytes, + String creationTimestamp, + DeprecationStatus deprecated, + String description, + String diskSizeGb, + String family, + List guestOsFeatures, + String id, + CustomerEncryptionKey imageEncryptionKey, + String kind, + String labelFingerprint, + Map labels, + List licenseCodes, + List licenses, + String name, + RawDisk rawDisk, + String selfLink, + String sourceDisk, + CustomerEncryptionKey sourceDiskEncryptionKey, + String sourceDiskId, + String sourceImage, + CustomerEncryptionKey sourceImageEncryptionKey, + String sourceImageId, + String sourceSnapshot, + CustomerEncryptionKey sourceSnapshotEncryptionKey, + String sourceSnapshotId, + String sourceType, + String status) { + this.archiveSizeBytes = archiveSizeBytes; + this.creationTimestamp = creationTimestamp; + this.deprecated = deprecated; + this.description = description; + this.diskSizeGb = diskSizeGb; + this.family = family; + this.guestOsFeatures = guestOsFeatures; + this.id = id; + this.imageEncryptionKey = imageEncryptionKey; + this.kind = kind; + this.labelFingerprint = labelFingerprint; + this.labels = labels; + this.licenseCodes = licenseCodes; + this.licenses = licenses; + this.name = name; + this.rawDisk = rawDisk; + this.selfLink = selfLink; + this.sourceDisk = sourceDisk; + this.sourceDiskEncryptionKey = sourceDiskEncryptionKey; + this.sourceDiskId = sourceDiskId; + this.sourceImage = sourceImage; + this.sourceImageEncryptionKey = sourceImageEncryptionKey; + this.sourceImageId = sourceImageId; + this.sourceSnapshot = sourceSnapshot; + this.sourceSnapshotEncryptionKey = sourceSnapshotEncryptionKey; + this.sourceSnapshotId = sourceSnapshotId; + this.sourceType = sourceType; + this.status = status; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("archiveSizeBytes")) { + return archiveSizeBytes; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("deprecated")) { + return deprecated; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("diskSizeGb")) { + return diskSizeGb; + } + if (fieldName.equals("family")) { + return family; + } + if (fieldName.equals("guestOsFeatures")) { + return guestOsFeatures; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("imageEncryptionKey")) { + return imageEncryptionKey; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("labelFingerprint")) { + return labelFingerprint; + } + if (fieldName.equals("labels")) { + return labels; + } + if (fieldName.equals("licenseCodes")) { + return licenseCodes; + } + if (fieldName.equals("licenses")) { + return licenses; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("rawDisk")) { + return rawDisk; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("sourceDisk")) { + return sourceDisk; + } + if (fieldName.equals("sourceDiskEncryptionKey")) { + return sourceDiskEncryptionKey; + } + if (fieldName.equals("sourceDiskId")) { + return sourceDiskId; + } + if (fieldName.equals("sourceImage")) { + return sourceImage; + } + if (fieldName.equals("sourceImageEncryptionKey")) { + return sourceImageEncryptionKey; + } + if (fieldName.equals("sourceImageId")) { + return sourceImageId; + } + if (fieldName.equals("sourceSnapshot")) { + return sourceSnapshot; + } + if (fieldName.equals("sourceSnapshotEncryptionKey")) { + return sourceSnapshotEncryptionKey; + } + if (fieldName.equals("sourceSnapshotId")) { + return sourceSnapshotId; + } + if (fieldName.equals("sourceType")) { + return sourceType; + } + if (fieldName.equals("status")) { + return status; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getArchiveSizeBytes() { + return archiveSizeBytes; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public String getDescription() { + return description; + } + + public String getDiskSizeGb() { + return diskSizeGb; + } + + public String getFamily() { + return family; + } + + public List getGuestOsFeaturesList() { + return guestOsFeatures; + } + + public String getId() { + return id; + } + + public CustomerEncryptionKey getImageEncryptionKey() { + return imageEncryptionKey; + } + + public String getKind() { + return kind; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Map getLabelsMap() { + return labels; + } + + public List getLicenseCodesList() { + return licenseCodes; + } + + public List getLicensesList() { + return licenses; + } + + public String getName() { + return name; + } + + public RawDisk getRawDisk() { + return rawDisk; + } + + public String getSelfLink() { + return selfLink; + } + + public String getSourceDisk() { + return sourceDisk; + } + + public CustomerEncryptionKey getSourceDiskEncryptionKey() { + return sourceDiskEncryptionKey; + } + + public String getSourceDiskId() { + return sourceDiskId; + } + + public String getSourceImage() { + return sourceImage; + } + + public CustomerEncryptionKey getSourceImageEncryptionKey() { + return sourceImageEncryptionKey; + } + + public String getSourceImageId() { + return sourceImageId; + } + + public String getSourceSnapshot() { + return sourceSnapshot; + } + + public CustomerEncryptionKey getSourceSnapshotEncryptionKey() { + return sourceSnapshotEncryptionKey; + } + + public String getSourceSnapshotId() { + return sourceSnapshotId; + } + + public String getSourceType() { + return sourceType; + } + + public String getStatus() { + return status; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Image prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Image getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Image DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Image(); + } + + public static class Builder { + private String archiveSizeBytes; + private String creationTimestamp; + private DeprecationStatus deprecated; + private String description; + private String diskSizeGb; + private String family; + private List guestOsFeatures; + private String id; + private CustomerEncryptionKey imageEncryptionKey; + private String kind; + private String labelFingerprint; + private Map labels; + private List licenseCodes; + private List licenses; + private String name; + private RawDisk rawDisk; + private String selfLink; + private String sourceDisk; + private CustomerEncryptionKey sourceDiskEncryptionKey; + private String sourceDiskId; + private String sourceImage; + private CustomerEncryptionKey sourceImageEncryptionKey; + private String sourceImageId; + private String sourceSnapshot; + private CustomerEncryptionKey sourceSnapshotEncryptionKey; + private String sourceSnapshotId; + private String sourceType; + private String status; + + Builder() {} + + public Builder mergeFrom(Image other) { + if (other == Image.getDefaultInstance()) return this; + if (other.getArchiveSizeBytes() != null) { + this.archiveSizeBytes = other.archiveSizeBytes; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDeprecated() != null) { + this.deprecated = other.deprecated; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getDiskSizeGb() != null) { + this.diskSizeGb = other.diskSizeGb; + } + if (other.getFamily() != null) { + this.family = other.family; + } + if (other.getGuestOsFeaturesList() != null) { + this.guestOsFeatures = other.guestOsFeatures; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getImageEncryptionKey() != null) { + this.imageEncryptionKey = other.imageEncryptionKey; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getLabelFingerprint() != null) { + this.labelFingerprint = other.labelFingerprint; + } + if (other.getLabelsMap() != null) { + this.labels = other.labels; + } + if (other.getLicenseCodesList() != null) { + this.licenseCodes = other.licenseCodes; + } + if (other.getLicensesList() != null) { + this.licenses = other.licenses; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getRawDisk() != null) { + this.rawDisk = other.rawDisk; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSourceDisk() != null) { + this.sourceDisk = other.sourceDisk; + } + if (other.getSourceDiskEncryptionKey() != null) { + this.sourceDiskEncryptionKey = other.sourceDiskEncryptionKey; + } + if (other.getSourceDiskId() != null) { + this.sourceDiskId = other.sourceDiskId; + } + if (other.getSourceImage() != null) { + this.sourceImage = other.sourceImage; + } + if (other.getSourceImageEncryptionKey() != null) { + this.sourceImageEncryptionKey = other.sourceImageEncryptionKey; + } + if (other.getSourceImageId() != null) { + this.sourceImageId = other.sourceImageId; + } + if (other.getSourceSnapshot() != null) { + this.sourceSnapshot = other.sourceSnapshot; + } + if (other.getSourceSnapshotEncryptionKey() != null) { + this.sourceSnapshotEncryptionKey = other.sourceSnapshotEncryptionKey; + } + if (other.getSourceSnapshotId() != null) { + this.sourceSnapshotId = other.sourceSnapshotId; + } + if (other.getSourceType() != null) { + this.sourceType = other.sourceType; + } + if (other.getStatus() != null) { + this.status = other.status; + } + return this; + } + + Builder(Image source) { + this.archiveSizeBytes = source.archiveSizeBytes; + this.creationTimestamp = source.creationTimestamp; + this.deprecated = source.deprecated; + this.description = source.description; + this.diskSizeGb = source.diskSizeGb; + this.family = source.family; + this.guestOsFeatures = source.guestOsFeatures; + this.id = source.id; + this.imageEncryptionKey = source.imageEncryptionKey; + this.kind = source.kind; + this.labelFingerprint = source.labelFingerprint; + this.labels = source.labels; + this.licenseCodes = source.licenseCodes; + this.licenses = source.licenses; + this.name = source.name; + this.rawDisk = source.rawDisk; + this.selfLink = source.selfLink; + this.sourceDisk = source.sourceDisk; + this.sourceDiskEncryptionKey = source.sourceDiskEncryptionKey; + this.sourceDiskId = source.sourceDiskId; + this.sourceImage = source.sourceImage; + this.sourceImageEncryptionKey = source.sourceImageEncryptionKey; + this.sourceImageId = source.sourceImageId; + this.sourceSnapshot = source.sourceSnapshot; + this.sourceSnapshotEncryptionKey = source.sourceSnapshotEncryptionKey; + this.sourceSnapshotId = source.sourceSnapshotId; + this.sourceType = source.sourceType; + this.status = source.status; + } + + public String getArchiveSizeBytes() { + return archiveSizeBytes; + } + + public Builder setArchiveSizeBytes(String archiveSizeBytes) { + this.archiveSizeBytes = archiveSizeBytes; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public Builder setDeprecated(DeprecationStatus deprecated) { + this.deprecated = deprecated; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getDiskSizeGb() { + return diskSizeGb; + } + + public Builder setDiskSizeGb(String diskSizeGb) { + this.diskSizeGb = diskSizeGb; + return this; + } + + public String getFamily() { + return family; + } + + public Builder setFamily(String family) { + this.family = family; + return this; + } + + public List getGuestOsFeaturesList() { + return guestOsFeatures; + } + + public Builder addAllGuestOsFeatures(List guestOsFeatures) { + if (this.guestOsFeatures == null) { + this.guestOsFeatures = new ArrayList<>(guestOsFeatures.size()); + } + this.guestOsFeatures.addAll(guestOsFeatures); + return this; + } + + public Builder addGuestOsFeatures(GuestOsFeature guestOsFeatures) { + this.guestOsFeatures.add(guestOsFeatures); + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public CustomerEncryptionKey getImageEncryptionKey() { + return imageEncryptionKey; + } + + public Builder setImageEncryptionKey(CustomerEncryptionKey imageEncryptionKey) { + this.imageEncryptionKey = imageEncryptionKey; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Builder setLabelFingerprint(String labelFingerprint) { + this.labelFingerprint = labelFingerprint; + return this; + } + + public Map getLabelsMap() { + return labels; + } + + public Builder putAllLabels(Map labels) { + this.labels = labels; + return this; + } + + public List getLicenseCodesList() { + return licenseCodes; + } + + public Builder addAllLicenseCodes(List licenseCodes) { + if (this.licenseCodes == null) { + this.licenseCodes = new ArrayList<>(licenseCodes.size()); + } + this.licenseCodes.addAll(licenseCodes); + return this; + } + + public Builder addLicenseCodes(String licenseCodes) { + this.licenseCodes.add(licenseCodes); + return this; + } + + public List getLicensesList() { + return licenses; + } + + public Builder addAllLicenses(List licenses) { + if (this.licenses == null) { + this.licenses = new ArrayList<>(licenses.size()); + } + this.licenses.addAll(licenses); + return this; + } + + public Builder addLicenses(String licenses) { + this.licenses.add(licenses); + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public RawDisk getRawDisk() { + return rawDisk; + } + + public Builder setRawDisk(RawDisk rawDisk) { + this.rawDisk = rawDisk; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getSourceDisk() { + return sourceDisk; + } + + public Builder setSourceDisk(String sourceDisk) { + this.sourceDisk = sourceDisk; + return this; + } + + public CustomerEncryptionKey getSourceDiskEncryptionKey() { + return sourceDiskEncryptionKey; + } + + public Builder setSourceDiskEncryptionKey(CustomerEncryptionKey sourceDiskEncryptionKey) { + this.sourceDiskEncryptionKey = sourceDiskEncryptionKey; + return this; + } + + public String getSourceDiskId() { + return sourceDiskId; + } + + public Builder setSourceDiskId(String sourceDiskId) { + this.sourceDiskId = sourceDiskId; + return this; + } + + public String getSourceImage() { + return sourceImage; + } + + public Builder setSourceImage(String sourceImage) { + this.sourceImage = sourceImage; + return this; + } + + public CustomerEncryptionKey getSourceImageEncryptionKey() { + return sourceImageEncryptionKey; + } + + public Builder setSourceImageEncryptionKey(CustomerEncryptionKey sourceImageEncryptionKey) { + this.sourceImageEncryptionKey = sourceImageEncryptionKey; + return this; + } + + public String getSourceImageId() { + return sourceImageId; + } + + public Builder setSourceImageId(String sourceImageId) { + this.sourceImageId = sourceImageId; + return this; + } + + public String getSourceSnapshot() { + return sourceSnapshot; + } + + public Builder setSourceSnapshot(String sourceSnapshot) { + this.sourceSnapshot = sourceSnapshot; + return this; + } + + public CustomerEncryptionKey getSourceSnapshotEncryptionKey() { + return sourceSnapshotEncryptionKey; + } + + public Builder setSourceSnapshotEncryptionKey( + CustomerEncryptionKey sourceSnapshotEncryptionKey) { + this.sourceSnapshotEncryptionKey = sourceSnapshotEncryptionKey; + return this; + } + + public String getSourceSnapshotId() { + return sourceSnapshotId; + } + + public Builder setSourceSnapshotId(String sourceSnapshotId) { + this.sourceSnapshotId = sourceSnapshotId; + return this; + } + + public String getSourceType() { + return sourceType; + } + + public Builder setSourceType(String sourceType) { + this.sourceType = sourceType; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public Image build() { + + return new Image( + archiveSizeBytes, + creationTimestamp, + deprecated, + description, + diskSizeGb, + family, + guestOsFeatures, + id, + imageEncryptionKey, + kind, + labelFingerprint, + labels, + licenseCodes, + licenses, + name, + rawDisk, + selfLink, + sourceDisk, + sourceDiskEncryptionKey, + sourceDiskId, + sourceImage, + sourceImageEncryptionKey, + sourceImageId, + sourceSnapshot, + sourceSnapshotEncryptionKey, + sourceSnapshotId, + sourceType, + status); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setArchiveSizeBytes(this.archiveSizeBytes); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDeprecated(this.deprecated); + newBuilder.setDescription(this.description); + newBuilder.setDiskSizeGb(this.diskSizeGb); + newBuilder.setFamily(this.family); + newBuilder.addAllGuestOsFeatures(this.guestOsFeatures); + newBuilder.setId(this.id); + newBuilder.setImageEncryptionKey(this.imageEncryptionKey); + newBuilder.setKind(this.kind); + newBuilder.setLabelFingerprint(this.labelFingerprint); + newBuilder.putAllLabels(this.labels); + newBuilder.addAllLicenseCodes(this.licenseCodes); + newBuilder.addAllLicenses(this.licenses); + newBuilder.setName(this.name); + newBuilder.setRawDisk(this.rawDisk); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setSourceDisk(this.sourceDisk); + newBuilder.setSourceDiskEncryptionKey(this.sourceDiskEncryptionKey); + newBuilder.setSourceDiskId(this.sourceDiskId); + newBuilder.setSourceImage(this.sourceImage); + newBuilder.setSourceImageEncryptionKey(this.sourceImageEncryptionKey); + newBuilder.setSourceImageId(this.sourceImageId); + newBuilder.setSourceSnapshot(this.sourceSnapshot); + newBuilder.setSourceSnapshotEncryptionKey(this.sourceSnapshotEncryptionKey); + newBuilder.setSourceSnapshotId(this.sourceSnapshotId); + newBuilder.setSourceType(this.sourceType); + newBuilder.setStatus(this.status); + return newBuilder; + } + } + + @Override + public String toString() { + return "Image{" + + "archiveSizeBytes=" + + archiveSizeBytes + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "deprecated=" + + deprecated + + ", " + + "description=" + + description + + ", " + + "diskSizeGb=" + + diskSizeGb + + ", " + + "family=" + + family + + ", " + + "guestOsFeatures=" + + guestOsFeatures + + ", " + + "id=" + + id + + ", " + + "imageEncryptionKey=" + + imageEncryptionKey + + ", " + + "kind=" + + kind + + ", " + + "labelFingerprint=" + + labelFingerprint + + ", " + + "labels=" + + labels + + ", " + + "licenseCodes=" + + licenseCodes + + ", " + + "licenses=" + + licenses + + ", " + + "name=" + + name + + ", " + + "rawDisk=" + + rawDisk + + ", " + + "selfLink=" + + selfLink + + ", " + + "sourceDisk=" + + sourceDisk + + ", " + + "sourceDiskEncryptionKey=" + + sourceDiskEncryptionKey + + ", " + + "sourceDiskId=" + + sourceDiskId + + ", " + + "sourceImage=" + + sourceImage + + ", " + + "sourceImageEncryptionKey=" + + sourceImageEncryptionKey + + ", " + + "sourceImageId=" + + sourceImageId + + ", " + + "sourceSnapshot=" + + sourceSnapshot + + ", " + + "sourceSnapshotEncryptionKey=" + + sourceSnapshotEncryptionKey + + ", " + + "sourceSnapshotId=" + + sourceSnapshotId + + ", " + + "sourceType=" + + sourceType + + ", " + + "status=" + + status + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Image) { + Image that = (Image) o; + return Objects.equals(this.archiveSizeBytes, that.getArchiveSizeBytes()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.deprecated, that.getDeprecated()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.diskSizeGb, that.getDiskSizeGb()) + && Objects.equals(this.family, that.getFamily()) + && Objects.equals(this.guestOsFeatures, that.getGuestOsFeaturesList()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.imageEncryptionKey, that.getImageEncryptionKey()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.labelFingerprint, that.getLabelFingerprint()) + && Objects.equals(this.labels, that.getLabelsMap()) + && Objects.equals(this.licenseCodes, that.getLicenseCodesList()) + && Objects.equals(this.licenses, that.getLicensesList()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.rawDisk, that.getRawDisk()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.sourceDisk, that.getSourceDisk()) + && Objects.equals(this.sourceDiskEncryptionKey, that.getSourceDiskEncryptionKey()) + && Objects.equals(this.sourceDiskId, that.getSourceDiskId()) + && Objects.equals(this.sourceImage, that.getSourceImage()) + && Objects.equals(this.sourceImageEncryptionKey, that.getSourceImageEncryptionKey()) + && Objects.equals(this.sourceImageId, that.getSourceImageId()) + && Objects.equals(this.sourceSnapshot, that.getSourceSnapshot()) + && Objects.equals(this.sourceSnapshotEncryptionKey, that.getSourceSnapshotEncryptionKey()) + && Objects.equals(this.sourceSnapshotId, that.getSourceSnapshotId()) + && Objects.equals(this.sourceType, that.getSourceType()) + && Objects.equals(this.status, that.getStatus()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + archiveSizeBytes, + creationTimestamp, + deprecated, + description, + diskSizeGb, + family, + guestOsFeatures, + id, + imageEncryptionKey, + kind, + labelFingerprint, + labels, + licenseCodes, + licenses, + name, + rawDisk, + selfLink, + sourceDisk, + sourceDiskEncryptionKey, + sourceDiskId, + sourceImage, + sourceImageEncryptionKey, + sourceImageId, + sourceSnapshot, + sourceSnapshotEncryptionKey, + sourceSnapshotId, + sourceType, + status); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageClient.java new file mode 100644 index 000000000000..040311711301 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageClient.java @@ -0,0 +1,1049 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.ImageStub; +import com.google.cloud.compute.v1.stub.ImageStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (ImageClient imageClient = ImageClient.create()) {
+ *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+ *   Operation response = imageClient.deleteImage(image);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the imageClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of ImageSettings to create(). For + * example: + * + *

To customize credentials: + * + *

+ * 
+ * ImageSettings imageSettings =
+ *     ImageSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ImageClient imageClient =
+ *     ImageClient.create(imageSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * ImageSettings imageSettings =
+ *     ImageSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ImageClient imageClient =
+ *     ImageClient.create(imageSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ImageClient implements BackgroundResource { + private final ImageSettings settings; + private final ImageStub stub; + + /** Constructs an instance of ImageClient with default settings. */ + public static final ImageClient create() throws IOException { + return create(ImageSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ImageClient, using the given settings. The channels are created based + * on the settings passed in, or defaults for any settings that are not set. + */ + public static final ImageClient create(ImageSettings settings) throws IOException { + return new ImageClient(settings); + } + + /** + * Constructs an instance of ImageClient, using the given stub for making calls. This is for + * advanced usage - prefer to use ImageSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final ImageClient create(ImageStub stub) { + return new ImageClient(stub); + } + + /** + * Constructs an instance of ImageClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected ImageClient(ImageSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ImageStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected ImageClient(ImageStub stub) { + this.settings = null; + this.stub = stub; + } + + public final ImageSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ImageStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified image. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   Operation response = imageClient.deleteImage(image);
+   * }
+   * 
+ * + * @param image Name of the image resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteImage(ProjectGlobalImageName image) { + + DeleteImageHttpRequest request = + DeleteImageHttpRequest.newBuilder() + .setImage(image == null ? null : image.toString()) + .build(); + return deleteImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified image. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   Operation response = imageClient.deleteImage(image.toString());
+   * }
+   * 
+ * + * @param image Name of the image resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteImage(String image) { + + DeleteImageHttpRequest request = DeleteImageHttpRequest.newBuilder().setImage(image).build(); + return deleteImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified image. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   DeleteImageHttpRequest request = DeleteImageHttpRequest.newBuilder()
+   *     .setImage(image.toString())
+   *     .build();
+   *   Operation response = imageClient.deleteImage(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteImage(DeleteImageHttpRequest request) { + return deleteImageCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified image. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   DeleteImageHttpRequest request = DeleteImageHttpRequest.newBuilder()
+   *     .setImage(image.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = imageClient.deleteImageCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteImageCallable() { + return stub.deleteImageCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the deprecation status of an image. + * + *

If an empty request body is given, clears the deprecation status instead. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build();
+   *   Operation response = imageClient.deprecateImage(image, deprecationStatusResource);
+   * }
+   * 
+ * + * @param image Image name. + * @param deprecationStatusResource Deprecation status for a public resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deprecateImage( + ProjectGlobalImageName image, DeprecationStatus deprecationStatusResource) { + + DeprecateImageHttpRequest request = + DeprecateImageHttpRequest.newBuilder() + .setImage(image == null ? null : image.toString()) + .setDeprecationStatusResource(deprecationStatusResource) + .build(); + return deprecateImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the deprecation status of an image. + * + *

If an empty request body is given, clears the deprecation status instead. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build();
+   *   Operation response = imageClient.deprecateImage(image.toString(), deprecationStatusResource);
+   * }
+   * 
+ * + * @param image Image name. + * @param deprecationStatusResource Deprecation status for a public resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deprecateImage(String image, DeprecationStatus deprecationStatusResource) { + + DeprecateImageHttpRequest request = + DeprecateImageHttpRequest.newBuilder() + .setImage(image) + .setDeprecationStatusResource(deprecationStatusResource) + .build(); + return deprecateImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the deprecation status of an image. + * + *

If an empty request body is given, clears the deprecation status instead. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build();
+   *   DeprecateImageHttpRequest request = DeprecateImageHttpRequest.newBuilder()
+   *     .setImage(image.toString())
+   *     .setDeprecationStatusResource(deprecationStatusResource)
+   *     .build();
+   *   Operation response = imageClient.deprecateImage(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deprecateImage(DeprecateImageHttpRequest request) { + return deprecateImageCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the deprecation status of an image. + * + *

If an empty request body is given, clears the deprecation status instead. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build();
+   *   DeprecateImageHttpRequest request = DeprecateImageHttpRequest.newBuilder()
+   *     .setImage(image.toString())
+   *     .setDeprecationStatusResource(deprecationStatusResource)
+   *     .build();
+   *   ApiFuture<Operation> future = imageClient.deprecateImageCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deprecateImageCallable() { + return stub.deprecateImageCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified image. Gets a list of available images by making a list() request. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   Image response = imageClient.getImage(image);
+   * }
+   * 
+ * + * @param image Name of the image resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Image getImage(ProjectGlobalImageName image) { + + GetImageHttpRequest request = + GetImageHttpRequest.newBuilder().setImage(image == null ? null : image.toString()).build(); + return getImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified image. Gets a list of available images by making a list() request. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   Image response = imageClient.getImage(image.toString());
+   * }
+   * 
+ * + * @param image Name of the image resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Image getImage(String image) { + + GetImageHttpRequest request = GetImageHttpRequest.newBuilder().setImage(image).build(); + return getImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified image. Gets a list of available images by making a list() request. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   GetImageHttpRequest request = GetImageHttpRequest.newBuilder()
+   *     .setImage(image.toString())
+   *     .build();
+   *   Image response = imageClient.getImage(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Image getImage(GetImageHttpRequest request) { + return getImageCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified image. Gets a list of available images by making a list() request. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+   *   GetImageHttpRequest request = GetImageHttpRequest.newBuilder()
+   *     .setImage(image.toString())
+   *     .build();
+   *   ApiFuture<Image> future = imageClient.getImageCallable().futureCall(request);
+   *   // Do something
+   *   Image response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getImageCallable() { + return stub.getImageCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the latest image that is part of an image family and is not deprecated. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageFamilyName family = ProjectGlobalImageFamilyName.of("[PROJECT]", "[FAMILY]");
+   *   Image response = imageClient.getFromFamilyImage(family);
+   * }
+   * 
+ * + * @param family Name of the image family to search for. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Image getFromFamilyImage(ProjectGlobalImageFamilyName family) { + + GetFromFamilyImageHttpRequest request = + GetFromFamilyImageHttpRequest.newBuilder() + .setFamily(family == null ? null : family.toString()) + .build(); + return getFromFamilyImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the latest image that is part of an image family and is not deprecated. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageFamilyName family = ProjectGlobalImageFamilyName.of("[PROJECT]", "[FAMILY]");
+   *   Image response = imageClient.getFromFamilyImage(family.toString());
+   * }
+   * 
+ * + * @param family Name of the image family to search for. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Image getFromFamilyImage(String family) { + + GetFromFamilyImageHttpRequest request = + GetFromFamilyImageHttpRequest.newBuilder().setFamily(family).build(); + return getFromFamilyImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the latest image that is part of an image family and is not deprecated. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageFamilyName family = ProjectGlobalImageFamilyName.of("[PROJECT]", "[FAMILY]");
+   *   GetFromFamilyImageHttpRequest request = GetFromFamilyImageHttpRequest.newBuilder()
+   *     .setFamily(family.toString())
+   *     .build();
+   *   Image response = imageClient.getFromFamilyImage(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Image getFromFamilyImage(GetFromFamilyImageHttpRequest request) { + return getFromFamilyImageCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the latest image that is part of an image family and is not deprecated. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageFamilyName family = ProjectGlobalImageFamilyName.of("[PROJECT]", "[FAMILY]");
+   *   GetFromFamilyImageHttpRequest request = GetFromFamilyImageHttpRequest.newBuilder()
+   *     .setFamily(family.toString())
+   *     .build();
+   *   ApiFuture<Image> future = imageClient.getFromFamilyImageCallable().futureCall(request);
+   *   // Do something
+   *   Image response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getFromFamilyImageCallable() { + return stub.getFromFamilyImageCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an image in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   Boolean forceCreate = false;
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Image imageResource = Image.newBuilder().build();
+   *   Operation response = imageClient.insertImage(forceCreate, project, imageResource);
+   * }
+   * 
+ * + * @param forceCreate Force image creation if true. + * @param project Project ID for this request. + * @param imageResource An Image resource. (== resource_for beta.images ==) (== resource_for + * v1.images ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertImage( + Boolean forceCreate, ProjectName project, Image imageResource) { + + InsertImageHttpRequest request = + InsertImageHttpRequest.newBuilder() + .setForceCreate(forceCreate) + .setProject(project == null ? null : project.toString()) + .setImageResource(imageResource) + .build(); + return insertImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an image in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   Boolean forceCreate = false;
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Image imageResource = Image.newBuilder().build();
+   *   Operation response = imageClient.insertImage(forceCreate, project.toString(), imageResource);
+   * }
+   * 
+ * + * @param forceCreate Force image creation if true. + * @param project Project ID for this request. + * @param imageResource An Image resource. (== resource_for beta.images ==) (== resource_for + * v1.images ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertImage(Boolean forceCreate, String project, Image imageResource) { + + InsertImageHttpRequest request = + InsertImageHttpRequest.newBuilder() + .setForceCreate(forceCreate) + .setProject(project) + .setImageResource(imageResource) + .build(); + return insertImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an image in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   Boolean forceCreate = false;
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Image imageResource = Image.newBuilder().build();
+   *   InsertImageHttpRequest request = InsertImageHttpRequest.newBuilder()
+   *     .setForceCreate(forceCreate)
+   *     .setProject(project.toString())
+   *     .setImageResource(imageResource)
+   *     .build();
+   *   Operation response = imageClient.insertImage(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertImage(InsertImageHttpRequest request) { + return insertImageCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an image in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   Boolean forceCreate = false;
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Image imageResource = Image.newBuilder().build();
+   *   InsertImageHttpRequest request = InsertImageHttpRequest.newBuilder()
+   *     .setForceCreate(forceCreate)
+   *     .setProject(project.toString())
+   *     .setImageResource(imageResource)
+   *     .build();
+   *   ApiFuture<Operation> future = imageClient.insertImageCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertImageCallable() { + return stub.insertImageCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of custom images available to the specified project. Custom images are + * images you create that belong to your project. This method does not get any images that belong + * to other projects, including publicly-available images, like Debian 8. If you want to get a + * list of publicly-available images, use this method to make a request to the respective image + * project, such as debian-cloud or windows-cloud. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Image element : imageClient.listImages(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListImagesPagedResponse listImages(ProjectName project) { + ListImagesHttpRequest request = + ListImagesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listImages(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of custom images available to the specified project. Custom images are + * images you create that belong to your project. This method does not get any images that belong + * to other projects, including publicly-available images, like Debian 8. If you want to get a + * list of publicly-available images, use this method to make a request to the respective image + * project, such as debian-cloud or windows-cloud. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Image element : imageClient.listImages(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListImagesPagedResponse listImages(String project) { + ListImagesHttpRequest request = ListImagesHttpRequest.newBuilder().setProject(project).build(); + return listImages(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of custom images available to the specified project. Custom images are + * images you create that belong to your project. This method does not get any images that belong + * to other projects, including publicly-available images, like Debian 8. If you want to get a + * list of publicly-available images, use this method to make a request to the respective image + * project, such as debian-cloud or windows-cloud. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListImagesHttpRequest request = ListImagesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (Image element : imageClient.listImages(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListImagesPagedResponse listImages(ListImagesHttpRequest request) { + return listImagesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of custom images available to the specified project. Custom images are + * images you create that belong to your project. This method does not get any images that belong + * to other projects, including publicly-available images, like Debian 8. If you want to get a + * list of publicly-available images, use this method to make a request to the respective image + * project, such as debian-cloud or windows-cloud. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListImagesHttpRequest request = ListImagesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListImagesPagedResponse> future = imageClient.listImagesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Image element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listImagesPagedCallable() { + return stub.listImagesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of custom images available to the specified project. Custom images are + * images you create that belong to your project. This method does not get any images that belong + * to other projects, including publicly-available images, like Debian 8. If you want to get a + * list of publicly-available images, use this method to make a request to the respective image + * project, such as debian-cloud or windows-cloud. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListImagesHttpRequest request = ListImagesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     ImageList response = imageClient.listImagesCallable().call(request);
+   *     for (Image element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listImagesCallable() { + return stub.listImagesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on an image. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
+   *   Operation response = imageClient.setLabelsImage(resource, globalSetLabelsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param globalSetLabelsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsImage( + ProjectGlobalImageResourceName resource, + GlobalSetLabelsRequest globalSetLabelsRequestResource) { + + SetLabelsImageHttpRequest request = + SetLabelsImageHttpRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setGlobalSetLabelsRequestResource(globalSetLabelsRequestResource) + .build(); + return setLabelsImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on an image. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
+   *   Operation response = imageClient.setLabelsImage(resource.toString(), globalSetLabelsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param globalSetLabelsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsImage( + String resource, GlobalSetLabelsRequest globalSetLabelsRequestResource) { + + SetLabelsImageHttpRequest request = + SetLabelsImageHttpRequest.newBuilder() + .setResource(resource) + .setGlobalSetLabelsRequestResource(globalSetLabelsRequestResource) + .build(); + return setLabelsImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on an image. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
+   *   SetLabelsImageHttpRequest request = SetLabelsImageHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setGlobalSetLabelsRequestResource(globalSetLabelsRequestResource)
+   *     .build();
+   *   Operation response = imageClient.setLabelsImage(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsImage(SetLabelsImageHttpRequest request) { + return setLabelsImageCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on an image. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (ImageClient imageClient = ImageClient.create()) {
+   *   ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
+   *   SetLabelsImageHttpRequest request = SetLabelsImageHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setGlobalSetLabelsRequestResource(globalSetLabelsRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = imageClient.setLabelsImageCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable setLabelsImageCallable() { + return stub.setLabelsImageCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListImagesPagedResponse + extends AbstractPagedListResponse< + ListImagesHttpRequest, ImageList, Image, ListImagesPage, ListImagesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListImagesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListImagesPagedResponse apply(ListImagesPage input) { + return new ListImagesPagedResponse(input); + } + }); + } + + private ListImagesPagedResponse(ListImagesPage page) { + super(page, ListImagesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListImagesPage + extends AbstractPage { + + private ListImagesPage( + PageContext context, ImageList response) { + super(context, response); + } + + private static ListImagesPage createEmptyPage() { + return new ListImagesPage(null, null); + } + + @Override + protected ListImagesPage createPage( + PageContext context, ImageList response) { + return new ListImagesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListImagesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListImagesHttpRequest, ImageList, Image, ListImagesPage, ListImagesFixedSizeCollection> { + + private ListImagesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListImagesFixedSizeCollection createEmptyCollection() { + return new ListImagesFixedSizeCollection(null, 0); + } + + @Override + protected ListImagesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListImagesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageList.java new file mode 100644 index 000000000000..db11170a78d4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ImageList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private ImageList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private ImageList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ImageList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ImageList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ImageList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ImageList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(ImageList other) { + if (other == ImageList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(ImageList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Image items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public ImageList build() { + + return new ImageList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "ImageList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ImageList) { + ImageList that = (ImageList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageSettings.java new file mode 100644 index 000000000000..559d3f1cdfc3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageSettings.java @@ -0,0 +1,247 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.ImageClient.ListImagesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.ImageStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link ImageClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteImage to 30 seconds: + * + *

+ * 
+ * ImageSettings.Builder imageSettingsBuilder =
+ *     ImageSettings.newBuilder();
+ * imageSettingsBuilder.deleteImageSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * ImageSettings imageSettings = imageSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ImageSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteImage. */ + public UnaryCallSettings deleteImageSettings() { + return ((ImageStubSettings) getStubSettings()).deleteImageSettings(); + } + + /** Returns the object with the settings used for calls to deprecateImage. */ + public UnaryCallSettings deprecateImageSettings() { + return ((ImageStubSettings) getStubSettings()).deprecateImageSettings(); + } + + /** Returns the object with the settings used for calls to getImage. */ + public UnaryCallSettings getImageSettings() { + return ((ImageStubSettings) getStubSettings()).getImageSettings(); + } + + /** Returns the object with the settings used for calls to getFromFamilyImage. */ + public UnaryCallSettings getFromFamilyImageSettings() { + return ((ImageStubSettings) getStubSettings()).getFromFamilyImageSettings(); + } + + /** Returns the object with the settings used for calls to insertImage. */ + public UnaryCallSettings insertImageSettings() { + return ((ImageStubSettings) getStubSettings()).insertImageSettings(); + } + + /** Returns the object with the settings used for calls to listImages. */ + public PagedCallSettings + listImagesSettings() { + return ((ImageStubSettings) getStubSettings()).listImagesSettings(); + } + + /** Returns the object with the settings used for calls to setLabelsImage. */ + public UnaryCallSettings setLabelsImageSettings() { + return ((ImageStubSettings) getStubSettings()).setLabelsImageSettings(); + } + + public static final ImageSettings create(ImageStubSettings stub) throws IOException { + return new ImageSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ImageStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ImageStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return ImageStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ImageStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ImageStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ImageStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ImageStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ImageStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ImageSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ImageSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(ImageStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(ImageStubSettings.newBuilder()); + } + + protected Builder(ImageSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ImageStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public ImageStubSettings.Builder getStubSettingsBuilder() { + return ((ImageStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteImage. */ + public UnaryCallSettings.Builder deleteImageSettings() { + return getStubSettingsBuilder().deleteImageSettings(); + } + + /** Returns the builder for the settings used for calls to deprecateImage. */ + public UnaryCallSettings.Builder + deprecateImageSettings() { + return getStubSettingsBuilder().deprecateImageSettings(); + } + + /** Returns the builder for the settings used for calls to getImage. */ + public UnaryCallSettings.Builder getImageSettings() { + return getStubSettingsBuilder().getImageSettings(); + } + + /** Returns the builder for the settings used for calls to getFromFamilyImage. */ + public UnaryCallSettings.Builder + getFromFamilyImageSettings() { + return getStubSettingsBuilder().getFromFamilyImageSettings(); + } + + /** Returns the builder for the settings used for calls to insertImage. */ + public UnaryCallSettings.Builder insertImageSettings() { + return getStubSettingsBuilder().insertImageSettings(); + } + + /** Returns the builder for the settings used for calls to listImages. */ + public PagedCallSettings.Builder + listImagesSettings() { + return getStubSettingsBuilder().listImagesSettings(); + } + + /** Returns the builder for the settings used for calls to setLabelsImage. */ + public UnaryCallSettings.Builder + setLabelsImageSettings() { + return getStubSettingsBuilder().setLabelsImageSettings(); + } + + @Override + public ImageSettings build() throws IOException { + return new ImageSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertAddressHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertAddressHttpRequest.java new file mode 100644 index 000000000000..44854ff6fb49 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertAddressHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertAddressHttpRequest implements ApiMessage { + private final String access_token; + private final Address addressResource; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final String userIp; + + private InsertAddressHttpRequest() { + this.access_token = null; + this.addressResource = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.userIp = null; + } + + private InsertAddressHttpRequest( + String access_token, + Address addressResource, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + String userIp) { + this.access_token = access_token; + this.addressResource = addressResource; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("addressResource")) { + return addressResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Address getApiMessageRequestBody() { + return addressResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public Address getAddressResource() { + return addressResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertAddressHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertAddressHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertAddressHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertAddressHttpRequest(); + } + + public static class Builder { + private String access_token; + private Address addressResource; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertAddressHttpRequest other) { + if (other == InsertAddressHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAddressResource() != null) { + this.addressResource = other.addressResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertAddressHttpRequest source) { + this.access_token = source.access_token; + this.addressResource = source.addressResource; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public Address getAddressResource() { + return addressResource; + } + + public Builder setAddressResource(Address addressResource) { + this.addressResource = addressResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertAddressHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertAddressHttpRequest( + access_token, + addressResource, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAddressResource(this.addressResource); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertAddressHttpRequest{" + + "access_token=" + + access_token + + ", " + + "addressResource=" + + addressResource + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertAddressHttpRequest) { + InsertAddressHttpRequest that = (InsertAddressHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.addressResource, that.getAddressResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + addressResource, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertAutoscalerHttpRequest.java new file mode 100644 index 000000000000..3d82ab72a020 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertAutoscalerHttpRequest.java @@ -0,0 +1,444 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertAutoscalerHttpRequest implements ApiMessage { + private final String access_token; + private final Autoscaler autoscalerResource; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + private final String zone; + + private InsertAutoscalerHttpRequest() { + this.access_token = null; + this.autoscalerResource = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + this.zone = null; + } + + private InsertAutoscalerHttpRequest( + String access_token, + Autoscaler autoscalerResource, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp, + String zone) { + this.access_token = access_token; + this.autoscalerResource = autoscalerResource; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("autoscalerResource")) { + return autoscalerResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public Autoscaler getApiMessageRequestBody() { + return autoscalerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertAutoscalerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertAutoscalerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertAutoscalerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertAutoscalerHttpRequest(); + } + + public static class Builder { + private String access_token; + private Autoscaler autoscalerResource; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(InsertAutoscalerHttpRequest other) { + if (other == InsertAutoscalerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAutoscalerResource() != null) { + this.autoscalerResource = other.autoscalerResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(InsertAutoscalerHttpRequest source) { + this.access_token = source.access_token; + this.autoscalerResource = source.autoscalerResource; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public Builder setAutoscalerResource(Autoscaler autoscalerResource) { + this.autoscalerResource = autoscalerResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public InsertAutoscalerHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertAutoscalerHttpRequest( + access_token, + autoscalerResource, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAutoscalerResource(this.autoscalerResource); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertAutoscalerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "autoscalerResource=" + + autoscalerResource + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertAutoscalerHttpRequest) { + InsertAutoscalerHttpRequest that = (InsertAutoscalerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.autoscalerResource, that.getAutoscalerResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + autoscalerResource, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertBackendBucketHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertBackendBucketHttpRequest.java new file mode 100644 index 000000000000..f2416257483e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertBackendBucketHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertBackendBucketHttpRequest implements ApiMessage { + private final String access_token; + private final BackendBucket backendBucketResource; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertBackendBucketHttpRequest() { + this.access_token = null; + this.backendBucketResource = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertBackendBucketHttpRequest( + String access_token, + BackendBucket backendBucketResource, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendBucketResource = backendBucketResource; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendBucketResource")) { + return backendBucketResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public BackendBucket getApiMessageRequestBody() { + return backendBucketResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public BackendBucket getBackendBucketResource() { + return backendBucketResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertBackendBucketHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertBackendBucketHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertBackendBucketHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertBackendBucketHttpRequest(); + } + + public static class Builder { + private String access_token; + private BackendBucket backendBucketResource; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertBackendBucketHttpRequest other) { + if (other == InsertBackendBucketHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendBucketResource() != null) { + this.backendBucketResource = other.backendBucketResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertBackendBucketHttpRequest source) { + this.access_token = source.access_token; + this.backendBucketResource = source.backendBucketResource; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public BackendBucket getBackendBucketResource() { + return backendBucketResource; + } + + public Builder setBackendBucketResource(BackendBucket backendBucketResource) { + this.backendBucketResource = backendBucketResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertBackendBucketHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertBackendBucketHttpRequest( + access_token, + backendBucketResource, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendBucketResource(this.backendBucketResource); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertBackendBucketHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendBucketResource=" + + backendBucketResource + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertBackendBucketHttpRequest) { + InsertBackendBucketHttpRequest that = (InsertBackendBucketHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendBucketResource, that.getBackendBucketResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendBucketResource, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertBackendServiceHttpRequest.java new file mode 100644 index 000000000000..7bdaa1185c4f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertBackendServiceHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final BackendService backendServiceResource; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertBackendServiceHttpRequest() { + this.access_token = null; + this.backendServiceResource = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertBackendServiceHttpRequest( + String access_token, + BackendService backendServiceResource, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendServiceResource = backendServiceResource; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendServiceResource")) { + return backendServiceResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public BackendService getApiMessageRequestBody() { + return backendServiceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private BackendService backendServiceResource; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertBackendServiceHttpRequest other) { + if (other == InsertBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendServiceResource() != null) { + this.backendServiceResource = other.backendServiceResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendServiceResource = source.backendServiceResource; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public Builder setBackendServiceResource(BackendService backendServiceResource) { + this.backendServiceResource = backendServiceResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertBackendServiceHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertBackendServiceHttpRequest( + access_token, + backendServiceResource, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendServiceResource(this.backendServiceResource); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendServiceResource=" + + backendServiceResource + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertBackendServiceHttpRequest) { + InsertBackendServiceHttpRequest that = (InsertBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendServiceResource, that.getBackendServiceResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendServiceResource, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertDiskHttpRequest.java new file mode 100644 index 000000000000..aa60ae6b958c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertDiskHttpRequest.java @@ -0,0 +1,476 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final Disk diskResource; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String sourceImage; + private final String userIp; + private final String zone; + + private InsertDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.diskResource = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.sourceImage = null; + this.userIp = null; + this.zone = null; + } + + private InsertDiskHttpRequest( + String access_token, + String callback, + Disk diskResource, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String sourceImage, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.diskResource = diskResource; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.sourceImage = sourceImage; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("diskResource")) { + return diskResource; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("sourceImage")) { + return sourceImage; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public Disk getApiMessageRequestBody() { + return diskResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public Disk getDiskResource() { + return diskResource; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getSourceImage() { + return sourceImage; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private Disk diskResource; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String sourceImage; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(InsertDiskHttpRequest other) { + if (other == InsertDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDiskResource() != null) { + this.diskResource = other.diskResource; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSourceImage() != null) { + this.sourceImage = other.sourceImage; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(InsertDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.diskResource = source.diskResource; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.sourceImage = source.sourceImage; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public Disk getDiskResource() { + return diskResource; + } + + public Builder setDiskResource(Disk diskResource) { + this.diskResource = diskResource; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getSourceImage() { + return sourceImage; + } + + public Builder setSourceImage(String sourceImage) { + this.sourceImage = sourceImage; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public InsertDiskHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertDiskHttpRequest( + access_token, + callback, + diskResource, + fields, + key, + prettyPrint, + quotaUser, + requestId, + sourceImage, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDiskResource(this.diskResource); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSourceImage(this.sourceImage); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "diskResource=" + + diskResource + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "sourceImage=" + + sourceImage + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertDiskHttpRequest) { + InsertDiskHttpRequest that = (InsertDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.diskResource, that.getDiskResource()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.sourceImage, that.getSourceImage()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + diskResource, + fields, + key, + prettyPrint, + quotaUser, + requestId, + sourceImage, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertFirewallHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertFirewallHttpRequest.java new file mode 100644 index 000000000000..b3894dc14e7d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertFirewallHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertFirewallHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final Firewall firewallResource; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertFirewallHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.firewallResource = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertFirewallHttpRequest( + String access_token, + String callback, + String fields, + Firewall firewallResource, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.firewallResource = firewallResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("firewallResource")) { + return firewallResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Firewall getApiMessageRequestBody() { + return firewallResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public Firewall getFirewallResource() { + return firewallResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertFirewallHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertFirewallHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertFirewallHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertFirewallHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private Firewall firewallResource; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertFirewallHttpRequest other) { + if (other == InsertFirewallHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFirewallResource() != null) { + this.firewallResource = other.firewallResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertFirewallHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.firewallResource = source.firewallResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public Firewall getFirewallResource() { + return firewallResource; + } + + public Builder setFirewallResource(Firewall firewallResource) { + this.firewallResource = firewallResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertFirewallHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertFirewallHttpRequest( + access_token, + callback, + fields, + firewallResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFirewallResource(this.firewallResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertFirewallHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "firewallResource=" + + firewallResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertFirewallHttpRequest) { + InsertFirewallHttpRequest that = (InsertFirewallHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.firewallResource, that.getFirewallResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + firewallResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertForwardingRuleHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertForwardingRuleHttpRequest.java new file mode 100644 index 000000000000..5ac102ea2b9d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertForwardingRuleHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertForwardingRuleHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final ForwardingRule forwardingRuleResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final String userIp; + + private InsertForwardingRuleHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.forwardingRuleResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.userIp = null; + } + + private InsertForwardingRuleHttpRequest( + String access_token, + String callback, + String fields, + ForwardingRule forwardingRuleResource, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.forwardingRuleResource = forwardingRuleResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("forwardingRuleResource")) { + return forwardingRuleResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ForwardingRule getApiMessageRequestBody() { + return forwardingRuleResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public ForwardingRule getForwardingRuleResource() { + return forwardingRuleResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertForwardingRuleHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertForwardingRuleHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertForwardingRuleHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertForwardingRuleHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private ForwardingRule forwardingRuleResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertForwardingRuleHttpRequest other) { + if (other == InsertForwardingRuleHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getForwardingRuleResource() != null) { + this.forwardingRuleResource = other.forwardingRuleResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertForwardingRuleHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.forwardingRuleResource = source.forwardingRuleResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public ForwardingRule getForwardingRuleResource() { + return forwardingRuleResource; + } + + public Builder setForwardingRuleResource(ForwardingRule forwardingRuleResource) { + this.forwardingRuleResource = forwardingRuleResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertForwardingRuleHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertForwardingRuleHttpRequest( + access_token, + callback, + fields, + forwardingRuleResource, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setForwardingRuleResource(this.forwardingRuleResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertForwardingRuleHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "forwardingRuleResource=" + + forwardingRuleResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertForwardingRuleHttpRequest) { + InsertForwardingRuleHttpRequest that = (InsertForwardingRuleHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.forwardingRuleResource, that.getForwardingRuleResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + forwardingRuleResource, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertGlobalAddressHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertGlobalAddressHttpRequest.java new file mode 100644 index 000000000000..8494ba87d2b7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertGlobalAddressHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertGlobalAddressHttpRequest implements ApiMessage { + private final String access_token; + private final Address addressResource; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertGlobalAddressHttpRequest() { + this.access_token = null; + this.addressResource = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertGlobalAddressHttpRequest( + String access_token, + Address addressResource, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.addressResource = addressResource; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("addressResource")) { + return addressResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Address getApiMessageRequestBody() { + return addressResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public Address getAddressResource() { + return addressResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertGlobalAddressHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertGlobalAddressHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertGlobalAddressHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertGlobalAddressHttpRequest(); + } + + public static class Builder { + private String access_token; + private Address addressResource; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertGlobalAddressHttpRequest other) { + if (other == InsertGlobalAddressHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAddressResource() != null) { + this.addressResource = other.addressResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertGlobalAddressHttpRequest source) { + this.access_token = source.access_token; + this.addressResource = source.addressResource; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public Address getAddressResource() { + return addressResource; + } + + public Builder setAddressResource(Address addressResource) { + this.addressResource = addressResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertGlobalAddressHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertGlobalAddressHttpRequest( + access_token, + addressResource, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAddressResource(this.addressResource); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertGlobalAddressHttpRequest{" + + "access_token=" + + access_token + + ", " + + "addressResource=" + + addressResource + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertGlobalAddressHttpRequest) { + InsertGlobalAddressHttpRequest that = (InsertGlobalAddressHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.addressResource, that.getAddressResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + addressResource, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertGlobalForwardingRuleHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertGlobalForwardingRuleHttpRequest.java new file mode 100644 index 000000000000..ffc889f6a054 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertGlobalForwardingRuleHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertGlobalForwardingRuleHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final ForwardingRule forwardingRuleResource; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertGlobalForwardingRuleHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.forwardingRuleResource = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertGlobalForwardingRuleHttpRequest( + String access_token, + String callback, + String fields, + ForwardingRule forwardingRuleResource, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.forwardingRuleResource = forwardingRuleResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("forwardingRuleResource")) { + return forwardingRuleResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ForwardingRule getApiMessageRequestBody() { + return forwardingRuleResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public ForwardingRule getForwardingRuleResource() { + return forwardingRuleResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertGlobalForwardingRuleHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertGlobalForwardingRuleHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertGlobalForwardingRuleHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertGlobalForwardingRuleHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private ForwardingRule forwardingRuleResource; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertGlobalForwardingRuleHttpRequest other) { + if (other == InsertGlobalForwardingRuleHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getForwardingRuleResource() != null) { + this.forwardingRuleResource = other.forwardingRuleResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertGlobalForwardingRuleHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.forwardingRuleResource = source.forwardingRuleResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public ForwardingRule getForwardingRuleResource() { + return forwardingRuleResource; + } + + public Builder setForwardingRuleResource(ForwardingRule forwardingRuleResource) { + this.forwardingRuleResource = forwardingRuleResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertGlobalForwardingRuleHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertGlobalForwardingRuleHttpRequest( + access_token, + callback, + fields, + forwardingRuleResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setForwardingRuleResource(this.forwardingRuleResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertGlobalForwardingRuleHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "forwardingRuleResource=" + + forwardingRuleResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertGlobalForwardingRuleHttpRequest) { + InsertGlobalForwardingRuleHttpRequest that = (InsertGlobalForwardingRuleHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.forwardingRuleResource, that.getForwardingRuleResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + forwardingRuleResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertHealthCheckHttpRequest.java new file mode 100644 index 000000000000..e49d8f2d47b7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertHealthCheckHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final HealthCheck healthCheckResource; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.healthCheckResource = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertHealthCheckHttpRequest( + String access_token, + String callback, + String fields, + HealthCheck healthCheckResource, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.healthCheckResource = healthCheckResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("healthCheckResource")) { + return healthCheckResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public HealthCheck getApiMessageRequestBody() { + return healthCheckResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public HealthCheck getHealthCheckResource() { + return healthCheckResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private HealthCheck healthCheckResource; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertHealthCheckHttpRequest other) { + if (other == InsertHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHealthCheckResource() != null) { + this.healthCheckResource = other.healthCheckResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.healthCheckResource = source.healthCheckResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public HealthCheck getHealthCheckResource() { + return healthCheckResource; + } + + public Builder setHealthCheckResource(HealthCheck healthCheckResource) { + this.healthCheckResource = healthCheckResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertHealthCheckHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertHealthCheckHttpRequest( + access_token, + callback, + fields, + healthCheckResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setHealthCheckResource(this.healthCheckResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "healthCheckResource=" + + healthCheckResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertHealthCheckHttpRequest) { + InsertHealthCheckHttpRequest that = (InsertHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.healthCheckResource, that.getHealthCheckResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + healthCheckResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertHttpHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertHttpHealthCheckHttpRequest.java new file mode 100644 index 000000000000..aa6e4e2dbc5d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertHttpHealthCheckHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertHttpHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final HttpHealthCheck2 httpHealthCheckResource; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertHttpHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.httpHealthCheckResource = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertHttpHealthCheckHttpRequest( + String access_token, + String callback, + String fields, + HttpHealthCheck2 httpHealthCheckResource, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.httpHealthCheckResource = httpHealthCheckResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("httpHealthCheckResource")) { + return httpHealthCheckResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public HttpHealthCheck2 getApiMessageRequestBody() { + return httpHealthCheckResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public HttpHealthCheck2 getHttpHealthCheckResource() { + return httpHealthCheckResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertHttpHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertHttpHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertHttpHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertHttpHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private HttpHealthCheck2 httpHealthCheckResource; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertHttpHealthCheckHttpRequest other) { + if (other == InsertHttpHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHttpHealthCheckResource() != null) { + this.httpHealthCheckResource = other.httpHealthCheckResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertHttpHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.httpHealthCheckResource = source.httpHealthCheckResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public HttpHealthCheck2 getHttpHealthCheckResource() { + return httpHealthCheckResource; + } + + public Builder setHttpHealthCheckResource(HttpHealthCheck2 httpHealthCheckResource) { + this.httpHealthCheckResource = httpHealthCheckResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertHttpHealthCheckHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertHttpHealthCheckHttpRequest( + access_token, + callback, + fields, + httpHealthCheckResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setHttpHealthCheckResource(this.httpHealthCheckResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertHttpHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "httpHealthCheckResource=" + + httpHealthCheckResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertHttpHealthCheckHttpRequest) { + InsertHttpHealthCheckHttpRequest that = (InsertHttpHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.httpHealthCheckResource, that.getHttpHealthCheckResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + httpHealthCheckResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertHttpsHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertHttpsHealthCheckHttpRequest.java new file mode 100644 index 000000000000..64ebaef619e6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertHttpsHealthCheckHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertHttpsHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final HttpsHealthCheck2 httpsHealthCheckResource; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertHttpsHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.httpsHealthCheckResource = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertHttpsHealthCheckHttpRequest( + String access_token, + String callback, + String fields, + HttpsHealthCheck2 httpsHealthCheckResource, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.httpsHealthCheckResource = httpsHealthCheckResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("httpsHealthCheckResource")) { + return httpsHealthCheckResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public HttpsHealthCheck2 getApiMessageRequestBody() { + return httpsHealthCheckResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public HttpsHealthCheck2 getHttpsHealthCheckResource() { + return httpsHealthCheckResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertHttpsHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertHttpsHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertHttpsHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertHttpsHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private HttpsHealthCheck2 httpsHealthCheckResource; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertHttpsHealthCheckHttpRequest other) { + if (other == InsertHttpsHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHttpsHealthCheckResource() != null) { + this.httpsHealthCheckResource = other.httpsHealthCheckResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertHttpsHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.httpsHealthCheckResource = source.httpsHealthCheckResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public HttpsHealthCheck2 getHttpsHealthCheckResource() { + return httpsHealthCheckResource; + } + + public Builder setHttpsHealthCheckResource(HttpsHealthCheck2 httpsHealthCheckResource) { + this.httpsHealthCheckResource = httpsHealthCheckResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertHttpsHealthCheckHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertHttpsHealthCheckHttpRequest( + access_token, + callback, + fields, + httpsHealthCheckResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setHttpsHealthCheckResource(this.httpsHealthCheckResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertHttpsHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "httpsHealthCheckResource=" + + httpsHealthCheckResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertHttpsHealthCheckHttpRequest) { + InsertHttpsHealthCheckHttpRequest that = (InsertHttpsHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.httpsHealthCheckResource, that.getHttpsHealthCheckResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + httpsHealthCheckResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertImageHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertImageHttpRequest.java new file mode 100644 index 000000000000..fc5fe51b948b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertImageHttpRequest.java @@ -0,0 +1,477 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertImageHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final Boolean forceCreate; + private final Image imageResource; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertImageHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.forceCreate = null; + this.imageResource = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertImageHttpRequest( + String access_token, + String callback, + String fields, + Boolean forceCreate, + Image imageResource, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.forceCreate = forceCreate; + this.imageResource = imageResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("forceCreate")) { + return forceCreate; + } + if (fieldName.equals("imageResource")) { + return imageResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Image getApiMessageRequestBody() { + return imageResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public Boolean getForceCreate() { + return forceCreate; + } + + public Image getImageResource() { + return imageResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertImageHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertImageHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertImageHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertImageHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private Boolean forceCreate; + private Image imageResource; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertImageHttpRequest other) { + if (other == InsertImageHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getForceCreate() != null) { + this.forceCreate = other.forceCreate; + } + if (other.getImageResource() != null) { + this.imageResource = other.imageResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertImageHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.forceCreate = source.forceCreate; + this.imageResource = source.imageResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public Boolean getForceCreate() { + return forceCreate; + } + + public Builder setForceCreate(Boolean forceCreate) { + this.forceCreate = forceCreate; + return this; + } + + public Image getImageResource() { + return imageResource; + } + + public Builder setImageResource(Image imageResource) { + this.imageResource = imageResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertImageHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertImageHttpRequest( + access_token, + callback, + fields, + forceCreate, + imageResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setForceCreate(this.forceCreate); + newBuilder.setImageResource(this.imageResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertImageHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "forceCreate=" + + forceCreate + + ", " + + "imageResource=" + + imageResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertImageHttpRequest) { + InsertImageHttpRequest that = (InsertImageHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.forceCreate, that.getForceCreate()) + && Objects.equals(this.imageResource, that.getImageResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + forceCreate, + imageResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceGroupHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceGroupHttpRequest.java new file mode 100644 index 000000000000..31d5d8febca0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceGroupHttpRequest.java @@ -0,0 +1,444 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertInstanceGroupHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final InstanceGroup instanceGroupResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + private final String zone; + + private InsertInstanceGroupHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + this.zone = null; + } + + private InsertInstanceGroupHttpRequest( + String access_token, + String callback, + String fields, + InstanceGroup instanceGroupResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupResource = instanceGroupResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupResource")) { + return instanceGroupResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public InstanceGroup getApiMessageRequestBody() { + return instanceGroupResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public InstanceGroup getInstanceGroupResource() { + return instanceGroupResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertInstanceGroupHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertInstanceGroupHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertInstanceGroupHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertInstanceGroupHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private InstanceGroup instanceGroupResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(InsertInstanceGroupHttpRequest other) { + if (other == InsertInstanceGroupHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupResource() != null) { + this.instanceGroupResource = other.instanceGroupResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(InsertInstanceGroupHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupResource = source.instanceGroupResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public InstanceGroup getInstanceGroupResource() { + return instanceGroupResource; + } + + public Builder setInstanceGroupResource(InstanceGroup instanceGroupResource) { + this.instanceGroupResource = instanceGroupResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public InsertInstanceGroupHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertInstanceGroupHttpRequest( + access_token, + callback, + fields, + instanceGroupResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupResource(this.instanceGroupResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertInstanceGroupHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupResource=" + + instanceGroupResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertInstanceGroupHttpRequest) { + InsertInstanceGroupHttpRequest that = (InsertInstanceGroupHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupResource, that.getInstanceGroupResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..869aeaa40d7d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceGroupManagerHttpRequest.java @@ -0,0 +1,446 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final InstanceGroupManager instanceGroupManagerResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + private final String zone; + + private InsertInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManagerResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + this.zone = null; + } + + private InsertInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + InstanceGroupManager instanceGroupManagerResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManagerResource = instanceGroupManagerResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManagerResource")) { + return instanceGroupManagerResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public InstanceGroupManager getApiMessageRequestBody() { + return instanceGroupManagerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public InstanceGroupManager getInstanceGroupManagerResource() { + return instanceGroupManagerResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private InstanceGroupManager instanceGroupManagerResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(InsertInstanceGroupManagerHttpRequest other) { + if (other == InsertInstanceGroupManagerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManagerResource() != null) { + this.instanceGroupManagerResource = other.instanceGroupManagerResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(InsertInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManagerResource = source.instanceGroupManagerResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public InstanceGroupManager getInstanceGroupManagerResource() { + return instanceGroupManagerResource; + } + + public Builder setInstanceGroupManagerResource( + InstanceGroupManager instanceGroupManagerResource) { + this.instanceGroupManagerResource = instanceGroupManagerResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public InsertInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManagerResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManagerResource(this.instanceGroupManagerResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManagerResource=" + + instanceGroupManagerResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertInstanceGroupManagerHttpRequest) { + InsertInstanceGroupManagerHttpRequest that = (InsertInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals( + this.instanceGroupManagerResource, that.getInstanceGroupManagerResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManagerResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceHttpRequest.java new file mode 100644 index 000000000000..0a110a065c7e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceHttpRequest.java @@ -0,0 +1,476 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final Instance instanceResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String sourceInstanceTemplate; + private final String userIp; + private final String zone; + + private InsertInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.sourceInstanceTemplate = null; + this.userIp = null; + this.zone = null; + } + + private InsertInstanceHttpRequest( + String access_token, + String callback, + String fields, + Instance instanceResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String sourceInstanceTemplate, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceResource = instanceResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.sourceInstanceTemplate = sourceInstanceTemplate; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceResource")) { + return instanceResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("sourceInstanceTemplate")) { + return sourceInstanceTemplate; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public Instance getApiMessageRequestBody() { + return instanceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public Instance getInstanceResource() { + return instanceResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getSourceInstanceTemplate() { + return sourceInstanceTemplate; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private Instance instanceResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String sourceInstanceTemplate; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(InsertInstanceHttpRequest other) { + if (other == InsertInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceResource() != null) { + this.instanceResource = other.instanceResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSourceInstanceTemplate() != null) { + this.sourceInstanceTemplate = other.sourceInstanceTemplate; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(InsertInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceResource = source.instanceResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.sourceInstanceTemplate = source.sourceInstanceTemplate; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public Instance getInstanceResource() { + return instanceResource; + } + + public Builder setInstanceResource(Instance instanceResource) { + this.instanceResource = instanceResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getSourceInstanceTemplate() { + return sourceInstanceTemplate; + } + + public Builder setSourceInstanceTemplate(String sourceInstanceTemplate) { + this.sourceInstanceTemplate = sourceInstanceTemplate; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public InsertInstanceHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertInstanceHttpRequest( + access_token, + callback, + fields, + instanceResource, + key, + prettyPrint, + quotaUser, + requestId, + sourceInstanceTemplate, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceResource(this.instanceResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSourceInstanceTemplate(this.sourceInstanceTemplate); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceResource=" + + instanceResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "sourceInstanceTemplate=" + + sourceInstanceTemplate + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertInstanceHttpRequest) { + InsertInstanceHttpRequest that = (InsertInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceResource, that.getInstanceResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.sourceInstanceTemplate, that.getSourceInstanceTemplate()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceResource, + key, + prettyPrint, + quotaUser, + requestId, + sourceInstanceTemplate, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceTemplateHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceTemplateHttpRequest.java new file mode 100644 index 000000000000..950f30b9ee45 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInstanceTemplateHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertInstanceTemplateHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final InstanceTemplate instanceTemplateResource; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertInstanceTemplateHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceTemplateResource = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertInstanceTemplateHttpRequest( + String access_token, + String callback, + String fields, + InstanceTemplate instanceTemplateResource, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceTemplateResource = instanceTemplateResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceTemplateResource")) { + return instanceTemplateResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceTemplate getApiMessageRequestBody() { + return instanceTemplateResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public InstanceTemplate getInstanceTemplateResource() { + return instanceTemplateResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertInstanceTemplateHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertInstanceTemplateHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertInstanceTemplateHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertInstanceTemplateHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private InstanceTemplate instanceTemplateResource; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertInstanceTemplateHttpRequest other) { + if (other == InsertInstanceTemplateHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceTemplateResource() != null) { + this.instanceTemplateResource = other.instanceTemplateResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertInstanceTemplateHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceTemplateResource = source.instanceTemplateResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public InstanceTemplate getInstanceTemplateResource() { + return instanceTemplateResource; + } + + public Builder setInstanceTemplateResource(InstanceTemplate instanceTemplateResource) { + this.instanceTemplateResource = instanceTemplateResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertInstanceTemplateHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertInstanceTemplateHttpRequest( + access_token, + callback, + fields, + instanceTemplateResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceTemplateResource(this.instanceTemplateResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertInstanceTemplateHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceTemplateResource=" + + instanceTemplateResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertInstanceTemplateHttpRequest) { + InsertInstanceTemplateHttpRequest that = (InsertInstanceTemplateHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceTemplateResource, that.getInstanceTemplateResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceTemplateResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInterconnectAttachmentHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInterconnectAttachmentHttpRequest.java new file mode 100644 index 000000000000..8a3e6df68c91 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInterconnectAttachmentHttpRequest.java @@ -0,0 +1,447 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertInterconnectAttachmentHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final InterconnectAttachment interconnectAttachmentResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final String userIp; + + private InsertInterconnectAttachmentHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.interconnectAttachmentResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.userIp = null; + } + + private InsertInterconnectAttachmentHttpRequest( + String access_token, + String callback, + String fields, + InterconnectAttachment interconnectAttachmentResource, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.interconnectAttachmentResource = interconnectAttachmentResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("interconnectAttachmentResource")) { + return interconnectAttachmentResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InterconnectAttachment getApiMessageRequestBody() { + return interconnectAttachmentResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public InterconnectAttachment getInterconnectAttachmentResource() { + return interconnectAttachmentResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertInterconnectAttachmentHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertInterconnectAttachmentHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertInterconnectAttachmentHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertInterconnectAttachmentHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private InterconnectAttachment interconnectAttachmentResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertInterconnectAttachmentHttpRequest other) { + if (other == InsertInterconnectAttachmentHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInterconnectAttachmentResource() != null) { + this.interconnectAttachmentResource = other.interconnectAttachmentResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertInterconnectAttachmentHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.interconnectAttachmentResource = source.interconnectAttachmentResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public InterconnectAttachment getInterconnectAttachmentResource() { + return interconnectAttachmentResource; + } + + public Builder setInterconnectAttachmentResource( + InterconnectAttachment interconnectAttachmentResource) { + this.interconnectAttachmentResource = interconnectAttachmentResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertInterconnectAttachmentHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertInterconnectAttachmentHttpRequest( + access_token, + callback, + fields, + interconnectAttachmentResource, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInterconnectAttachmentResource(this.interconnectAttachmentResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertInterconnectAttachmentHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "interconnectAttachmentResource=" + + interconnectAttachmentResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertInterconnectAttachmentHttpRequest) { + InsertInterconnectAttachmentHttpRequest that = (InsertInterconnectAttachmentHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals( + this.interconnectAttachmentResource, that.getInterconnectAttachmentResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + interconnectAttachmentResource, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInterconnectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInterconnectHttpRequest.java new file mode 100644 index 000000000000..9402cf686fc4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertInterconnectHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertInterconnectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final Interconnect interconnectResource; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertInterconnectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.interconnectResource = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertInterconnectHttpRequest( + String access_token, + String callback, + String fields, + Interconnect interconnectResource, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.interconnectResource = interconnectResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("interconnectResource")) { + return interconnectResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Interconnect getApiMessageRequestBody() { + return interconnectResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public Interconnect getInterconnectResource() { + return interconnectResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertInterconnectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertInterconnectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertInterconnectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertInterconnectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private Interconnect interconnectResource; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertInterconnectHttpRequest other) { + if (other == InsertInterconnectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInterconnectResource() != null) { + this.interconnectResource = other.interconnectResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertInterconnectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.interconnectResource = source.interconnectResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public Interconnect getInterconnectResource() { + return interconnectResource; + } + + public Builder setInterconnectResource(Interconnect interconnectResource) { + this.interconnectResource = interconnectResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertInterconnectHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertInterconnectHttpRequest( + access_token, + callback, + fields, + interconnectResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInterconnectResource(this.interconnectResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertInterconnectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "interconnectResource=" + + interconnectResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertInterconnectHttpRequest) { + InsertInterconnectHttpRequest that = (InsertInterconnectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.interconnectResource, that.getInterconnectResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + interconnectResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertLicenseHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertLicenseHttpRequest.java new file mode 100644 index 000000000000..577888b8f703 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertLicenseHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertLicenseHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final License licenseResource; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertLicenseHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.licenseResource = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertLicenseHttpRequest( + String access_token, + String callback, + String fields, + String key, + License licenseResource, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.licenseResource = licenseResource; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("licenseResource")) { + return licenseResource; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public License getApiMessageRequestBody() { + return licenseResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public License getLicenseResource() { + return licenseResource; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertLicenseHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertLicenseHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertLicenseHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertLicenseHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private License licenseResource; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertLicenseHttpRequest other) { + if (other == InsertLicenseHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getLicenseResource() != null) { + this.licenseResource = other.licenseResource; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertLicenseHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.licenseResource = source.licenseResource; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public License getLicenseResource() { + return licenseResource; + } + + public Builder setLicenseResource(License licenseResource) { + this.licenseResource = licenseResource; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertLicenseHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertLicenseHttpRequest( + access_token, + callback, + fields, + key, + licenseResource, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setLicenseResource(this.licenseResource); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertLicenseHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "licenseResource=" + + licenseResource + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertLicenseHttpRequest) { + InsertLicenseHttpRequest that = (InsertLicenseHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.licenseResource, that.getLicenseResource()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + licenseResource, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertNetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertNetworkHttpRequest.java new file mode 100644 index 000000000000..1c765b0db7a5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertNetworkHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertNetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final Network networkResource; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private InsertNetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.networkResource = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private InsertNetworkHttpRequest( + String access_token, + String callback, + String fields, + String key, + Network networkResource, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.networkResource = networkResource; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("networkResource")) { + return networkResource; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Network getApiMessageRequestBody() { + return networkResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public Network getNetworkResource() { + return networkResource; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertNetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertNetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertNetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertNetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private Network networkResource; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertNetworkHttpRequest other) { + if (other == InsertNetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getNetworkResource() != null) { + this.networkResource = other.networkResource; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertNetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.networkResource = source.networkResource; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Network getNetworkResource() { + return networkResource; + } + + public Builder setNetworkResource(Network networkResource) { + this.networkResource = networkResource; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertNetworkHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertNetworkHttpRequest( + access_token, + callback, + fields, + key, + networkResource, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setNetworkResource(this.networkResource); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertNetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "networkResource=" + + networkResource + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertNetworkHttpRequest) { + InsertNetworkHttpRequest that = (InsertNetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.networkResource, that.getNetworkResource()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + networkResource, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionAutoscalerHttpRequest.java new file mode 100644 index 000000000000..6f68a3783cb2 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionAutoscalerHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertRegionAutoscalerHttpRequest implements ApiMessage { + private final String access_token; + private final Autoscaler autoscalerResource; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final String userIp; + + private InsertRegionAutoscalerHttpRequest() { + this.access_token = null; + this.autoscalerResource = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.userIp = null; + } + + private InsertRegionAutoscalerHttpRequest( + String access_token, + Autoscaler autoscalerResource, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + String userIp) { + this.access_token = access_token; + this.autoscalerResource = autoscalerResource; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("autoscalerResource")) { + return autoscalerResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Autoscaler getApiMessageRequestBody() { + return autoscalerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertRegionAutoscalerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertRegionAutoscalerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertRegionAutoscalerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertRegionAutoscalerHttpRequest(); + } + + public static class Builder { + private String access_token; + private Autoscaler autoscalerResource; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertRegionAutoscalerHttpRequest other) { + if (other == InsertRegionAutoscalerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAutoscalerResource() != null) { + this.autoscalerResource = other.autoscalerResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertRegionAutoscalerHttpRequest source) { + this.access_token = source.access_token; + this.autoscalerResource = source.autoscalerResource; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public Builder setAutoscalerResource(Autoscaler autoscalerResource) { + this.autoscalerResource = autoscalerResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertRegionAutoscalerHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertRegionAutoscalerHttpRequest( + access_token, + autoscalerResource, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAutoscalerResource(this.autoscalerResource); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertRegionAutoscalerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "autoscalerResource=" + + autoscalerResource + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertRegionAutoscalerHttpRequest) { + InsertRegionAutoscalerHttpRequest that = (InsertRegionAutoscalerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.autoscalerResource, that.getAutoscalerResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + autoscalerResource, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionBackendServiceHttpRequest.java new file mode 100644 index 000000000000..f85f6024141f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionBackendServiceHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertRegionBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final BackendService backendServiceResource; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final String userIp; + + private InsertRegionBackendServiceHttpRequest() { + this.access_token = null; + this.backendServiceResource = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.userIp = null; + } + + private InsertRegionBackendServiceHttpRequest( + String access_token, + BackendService backendServiceResource, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendServiceResource = backendServiceResource; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendServiceResource")) { + return backendServiceResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public BackendService getApiMessageRequestBody() { + return backendServiceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertRegionBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertRegionBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertRegionBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertRegionBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private BackendService backendServiceResource; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertRegionBackendServiceHttpRequest other) { + if (other == InsertRegionBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendServiceResource() != null) { + this.backendServiceResource = other.backendServiceResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertRegionBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendServiceResource = source.backendServiceResource; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public Builder setBackendServiceResource(BackendService backendServiceResource) { + this.backendServiceResource = backendServiceResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertRegionBackendServiceHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertRegionBackendServiceHttpRequest( + access_token, + backendServiceResource, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendServiceResource(this.backendServiceResource); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertRegionBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendServiceResource=" + + backendServiceResource + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertRegionBackendServiceHttpRequest) { + InsertRegionBackendServiceHttpRequest that = (InsertRegionBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendServiceResource, that.getBackendServiceResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendServiceResource, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionCommitmentHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionCommitmentHttpRequest.java new file mode 100644 index 000000000000..b2ac2c51f6a6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionCommitmentHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertRegionCommitmentHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final Commitment commitmentResource; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final String userIp; + + private InsertRegionCommitmentHttpRequest() { + this.access_token = null; + this.callback = null; + this.commitmentResource = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.userIp = null; + } + + private InsertRegionCommitmentHttpRequest( + String access_token, + String callback, + Commitment commitmentResource, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.commitmentResource = commitmentResource; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("commitmentResource")) { + return commitmentResource; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Commitment getApiMessageRequestBody() { + return commitmentResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public Commitment getCommitmentResource() { + return commitmentResource; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertRegionCommitmentHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertRegionCommitmentHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertRegionCommitmentHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertRegionCommitmentHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private Commitment commitmentResource; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertRegionCommitmentHttpRequest other) { + if (other == InsertRegionCommitmentHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getCommitmentResource() != null) { + this.commitmentResource = other.commitmentResource; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertRegionCommitmentHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.commitmentResource = source.commitmentResource; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public Commitment getCommitmentResource() { + return commitmentResource; + } + + public Builder setCommitmentResource(Commitment commitmentResource) { + this.commitmentResource = commitmentResource; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertRegionCommitmentHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertRegionCommitmentHttpRequest( + access_token, + callback, + commitmentResource, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setCommitmentResource(this.commitmentResource); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertRegionCommitmentHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "commitmentResource=" + + commitmentResource + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertRegionCommitmentHttpRequest) { + InsertRegionCommitmentHttpRequest that = (InsertRegionCommitmentHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.commitmentResource, that.getCommitmentResource()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + commitmentResource, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionDiskHttpRequest.java new file mode 100644 index 000000000000..410d10f9dfe2 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionDiskHttpRequest.java @@ -0,0 +1,477 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertRegionDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final Disk diskResource; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final String sourceImage; + private final String userIp; + + private InsertRegionDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.diskResource = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.sourceImage = null; + this.userIp = null; + } + + private InsertRegionDiskHttpRequest( + String access_token, + String callback, + Disk diskResource, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + String sourceImage, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.diskResource = diskResource; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.sourceImage = sourceImage; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("diskResource")) { + return diskResource; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("sourceImage")) { + return sourceImage; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Disk getApiMessageRequestBody() { + return diskResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public Disk getDiskResource() { + return diskResource; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public String getSourceImage() { + return sourceImage; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertRegionDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertRegionDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertRegionDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertRegionDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private Disk diskResource; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private String sourceImage; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertRegionDiskHttpRequest other) { + if (other == InsertRegionDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDiskResource() != null) { + this.diskResource = other.diskResource; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSourceImage() != null) { + this.sourceImage = other.sourceImage; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertRegionDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.diskResource = source.diskResource; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.sourceImage = source.sourceImage; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public Disk getDiskResource() { + return diskResource; + } + + public Builder setDiskResource(Disk diskResource) { + this.diskResource = diskResource; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getSourceImage() { + return sourceImage; + } + + public Builder setSourceImage(String sourceImage) { + this.sourceImage = sourceImage; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertRegionDiskHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertRegionDiskHttpRequest( + access_token, + callback, + diskResource, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + sourceImage, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDiskResource(this.diskResource); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setSourceImage(this.sourceImage); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertRegionDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "diskResource=" + + diskResource + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "sourceImage=" + + sourceImage + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertRegionDiskHttpRequest) { + InsertRegionDiskHttpRequest that = (InsertRegionDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.diskResource, that.getDiskResource()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.sourceImage, that.getSourceImage()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + diskResource, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + sourceImage, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..7e4b4df953c9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRegionInstanceGroupManagerHttpRequest.java @@ -0,0 +1,448 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertRegionInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final InstanceGroupManager instanceGroupManagerResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final String userIp; + + private InsertRegionInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManagerResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.userIp = null; + } + + private InsertRegionInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + InstanceGroupManager instanceGroupManagerResource, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManagerResource = instanceGroupManagerResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManagerResource")) { + return instanceGroupManagerResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceGroupManager getApiMessageRequestBody() { + return instanceGroupManagerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public InstanceGroupManager getInstanceGroupManagerResource() { + return instanceGroupManagerResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertRegionInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertRegionInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertRegionInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertRegionInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private InstanceGroupManager instanceGroupManagerResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertRegionInstanceGroupManagerHttpRequest other) { + if (other == InsertRegionInstanceGroupManagerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManagerResource() != null) { + this.instanceGroupManagerResource = other.instanceGroupManagerResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertRegionInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManagerResource = source.instanceGroupManagerResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public InstanceGroupManager getInstanceGroupManagerResource() { + return instanceGroupManagerResource; + } + + public Builder setInstanceGroupManagerResource( + InstanceGroupManager instanceGroupManagerResource) { + this.instanceGroupManagerResource = instanceGroupManagerResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertRegionInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertRegionInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManagerResource, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManagerResource(this.instanceGroupManagerResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertRegionInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManagerResource=" + + instanceGroupManagerResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertRegionInstanceGroupManagerHttpRequest) { + InsertRegionInstanceGroupManagerHttpRequest that = + (InsertRegionInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals( + this.instanceGroupManagerResource, that.getInstanceGroupManagerResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManagerResource, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRouteHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRouteHttpRequest.java new file mode 100644 index 000000000000..ef13fefe5651 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRouteHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertRouteHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final Route routeResource; + private final String userIp; + + private InsertRouteHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.routeResource = null; + this.userIp = null; + } + + private InsertRouteHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + Route routeResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.routeResource = routeResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("routeResource")) { + return routeResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Route getApiMessageRequestBody() { + return routeResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public Route getRouteResource() { + return routeResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertRouteHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertRouteHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertRouteHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertRouteHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private Route routeResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertRouteHttpRequest other) { + if (other == InsertRouteHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getRouteResource() != null) { + this.routeResource = other.routeResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertRouteHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.routeResource = source.routeResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Route getRouteResource() { + return routeResource; + } + + public Builder setRouteResource(Route routeResource) { + this.routeResource = routeResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertRouteHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertRouteHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + routeResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setRouteResource(this.routeResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertRouteHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "routeResource=" + + routeResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertRouteHttpRequest) { + InsertRouteHttpRequest that = (InsertRouteHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.routeResource, that.getRouteResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + routeResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRouterHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRouterHttpRequest.java new file mode 100644 index 000000000000..73648b655089 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertRouterHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertRouterHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final Router routerResource; + private final String userIp; + + private InsertRouterHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.routerResource = null; + this.userIp = null; + } + + private InsertRouterHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + Router routerResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.routerResource = routerResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("routerResource")) { + return routerResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Router getApiMessageRequestBody() { + return routerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public Router getRouterResource() { + return routerResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertRouterHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertRouterHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertRouterHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertRouterHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private Router routerResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertRouterHttpRequest other) { + if (other == InsertRouterHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getRouterResource() != null) { + this.routerResource = other.routerResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertRouterHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.routerResource = source.routerResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Router getRouterResource() { + return routerResource; + } + + public Builder setRouterResource(Router routerResource) { + this.routerResource = routerResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertRouterHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertRouterHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + routerResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setRouterResource(this.routerResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertRouterHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "routerResource=" + + routerResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertRouterHttpRequest) { + InsertRouterHttpRequest that = (InsertRouterHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.routerResource, that.getRouterResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + routerResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertSslCertificateHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertSslCertificateHttpRequest.java new file mode 100644 index 000000000000..6eaf2ac78ddb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertSslCertificateHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertSslCertificateHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final SslCertificate sslCertificateResource; + private final String userIp; + + private InsertSslCertificateHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.sslCertificateResource = null; + this.userIp = null; + } + + private InsertSslCertificateHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + SslCertificate sslCertificateResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.sslCertificateResource = sslCertificateResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("sslCertificateResource")) { + return sslCertificateResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public SslCertificate getApiMessageRequestBody() { + return sslCertificateResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public SslCertificate getSslCertificateResource() { + return sslCertificateResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertSslCertificateHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertSslCertificateHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertSslCertificateHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertSslCertificateHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private SslCertificate sslCertificateResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertSslCertificateHttpRequest other) { + if (other == InsertSslCertificateHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSslCertificateResource() != null) { + this.sslCertificateResource = other.sslCertificateResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertSslCertificateHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.sslCertificateResource = source.sslCertificateResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public SslCertificate getSslCertificateResource() { + return sslCertificateResource; + } + + public Builder setSslCertificateResource(SslCertificate sslCertificateResource) { + this.sslCertificateResource = sslCertificateResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertSslCertificateHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertSslCertificateHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + sslCertificateResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSslCertificateResource(this.sslCertificateResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertSslCertificateHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "sslCertificateResource=" + + sslCertificateResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertSslCertificateHttpRequest) { + InsertSslCertificateHttpRequest that = (InsertSslCertificateHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.sslCertificateResource, that.getSslCertificateResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + sslCertificateResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertSslPolicyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertSslPolicyHttpRequest.java new file mode 100644 index 000000000000..1bb69f83736c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertSslPolicyHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertSslPolicyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final SslPolicy sslPolicyResource; + private final String userIp; + + private InsertSslPolicyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.sslPolicyResource = null; + this.userIp = null; + } + + private InsertSslPolicyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + SslPolicy sslPolicyResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.sslPolicyResource = sslPolicyResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("sslPolicyResource")) { + return sslPolicyResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public SslPolicy getApiMessageRequestBody() { + return sslPolicyResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public SslPolicy getSslPolicyResource() { + return sslPolicyResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertSslPolicyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertSslPolicyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertSslPolicyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertSslPolicyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private SslPolicy sslPolicyResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertSslPolicyHttpRequest other) { + if (other == InsertSslPolicyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSslPolicyResource() != null) { + this.sslPolicyResource = other.sslPolicyResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertSslPolicyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.sslPolicyResource = source.sslPolicyResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public SslPolicy getSslPolicyResource() { + return sslPolicyResource; + } + + public Builder setSslPolicyResource(SslPolicy sslPolicyResource) { + this.sslPolicyResource = sslPolicyResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertSslPolicyHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertSslPolicyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + sslPolicyResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSslPolicyResource(this.sslPolicyResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertSslPolicyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "sslPolicyResource=" + + sslPolicyResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertSslPolicyHttpRequest) { + InsertSslPolicyHttpRequest that = (InsertSslPolicyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.sslPolicyResource, that.getSslPolicyResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + sslPolicyResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertSubnetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertSubnetworkHttpRequest.java new file mode 100644 index 000000000000..2db72649e1a8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertSubnetworkHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertSubnetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final Subnetwork subnetworkResource; + private final String userIp; + + private InsertSubnetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.subnetworkResource = null; + this.userIp = null; + } + + private InsertSubnetworkHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + Subnetwork subnetworkResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.subnetworkResource = subnetworkResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("subnetworkResource")) { + return subnetworkResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Subnetwork getApiMessageRequestBody() { + return subnetworkResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public Subnetwork getSubnetworkResource() { + return subnetworkResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertSubnetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertSubnetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertSubnetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertSubnetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private Subnetwork subnetworkResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertSubnetworkHttpRequest other) { + if (other == InsertSubnetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSubnetworkResource() != null) { + this.subnetworkResource = other.subnetworkResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertSubnetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.subnetworkResource = source.subnetworkResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Subnetwork getSubnetworkResource() { + return subnetworkResource; + } + + public Builder setSubnetworkResource(Subnetwork subnetworkResource) { + this.subnetworkResource = subnetworkResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertSubnetworkHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertSubnetworkHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + subnetworkResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setSubnetworkResource(this.subnetworkResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertSubnetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "subnetworkResource=" + + subnetworkResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertSubnetworkHttpRequest) { + InsertSubnetworkHttpRequest that = (InsertSubnetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.subnetworkResource, that.getSubnetworkResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + subnetworkResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetHttpProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetHttpProxyHttpRequest.java new file mode 100644 index 000000000000..0954f10a7667 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetHttpProxyHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertTargetHttpProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final TargetHttpProxy targetHttpProxyResource; + private final String userIp; + + private InsertTargetHttpProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.targetHttpProxyResource = null; + this.userIp = null; + } + + private InsertTargetHttpProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + TargetHttpProxy targetHttpProxyResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetHttpProxyResource = targetHttpProxyResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetHttpProxyResource")) { + return targetHttpProxyResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetHttpProxy getApiMessageRequestBody() { + return targetHttpProxyResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetHttpProxy getTargetHttpProxyResource() { + return targetHttpProxyResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertTargetHttpProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertTargetHttpProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertTargetHttpProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertTargetHttpProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private TargetHttpProxy targetHttpProxyResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertTargetHttpProxyHttpRequest other) { + if (other == InsertTargetHttpProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetHttpProxyResource() != null) { + this.targetHttpProxyResource = other.targetHttpProxyResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertTargetHttpProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetHttpProxyResource = source.targetHttpProxyResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetHttpProxy getTargetHttpProxyResource() { + return targetHttpProxyResource; + } + + public Builder setTargetHttpProxyResource(TargetHttpProxy targetHttpProxyResource) { + this.targetHttpProxyResource = targetHttpProxyResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertTargetHttpProxyHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertTargetHttpProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + targetHttpProxyResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetHttpProxyResource(this.targetHttpProxyResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertTargetHttpProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetHttpProxyResource=" + + targetHttpProxyResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertTargetHttpProxyHttpRequest) { + InsertTargetHttpProxyHttpRequest that = (InsertTargetHttpProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetHttpProxyResource, that.getTargetHttpProxyResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + targetHttpProxyResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetHttpsProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetHttpsProxyHttpRequest.java new file mode 100644 index 000000000000..af8b42abc271 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetHttpsProxyHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertTargetHttpsProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final TargetHttpsProxy targetHttpsProxyResource; + private final String userIp; + + private InsertTargetHttpsProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.targetHttpsProxyResource = null; + this.userIp = null; + } + + private InsertTargetHttpsProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + TargetHttpsProxy targetHttpsProxyResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetHttpsProxyResource = targetHttpsProxyResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetHttpsProxyResource")) { + return targetHttpsProxyResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetHttpsProxy getApiMessageRequestBody() { + return targetHttpsProxyResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetHttpsProxy getTargetHttpsProxyResource() { + return targetHttpsProxyResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertTargetHttpsProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertTargetHttpsProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertTargetHttpsProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertTargetHttpsProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private TargetHttpsProxy targetHttpsProxyResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertTargetHttpsProxyHttpRequest other) { + if (other == InsertTargetHttpsProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetHttpsProxyResource() != null) { + this.targetHttpsProxyResource = other.targetHttpsProxyResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertTargetHttpsProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetHttpsProxyResource = source.targetHttpsProxyResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetHttpsProxy getTargetHttpsProxyResource() { + return targetHttpsProxyResource; + } + + public Builder setTargetHttpsProxyResource(TargetHttpsProxy targetHttpsProxyResource) { + this.targetHttpsProxyResource = targetHttpsProxyResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertTargetHttpsProxyHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertTargetHttpsProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + targetHttpsProxyResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetHttpsProxyResource(this.targetHttpsProxyResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertTargetHttpsProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetHttpsProxyResource=" + + targetHttpsProxyResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertTargetHttpsProxyHttpRequest) { + InsertTargetHttpsProxyHttpRequest that = (InsertTargetHttpsProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetHttpsProxyResource, that.getTargetHttpsProxyResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + targetHttpsProxyResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetInstanceHttpRequest.java new file mode 100644 index 000000000000..c6b44391a95e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetInstanceHttpRequest.java @@ -0,0 +1,444 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertTargetInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final TargetInstance targetInstanceResource; + private final String userIp; + private final String zone; + + private InsertTargetInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetInstanceResource = null; + this.userIp = null; + this.zone = null; + } + + private InsertTargetInstanceHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + TargetInstance targetInstanceResource, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetInstanceResource = targetInstanceResource; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetInstanceResource")) { + return targetInstanceResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public TargetInstance getApiMessageRequestBody() { + return targetInstanceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetInstance getTargetInstanceResource() { + return targetInstanceResource; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertTargetInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertTargetInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertTargetInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertTargetInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private TargetInstance targetInstanceResource; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(InsertTargetInstanceHttpRequest other) { + if (other == InsertTargetInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetInstanceResource() != null) { + this.targetInstanceResource = other.targetInstanceResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(InsertTargetInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetInstanceResource = source.targetInstanceResource; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetInstance getTargetInstanceResource() { + return targetInstanceResource; + } + + public Builder setTargetInstanceResource(TargetInstance targetInstanceResource) { + this.targetInstanceResource = targetInstanceResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public InsertTargetInstanceHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertTargetInstanceHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetInstanceResource, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetInstanceResource(this.targetInstanceResource); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertTargetInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetInstanceResource=" + + targetInstanceResource + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertTargetInstanceHttpRequest) { + InsertTargetInstanceHttpRequest that = (InsertTargetInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetInstanceResource, that.getTargetInstanceResource()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetInstanceResource, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetPoolHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetPoolHttpRequest.java new file mode 100644 index 000000000000..42353932d5b9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetPoolHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertTargetPoolHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final TargetPool targetPoolResource; + private final String userIp; + + private InsertTargetPoolHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.targetPoolResource = null; + this.userIp = null; + } + + private InsertTargetPoolHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + TargetPool targetPoolResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.targetPoolResource = targetPoolResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetPoolResource")) { + return targetPoolResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetPool getApiMessageRequestBody() { + return targetPoolResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public TargetPool getTargetPoolResource() { + return targetPoolResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertTargetPoolHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertTargetPoolHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertTargetPoolHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertTargetPoolHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private TargetPool targetPoolResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertTargetPoolHttpRequest other) { + if (other == InsertTargetPoolHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetPoolResource() != null) { + this.targetPoolResource = other.targetPoolResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertTargetPoolHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.targetPoolResource = source.targetPoolResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetPool getTargetPoolResource() { + return targetPoolResource; + } + + public Builder setTargetPoolResource(TargetPool targetPoolResource) { + this.targetPoolResource = targetPoolResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertTargetPoolHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertTargetPoolHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + targetPoolResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetPoolResource(this.targetPoolResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertTargetPoolHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "targetPoolResource=" + + targetPoolResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertTargetPoolHttpRequest) { + InsertTargetPoolHttpRequest that = (InsertTargetPoolHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetPoolResource, that.getTargetPoolResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + targetPoolResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetSslProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetSslProxyHttpRequest.java new file mode 100644 index 000000000000..8edac35f2e7d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetSslProxyHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertTargetSslProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final TargetSslProxy targetSslProxyResource; + private final String userIp; + + private InsertTargetSslProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.targetSslProxyResource = null; + this.userIp = null; + } + + private InsertTargetSslProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + TargetSslProxy targetSslProxyResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetSslProxyResource = targetSslProxyResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetSslProxyResource")) { + return targetSslProxyResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetSslProxy getApiMessageRequestBody() { + return targetSslProxyResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetSslProxy getTargetSslProxyResource() { + return targetSslProxyResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertTargetSslProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertTargetSslProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertTargetSslProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertTargetSslProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private TargetSslProxy targetSslProxyResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertTargetSslProxyHttpRequest other) { + if (other == InsertTargetSslProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetSslProxyResource() != null) { + this.targetSslProxyResource = other.targetSslProxyResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertTargetSslProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetSslProxyResource = source.targetSslProxyResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetSslProxy getTargetSslProxyResource() { + return targetSslProxyResource; + } + + public Builder setTargetSslProxyResource(TargetSslProxy targetSslProxyResource) { + this.targetSslProxyResource = targetSslProxyResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertTargetSslProxyHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertTargetSslProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + targetSslProxyResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetSslProxyResource(this.targetSslProxyResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertTargetSslProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetSslProxyResource=" + + targetSslProxyResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertTargetSslProxyHttpRequest) { + InsertTargetSslProxyHttpRequest that = (InsertTargetSslProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetSslProxyResource, that.getTargetSslProxyResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + targetSslProxyResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetTcpProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetTcpProxyHttpRequest.java new file mode 100644 index 000000000000..c77a843b7fa4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetTcpProxyHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertTargetTcpProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final TargetTcpProxy targetTcpProxyResource; + private final String userIp; + + private InsertTargetTcpProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.targetTcpProxyResource = null; + this.userIp = null; + } + + private InsertTargetTcpProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + TargetTcpProxy targetTcpProxyResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetTcpProxyResource = targetTcpProxyResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetTcpProxyResource")) { + return targetTcpProxyResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetTcpProxy getApiMessageRequestBody() { + return targetTcpProxyResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetTcpProxy getTargetTcpProxyResource() { + return targetTcpProxyResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertTargetTcpProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertTargetTcpProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertTargetTcpProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertTargetTcpProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private TargetTcpProxy targetTcpProxyResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertTargetTcpProxyHttpRequest other) { + if (other == InsertTargetTcpProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetTcpProxyResource() != null) { + this.targetTcpProxyResource = other.targetTcpProxyResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertTargetTcpProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetTcpProxyResource = source.targetTcpProxyResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetTcpProxy getTargetTcpProxyResource() { + return targetTcpProxyResource; + } + + public Builder setTargetTcpProxyResource(TargetTcpProxy targetTcpProxyResource) { + this.targetTcpProxyResource = targetTcpProxyResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertTargetTcpProxyHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertTargetTcpProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + targetTcpProxyResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetTcpProxyResource(this.targetTcpProxyResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertTargetTcpProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetTcpProxyResource=" + + targetTcpProxyResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertTargetTcpProxyHttpRequest) { + InsertTargetTcpProxyHttpRequest that = (InsertTargetTcpProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetTcpProxyResource, that.getTargetTcpProxyResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + targetTcpProxyResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetVpnGatewayHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetVpnGatewayHttpRequest.java new file mode 100644 index 000000000000..9ebec84e2861 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetVpnGatewayHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertTargetVpnGatewayHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final TargetVpnGateway targetVpnGatewayResource; + private final String userIp; + + private InsertTargetVpnGatewayHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.targetVpnGatewayResource = null; + this.userIp = null; + } + + private InsertTargetVpnGatewayHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + TargetVpnGateway targetVpnGatewayResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.targetVpnGatewayResource = targetVpnGatewayResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetVpnGatewayResource")) { + return targetVpnGatewayResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetVpnGateway getApiMessageRequestBody() { + return targetVpnGatewayResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public TargetVpnGateway getTargetVpnGatewayResource() { + return targetVpnGatewayResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertTargetVpnGatewayHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertTargetVpnGatewayHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertTargetVpnGatewayHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertTargetVpnGatewayHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private TargetVpnGateway targetVpnGatewayResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertTargetVpnGatewayHttpRequest other) { + if (other == InsertTargetVpnGatewayHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetVpnGatewayResource() != null) { + this.targetVpnGatewayResource = other.targetVpnGatewayResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertTargetVpnGatewayHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.targetVpnGatewayResource = source.targetVpnGatewayResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetVpnGateway getTargetVpnGatewayResource() { + return targetVpnGatewayResource; + } + + public Builder setTargetVpnGatewayResource(TargetVpnGateway targetVpnGatewayResource) { + this.targetVpnGatewayResource = targetVpnGatewayResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertTargetVpnGatewayHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertTargetVpnGatewayHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + targetVpnGatewayResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetVpnGatewayResource(this.targetVpnGatewayResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertTargetVpnGatewayHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "targetVpnGatewayResource=" + + targetVpnGatewayResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertTargetVpnGatewayHttpRequest) { + InsertTargetVpnGatewayHttpRequest that = (InsertTargetVpnGatewayHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetVpnGatewayResource, that.getTargetVpnGatewayResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + targetVpnGatewayResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertUrlMapHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertUrlMapHttpRequest.java new file mode 100644 index 000000000000..0a4fd9b8895f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertUrlMapHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertUrlMapHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final UrlMap urlMapResource; + private final String userIp; + + private InsertUrlMapHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.urlMapResource = null; + this.userIp = null; + } + + private InsertUrlMapHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + UrlMap urlMapResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.urlMapResource = urlMapResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("urlMapResource")) { + return urlMapResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public UrlMap getApiMessageRequestBody() { + return urlMapResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public UrlMap getUrlMapResource() { + return urlMapResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertUrlMapHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertUrlMapHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertUrlMapHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertUrlMapHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private UrlMap urlMapResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InsertUrlMapHttpRequest other) { + if (other == InsertUrlMapHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUrlMapResource() != null) { + this.urlMapResource = other.urlMapResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InsertUrlMapHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.urlMapResource = source.urlMapResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public UrlMap getUrlMapResource() { + return urlMapResource; + } + + public Builder setUrlMapResource(UrlMap urlMapResource) { + this.urlMapResource = urlMapResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InsertUrlMapHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertUrlMapHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + urlMapResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUrlMapResource(this.urlMapResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertUrlMapHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "urlMapResource=" + + urlMapResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertUrlMapHttpRequest) { + InsertUrlMapHttpRequest that = (InsertUrlMapHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.urlMapResource, that.getUrlMapResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + urlMapResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertVpnTunnelHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertVpnTunnelHttpRequest.java new file mode 100644 index 000000000000..d99f43f1896e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertVpnTunnelHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InsertVpnTunnelHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final String userIp; + private final VpnTunnel vpnTunnelResource; + + private InsertVpnTunnelHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.userIp = null; + this.vpnTunnelResource = null; + } + + private InsertVpnTunnelHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + String userIp, + VpnTunnel vpnTunnelResource) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.userIp = userIp; + this.vpnTunnelResource = vpnTunnelResource; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("vpnTunnelResource")) { + return vpnTunnelResource; + } + return null; + } + + @Nullable + @Override + public VpnTunnel getApiMessageRequestBody() { + return vpnTunnelResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public VpnTunnel getVpnTunnelResource() { + return vpnTunnelResource; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InsertVpnTunnelHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InsertVpnTunnelHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InsertVpnTunnelHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InsertVpnTunnelHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private String userIp; + private VpnTunnel vpnTunnelResource; + + Builder() {} + + public Builder mergeFrom(InsertVpnTunnelHttpRequest other) { + if (other == InsertVpnTunnelHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getVpnTunnelResource() != null) { + this.vpnTunnelResource = other.vpnTunnelResource; + } + return this; + } + + Builder(InsertVpnTunnelHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.userIp = source.userIp; + this.vpnTunnelResource = source.vpnTunnelResource; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public VpnTunnel getVpnTunnelResource() { + return vpnTunnelResource; + } + + public Builder setVpnTunnelResource(VpnTunnel vpnTunnelResource) { + this.vpnTunnelResource = vpnTunnelResource; + return this; + } + + public InsertVpnTunnelHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InsertVpnTunnelHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp, + vpnTunnelResource); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + newBuilder.setVpnTunnelResource(this.vpnTunnelResource); + return newBuilder; + } + } + + @Override + public String toString() { + return "InsertVpnTunnelHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + ", " + + "vpnTunnelResource=" + + vpnTunnelResource + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InsertVpnTunnelHttpRequest) { + InsertVpnTunnelHttpRequest that = (InsertVpnTunnelHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.vpnTunnelResource, that.getVpnTunnelResource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp, + vpnTunnelResource); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Instance.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Instance.java new file mode 100644 index 000000000000..31f30d76b42c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Instance.java @@ -0,0 +1,919 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Instance implements ApiMessage { + private final Boolean canIpForward; + private final String cpuPlatform; + private final String creationTimestamp; + private final Boolean deletionProtection; + private final String description; + private final List disks; + private final List guestAccelerators; + private final String id; + private final String kind; + private final String labelFingerprint; + private final Map labels; + private final String machineType; + private final Metadata metadata; + private final String minCpuPlatform; + private final String name; + private final List networkInterfaces; + private final Scheduling scheduling; + private final String selfLink; + private final List serviceAccounts; + private final Boolean startRestricted; + private final String status; + private final String statusMessage; + private final Tags tags; + private final String zone; + + private Instance() { + this.canIpForward = null; + this.cpuPlatform = null; + this.creationTimestamp = null; + this.deletionProtection = null; + this.description = null; + this.disks = null; + this.guestAccelerators = null; + this.id = null; + this.kind = null; + this.labelFingerprint = null; + this.labels = null; + this.machineType = null; + this.metadata = null; + this.minCpuPlatform = null; + this.name = null; + this.networkInterfaces = null; + this.scheduling = null; + this.selfLink = null; + this.serviceAccounts = null; + this.startRestricted = null; + this.status = null; + this.statusMessage = null; + this.tags = null; + this.zone = null; + } + + private Instance( + Boolean canIpForward, + String cpuPlatform, + String creationTimestamp, + Boolean deletionProtection, + String description, + List disks, + List guestAccelerators, + String id, + String kind, + String labelFingerprint, + Map labels, + String machineType, + Metadata metadata, + String minCpuPlatform, + String name, + List networkInterfaces, + Scheduling scheduling, + String selfLink, + List serviceAccounts, + Boolean startRestricted, + String status, + String statusMessage, + Tags tags, + String zone) { + this.canIpForward = canIpForward; + this.cpuPlatform = cpuPlatform; + this.creationTimestamp = creationTimestamp; + this.deletionProtection = deletionProtection; + this.description = description; + this.disks = disks; + this.guestAccelerators = guestAccelerators; + this.id = id; + this.kind = kind; + this.labelFingerprint = labelFingerprint; + this.labels = labels; + this.machineType = machineType; + this.metadata = metadata; + this.minCpuPlatform = minCpuPlatform; + this.name = name; + this.networkInterfaces = networkInterfaces; + this.scheduling = scheduling; + this.selfLink = selfLink; + this.serviceAccounts = serviceAccounts; + this.startRestricted = startRestricted; + this.status = status; + this.statusMessage = statusMessage; + this.tags = tags; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("canIpForward")) { + return canIpForward; + } + if (fieldName.equals("cpuPlatform")) { + return cpuPlatform; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("deletionProtection")) { + return deletionProtection; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("disks")) { + return disks; + } + if (fieldName.equals("guestAccelerators")) { + return guestAccelerators; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("labelFingerprint")) { + return labelFingerprint; + } + if (fieldName.equals("labels")) { + return labels; + } + if (fieldName.equals("machineType")) { + return machineType; + } + if (fieldName.equals("metadata")) { + return metadata; + } + if (fieldName.equals("minCpuPlatform")) { + return minCpuPlatform; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("networkInterfaces")) { + return networkInterfaces; + } + if (fieldName.equals("scheduling")) { + return scheduling; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("serviceAccounts")) { + return serviceAccounts; + } + if (fieldName.equals("startRestricted")) { + return startRestricted; + } + if (fieldName.equals("status")) { + return status; + } + if (fieldName.equals("statusMessage")) { + return statusMessage; + } + if (fieldName.equals("tags")) { + return tags; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getCanIpForward() { + return canIpForward; + } + + public String getCpuPlatform() { + return cpuPlatform; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Boolean getDeletionProtection() { + return deletionProtection; + } + + public String getDescription() { + return description; + } + + public List getDisksList() { + return disks; + } + + public List getGuestAcceleratorsList() { + return guestAccelerators; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Map getLabelsMap() { + return labels; + } + + public String getMachineType() { + return machineType; + } + + public Metadata getMetadata() { + return metadata; + } + + public String getMinCpuPlatform() { + return minCpuPlatform; + } + + public String getName() { + return name; + } + + public List getNetworkInterfacesList() { + return networkInterfaces; + } + + public Scheduling getScheduling() { + return scheduling; + } + + public String getSelfLink() { + return selfLink; + } + + public List getServiceAccountsList() { + return serviceAccounts; + } + + public Boolean getStartRestricted() { + return startRestricted; + } + + public String getStatus() { + return status; + } + + public String getStatusMessage() { + return statusMessage; + } + + public Tags getTags() { + return tags; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Instance prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Instance getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Instance DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Instance(); + } + + public static class Builder { + private Boolean canIpForward; + private String cpuPlatform; + private String creationTimestamp; + private Boolean deletionProtection; + private String description; + private List disks; + private List guestAccelerators; + private String id; + private String kind; + private String labelFingerprint; + private Map labels; + private String machineType; + private Metadata metadata; + private String minCpuPlatform; + private String name; + private List networkInterfaces; + private Scheduling scheduling; + private String selfLink; + private List serviceAccounts; + private Boolean startRestricted; + private String status; + private String statusMessage; + private Tags tags; + private String zone; + + Builder() {} + + public Builder mergeFrom(Instance other) { + if (other == Instance.getDefaultInstance()) return this; + if (other.getCanIpForward() != null) { + this.canIpForward = other.canIpForward; + } + if (other.getCpuPlatform() != null) { + this.cpuPlatform = other.cpuPlatform; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDeletionProtection() != null) { + this.deletionProtection = other.deletionProtection; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getDisksList() != null) { + this.disks = other.disks; + } + if (other.getGuestAcceleratorsList() != null) { + this.guestAccelerators = other.guestAccelerators; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getLabelFingerprint() != null) { + this.labelFingerprint = other.labelFingerprint; + } + if (other.getLabelsMap() != null) { + this.labels = other.labels; + } + if (other.getMachineType() != null) { + this.machineType = other.machineType; + } + if (other.getMetadata() != null) { + this.metadata = other.metadata; + } + if (other.getMinCpuPlatform() != null) { + this.minCpuPlatform = other.minCpuPlatform; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNetworkInterfacesList() != null) { + this.networkInterfaces = other.networkInterfaces; + } + if (other.getScheduling() != null) { + this.scheduling = other.scheduling; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getServiceAccountsList() != null) { + this.serviceAccounts = other.serviceAccounts; + } + if (other.getStartRestricted() != null) { + this.startRestricted = other.startRestricted; + } + if (other.getStatus() != null) { + this.status = other.status; + } + if (other.getStatusMessage() != null) { + this.statusMessage = other.statusMessage; + } + if (other.getTags() != null) { + this.tags = other.tags; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(Instance source) { + this.canIpForward = source.canIpForward; + this.cpuPlatform = source.cpuPlatform; + this.creationTimestamp = source.creationTimestamp; + this.deletionProtection = source.deletionProtection; + this.description = source.description; + this.disks = source.disks; + this.guestAccelerators = source.guestAccelerators; + this.id = source.id; + this.kind = source.kind; + this.labelFingerprint = source.labelFingerprint; + this.labels = source.labels; + this.machineType = source.machineType; + this.metadata = source.metadata; + this.minCpuPlatform = source.minCpuPlatform; + this.name = source.name; + this.networkInterfaces = source.networkInterfaces; + this.scheduling = source.scheduling; + this.selfLink = source.selfLink; + this.serviceAccounts = source.serviceAccounts; + this.startRestricted = source.startRestricted; + this.status = source.status; + this.statusMessage = source.statusMessage; + this.tags = source.tags; + this.zone = source.zone; + } + + public Boolean getCanIpForward() { + return canIpForward; + } + + public Builder setCanIpForward(Boolean canIpForward) { + this.canIpForward = canIpForward; + return this; + } + + public String getCpuPlatform() { + return cpuPlatform; + } + + public Builder setCpuPlatform(String cpuPlatform) { + this.cpuPlatform = cpuPlatform; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public Boolean getDeletionProtection() { + return deletionProtection; + } + + public Builder setDeletionProtection(Boolean deletionProtection) { + this.deletionProtection = deletionProtection; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public List getDisksList() { + return disks; + } + + public Builder addAllDisks(List disks) { + if (this.disks == null) { + this.disks = new ArrayList<>(disks.size()); + } + this.disks.addAll(disks); + return this; + } + + public Builder addDisks(AttachedDisk disks) { + this.disks.add(disks); + return this; + } + + public List getGuestAcceleratorsList() { + return guestAccelerators; + } + + public Builder addAllGuestAccelerators(List guestAccelerators) { + if (this.guestAccelerators == null) { + this.guestAccelerators = new ArrayList<>(guestAccelerators.size()); + } + this.guestAccelerators.addAll(guestAccelerators); + return this; + } + + public Builder addGuestAccelerators(AcceleratorConfig guestAccelerators) { + this.guestAccelerators.add(guestAccelerators); + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Builder setLabelFingerprint(String labelFingerprint) { + this.labelFingerprint = labelFingerprint; + return this; + } + + public Map getLabelsMap() { + return labels; + } + + public Builder putAllLabels(Map labels) { + this.labels = labels; + return this; + } + + public String getMachineType() { + return machineType; + } + + public Builder setMachineType(String machineType) { + this.machineType = machineType; + return this; + } + + public Metadata getMetadata() { + return metadata; + } + + public Builder setMetadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + public String getMinCpuPlatform() { + return minCpuPlatform; + } + + public Builder setMinCpuPlatform(String minCpuPlatform) { + this.minCpuPlatform = minCpuPlatform; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public List getNetworkInterfacesList() { + return networkInterfaces; + } + + public Builder addAllNetworkInterfaces(List networkInterfaces) { + if (this.networkInterfaces == null) { + this.networkInterfaces = new ArrayList<>(networkInterfaces.size()); + } + this.networkInterfaces.addAll(networkInterfaces); + return this; + } + + public Builder addNetworkInterfaces(NetworkInterface networkInterfaces) { + this.networkInterfaces.add(networkInterfaces); + return this; + } + + public Scheduling getScheduling() { + return scheduling; + } + + public Builder setScheduling(Scheduling scheduling) { + this.scheduling = scheduling; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public List getServiceAccountsList() { + return serviceAccounts; + } + + public Builder addAllServiceAccounts(List serviceAccounts) { + if (this.serviceAccounts == null) { + this.serviceAccounts = new ArrayList<>(serviceAccounts.size()); + } + this.serviceAccounts.addAll(serviceAccounts); + return this; + } + + public Builder addServiceAccounts(ServiceAccount serviceAccounts) { + this.serviceAccounts.add(serviceAccounts); + return this; + } + + public Boolean getStartRestricted() { + return startRestricted; + } + + public Builder setStartRestricted(Boolean startRestricted) { + this.startRestricted = startRestricted; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public String getStatusMessage() { + return statusMessage; + } + + public Builder setStatusMessage(String statusMessage) { + this.statusMessage = statusMessage; + return this; + } + + public Tags getTags() { + return tags; + } + + public Builder setTags(Tags tags) { + this.tags = tags; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public Instance build() { + + return new Instance( + canIpForward, + cpuPlatform, + creationTimestamp, + deletionProtection, + description, + disks, + guestAccelerators, + id, + kind, + labelFingerprint, + labels, + machineType, + metadata, + minCpuPlatform, + name, + networkInterfaces, + scheduling, + selfLink, + serviceAccounts, + startRestricted, + status, + statusMessage, + tags, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCanIpForward(this.canIpForward); + newBuilder.setCpuPlatform(this.cpuPlatform); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDeletionProtection(this.deletionProtection); + newBuilder.setDescription(this.description); + newBuilder.addAllDisks(this.disks); + newBuilder.addAllGuestAccelerators(this.guestAccelerators); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setLabelFingerprint(this.labelFingerprint); + newBuilder.putAllLabels(this.labels); + newBuilder.setMachineType(this.machineType); + newBuilder.setMetadata(this.metadata); + newBuilder.setMinCpuPlatform(this.minCpuPlatform); + newBuilder.setName(this.name); + newBuilder.addAllNetworkInterfaces(this.networkInterfaces); + newBuilder.setScheduling(this.scheduling); + newBuilder.setSelfLink(this.selfLink); + newBuilder.addAllServiceAccounts(this.serviceAccounts); + newBuilder.setStartRestricted(this.startRestricted); + newBuilder.setStatus(this.status); + newBuilder.setStatusMessage(this.statusMessage); + newBuilder.setTags(this.tags); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "Instance{" + + "canIpForward=" + + canIpForward + + ", " + + "cpuPlatform=" + + cpuPlatform + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "deletionProtection=" + + deletionProtection + + ", " + + "description=" + + description + + ", " + + "disks=" + + disks + + ", " + + "guestAccelerators=" + + guestAccelerators + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "labelFingerprint=" + + labelFingerprint + + ", " + + "labels=" + + labels + + ", " + + "machineType=" + + machineType + + ", " + + "metadata=" + + metadata + + ", " + + "minCpuPlatform=" + + minCpuPlatform + + ", " + + "name=" + + name + + ", " + + "networkInterfaces=" + + networkInterfaces + + ", " + + "scheduling=" + + scheduling + + ", " + + "selfLink=" + + selfLink + + ", " + + "serviceAccounts=" + + serviceAccounts + + ", " + + "startRestricted=" + + startRestricted + + ", " + + "status=" + + status + + ", " + + "statusMessage=" + + statusMessage + + ", " + + "tags=" + + tags + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Instance) { + Instance that = (Instance) o; + return Objects.equals(this.canIpForward, that.getCanIpForward()) + && Objects.equals(this.cpuPlatform, that.getCpuPlatform()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.deletionProtection, that.getDeletionProtection()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.disks, that.getDisksList()) + && Objects.equals(this.guestAccelerators, that.getGuestAcceleratorsList()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.labelFingerprint, that.getLabelFingerprint()) + && Objects.equals(this.labels, that.getLabelsMap()) + && Objects.equals(this.machineType, that.getMachineType()) + && Objects.equals(this.metadata, that.getMetadata()) + && Objects.equals(this.minCpuPlatform, that.getMinCpuPlatform()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.networkInterfaces, that.getNetworkInterfacesList()) + && Objects.equals(this.scheduling, that.getScheduling()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.serviceAccounts, that.getServiceAccountsList()) + && Objects.equals(this.startRestricted, that.getStartRestricted()) + && Objects.equals(this.status, that.getStatus()) + && Objects.equals(this.statusMessage, that.getStatusMessage()) + && Objects.equals(this.tags, that.getTags()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + canIpForward, + cpuPlatform, + creationTimestamp, + deletionProtection, + description, + disks, + guestAccelerators, + id, + kind, + labelFingerprint, + labels, + machineType, + metadata, + minCpuPlatform, + name, + networkInterfaces, + scheduling, + selfLink, + serviceAccounts, + startRestricted, + status, + statusMessage, + tags, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceAggregatedList.java new file mode 100644 index 000000000000..520c4fd90d89 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InstanceAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InstanceAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstanceAggregatedList other) { + if (other == InstanceAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstanceAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstanceAggregatedList build() { + + return new InstanceAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceAggregatedList) { + InstanceAggregatedList that = (InstanceAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceClient.java new file mode 100644 index 000000000000..d3546fa39ed4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceClient.java @@ -0,0 +1,3599 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.InstanceStub; +import com.google.cloud.compute.v1.stub.InstanceStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (InstanceClient instanceClient = InstanceClient.create()) {
+ *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+ *   String networkInterface = "";
+ *   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
+ *   Operation response = instanceClient.addAccessConfigInstance(instance, networkInterface, accessConfigResource);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the instanceClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of InstanceSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * InstanceSettings instanceSettings =
+ *     InstanceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * InstanceClient instanceClient =
+ *     InstanceClient.create(instanceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * InstanceSettings instanceSettings =
+ *     InstanceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * InstanceClient instanceClient =
+ *     InstanceClient.create(instanceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceClient implements BackgroundResource { + private final InstanceSettings settings; + private final InstanceStub stub; + + /** Constructs an instance of InstanceClient with default settings. */ + public static final InstanceClient create() throws IOException { + return create(InstanceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of InstanceClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final InstanceClient create(InstanceSettings settings) throws IOException { + return new InstanceClient(settings); + } + + /** + * Constructs an instance of InstanceClient, using the given stub for making calls. This is for + * advanced usage - prefer to use InstanceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final InstanceClient create(InstanceStub stub) { + return new InstanceClient(stub); + } + + /** + * Constructs an instance of InstanceClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected InstanceClient(InstanceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((InstanceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected InstanceClient(InstanceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final InstanceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InstanceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds an access config to an instance's network interface. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
+   *   Operation response = instanceClient.addAccessConfigInstance(instance, networkInterface, accessConfigResource);
+   * }
+   * 
+ * + * @param instance The instance name for this request. + * @param networkInterface The name of the network interface to add to this instance. + * @param accessConfigResource An access configuration attached to an instance's network + * interface. Only one access config per instance is supported. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addAccessConfigInstance( + ProjectZoneInstanceName instance, + String networkInterface, + AccessConfig accessConfigResource) { + + AddAccessConfigInstanceHttpRequest request = + AddAccessConfigInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setNetworkInterface(networkInterface) + .setAccessConfigResource(accessConfigResource) + .build(); + return addAccessConfigInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds an access config to an instance's network interface. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
+   *   Operation response = instanceClient.addAccessConfigInstance(instance.toString(), networkInterface, accessConfigResource);
+   * }
+   * 
+ * + * @param instance The instance name for this request. + * @param networkInterface The name of the network interface to add to this instance. + * @param accessConfigResource An access configuration attached to an instance's network + * interface. Only one access config per instance is supported. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addAccessConfigInstance( + String instance, String networkInterface, AccessConfig accessConfigResource) { + + AddAccessConfigInstanceHttpRequest request = + AddAccessConfigInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setNetworkInterface(networkInterface) + .setAccessConfigResource(accessConfigResource) + .build(); + return addAccessConfigInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds an access config to an instance's network interface. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
+   *   AddAccessConfigInstanceHttpRequest request = AddAccessConfigInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setNetworkInterface(networkInterface)
+   *     .setAccessConfigResource(accessConfigResource)
+   *     .build();
+   *   Operation response = instanceClient.addAccessConfigInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addAccessConfigInstance(AddAccessConfigInstanceHttpRequest request) { + return addAccessConfigInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds an access config to an instance's network interface. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
+   *   AddAccessConfigInstanceHttpRequest request = AddAccessConfigInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setNetworkInterface(networkInterface)
+   *     .setAccessConfigResource(accessConfigResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.addAccessConfigInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + addAccessConfigInstanceCallable() { + return stub.addAccessConfigInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves aggregated list of instances. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InstancesScopedList element : instanceClient.aggregatedListInstances(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInstancesPagedResponse aggregatedListInstances(ProjectName project) { + AggregatedListInstancesHttpRequest request = + AggregatedListInstancesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves aggregated list of instances. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InstancesScopedList element : instanceClient.aggregatedListInstances(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInstancesPagedResponse aggregatedListInstances(String project) { + AggregatedListInstancesHttpRequest request = + AggregatedListInstancesHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves aggregated list of instances. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInstancesHttpRequest request = AggregatedListInstancesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (InstancesScopedList element : instanceClient.aggregatedListInstances(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInstancesPagedResponse aggregatedListInstances( + AggregatedListInstancesHttpRequest request) { + return aggregatedListInstancesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves aggregated list of instances. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInstancesHttpRequest request = AggregatedListInstancesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListInstancesPagedResponse> future = instanceClient.aggregatedListInstancesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InstancesScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListInstancesHttpRequest, AggregatedListInstancesPagedResponse> + aggregatedListInstancesPagedCallable() { + return stub.aggregatedListInstancesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves aggregated list of instances. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInstancesHttpRequest request = AggregatedListInstancesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     InstanceAggregatedList response = instanceClient.aggregatedListInstancesCallable().call(request);
+   *     for (InstancesScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListInstancesCallable() { + return stub.aggregatedListInstancesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Attaches an existing Disk resource to an instance. You must first create the disk before you + * can attach it. It is not possible to create and attach a disk at the same time. For more + * information, read Adding a persistent disk to your instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Boolean forceAttach = false;
+   *   AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build();
+   *   Operation response = instanceClient.attachDiskInstance(instance, forceAttach, attachedDiskResource);
+   * }
+   * 
+ * + * @param instance The instance name for this request. + * @param forceAttach Whether to force attach the disk even if it's currently attached to another + * instance. This is only available for regional disks. + * @param attachedDiskResource An instance-attached disk resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation attachDiskInstance( + ProjectZoneInstanceName instance, Boolean forceAttach, AttachedDisk attachedDiskResource) { + + AttachDiskInstanceHttpRequest request = + AttachDiskInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setForceAttach(forceAttach) + .setAttachedDiskResource(attachedDiskResource) + .build(); + return attachDiskInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Attaches an existing Disk resource to an instance. You must first create the disk before you + * can attach it. It is not possible to create and attach a disk at the same time. For more + * information, read Adding a persistent disk to your instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Boolean forceAttach = false;
+   *   AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build();
+   *   Operation response = instanceClient.attachDiskInstance(instance.toString(), forceAttach, attachedDiskResource);
+   * }
+   * 
+ * + * @param instance The instance name for this request. + * @param forceAttach Whether to force attach the disk even if it's currently attached to another + * instance. This is only available for regional disks. + * @param attachedDiskResource An instance-attached disk resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation attachDiskInstance( + String instance, Boolean forceAttach, AttachedDisk attachedDiskResource) { + + AttachDiskInstanceHttpRequest request = + AttachDiskInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setForceAttach(forceAttach) + .setAttachedDiskResource(attachedDiskResource) + .build(); + return attachDiskInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Attaches an existing Disk resource to an instance. You must first create the disk before you + * can attach it. It is not possible to create and attach a disk at the same time. For more + * information, read Adding a persistent disk to your instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Boolean forceAttach = false;
+   *   AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build();
+   *   AttachDiskInstanceHttpRequest request = AttachDiskInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setForceAttach(forceAttach)
+   *     .setAttachedDiskResource(attachedDiskResource)
+   *     .build();
+   *   Operation response = instanceClient.attachDiskInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation attachDiskInstance(AttachDiskInstanceHttpRequest request) { + return attachDiskInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Attaches an existing Disk resource to an instance. You must first create the disk before you + * can attach it. It is not possible to create and attach a disk at the same time. For more + * information, read Adding a persistent disk to your instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Boolean forceAttach = false;
+   *   AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build();
+   *   AttachDiskInstanceHttpRequest request = AttachDiskInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setForceAttach(forceAttach)
+   *     .setAttachedDiskResource(attachedDiskResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.attachDiskInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + attachDiskInstanceCallable() { + return stub.attachDiskInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Instance resource. For more information, see Stopping or Deleting an + * Instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Operation response = instanceClient.deleteInstance(instance);
+   * }
+   * 
+ * + * @param instance Name of the instance resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstance(ProjectZoneInstanceName instance) { + + DeleteInstanceHttpRequest request = + DeleteInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .build(); + return deleteInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Instance resource. For more information, see Stopping or Deleting an + * Instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Operation response = instanceClient.deleteInstance(instance.toString());
+   * }
+   * 
+ * + * @param instance Name of the instance resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstance(String instance) { + + DeleteInstanceHttpRequest request = + DeleteInstanceHttpRequest.newBuilder().setInstance(instance).build(); + return deleteInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Instance resource. For more information, see Stopping or Deleting an + * Instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   DeleteInstanceHttpRequest request = DeleteInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   Operation response = instanceClient.deleteInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstance(DeleteInstanceHttpRequest request) { + return deleteInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Instance resource. For more information, see Stopping or Deleting an + * Instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   DeleteInstanceHttpRequest request = DeleteInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.deleteInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteInstanceCallable() { + return stub.deleteInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an access config from an instance's network interface. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   String accessConfig = "";
+   *   Operation response = instanceClient.deleteAccessConfigInstance(instance, networkInterface, accessConfig);
+   * }
+   * 
+ * + * @param instance The instance name for this request. + * @param networkInterface The name of the network interface. + * @param accessConfig The name of the access config to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteAccessConfigInstance( + ProjectZoneInstanceName instance, String networkInterface, String accessConfig) { + + DeleteAccessConfigInstanceHttpRequest request = + DeleteAccessConfigInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setNetworkInterface(networkInterface) + .setAccessConfig(accessConfig) + .build(); + return deleteAccessConfigInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an access config from an instance's network interface. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   String accessConfig = "";
+   *   Operation response = instanceClient.deleteAccessConfigInstance(instance.toString(), networkInterface, accessConfig);
+   * }
+   * 
+ * + * @param instance The instance name for this request. + * @param networkInterface The name of the network interface. + * @param accessConfig The name of the access config to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteAccessConfigInstance( + String instance, String networkInterface, String accessConfig) { + + DeleteAccessConfigInstanceHttpRequest request = + DeleteAccessConfigInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setNetworkInterface(networkInterface) + .setAccessConfig(accessConfig) + .build(); + return deleteAccessConfigInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an access config from an instance's network interface. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   String accessConfig = "";
+   *   DeleteAccessConfigInstanceHttpRequest request = DeleteAccessConfigInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setNetworkInterface(networkInterface)
+   *     .setAccessConfig(accessConfig)
+   *     .build();
+   *   Operation response = instanceClient.deleteAccessConfigInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteAccessConfigInstance(DeleteAccessConfigInstanceHttpRequest request) { + return deleteAccessConfigInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an access config from an instance's network interface. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   String accessConfig = "";
+   *   DeleteAccessConfigInstanceHttpRequest request = DeleteAccessConfigInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setNetworkInterface(networkInterface)
+   *     .setAccessConfig(accessConfig)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.deleteAccessConfigInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteAccessConfigInstanceCallable() { + return stub.deleteAccessConfigInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Detaches a disk from an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String deviceName = "";
+   *   Operation response = instanceClient.detachDiskInstance(instance, deviceName);
+   * }
+   * 
+ * + * @param instance Instance name. + * @param deviceName Disk device name to detach. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation detachDiskInstance(ProjectZoneInstanceName instance, String deviceName) { + + DetachDiskInstanceHttpRequest request = + DetachDiskInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setDeviceName(deviceName) + .build(); + return detachDiskInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Detaches a disk from an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String deviceName = "";
+   *   Operation response = instanceClient.detachDiskInstance(instance.toString(), deviceName);
+   * }
+   * 
+ * + * @param instance Instance name. + * @param deviceName Disk device name to detach. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation detachDiskInstance(String instance, String deviceName) { + + DetachDiskInstanceHttpRequest request = + DetachDiskInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setDeviceName(deviceName) + .build(); + return detachDiskInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Detaches a disk from an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String deviceName = "";
+   *   DetachDiskInstanceHttpRequest request = DetachDiskInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setDeviceName(deviceName)
+   *     .build();
+   *   Operation response = instanceClient.detachDiskInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation detachDiskInstance(DetachDiskInstanceHttpRequest request) { + return detachDiskInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Detaches a disk from an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String deviceName = "";
+   *   DetachDiskInstanceHttpRequest request = DetachDiskInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setDeviceName(deviceName)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.detachDiskInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + detachDiskInstanceCallable() { + return stub.detachDiskInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Instance resource. Gets a list of available instances by making a list() + * request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Instance response = instanceClient.getInstance(instance);
+   * }
+   * 
+ * + * @param instance Name of the instance resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Instance getInstance(ProjectZoneInstanceName instance) { + + GetInstanceHttpRequest request = + GetInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .build(); + return getInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Instance resource. Gets a list of available instances by making a list() + * request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Instance response = instanceClient.getInstance(instance.toString());
+   * }
+   * 
+ * + * @param instance Name of the instance resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Instance getInstance(String instance) { + + GetInstanceHttpRequest request = + GetInstanceHttpRequest.newBuilder().setInstance(instance).build(); + return getInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Instance resource. Gets a list of available instances by making a list() + * request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   GetInstanceHttpRequest request = GetInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   Instance response = instanceClient.getInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Instance getInstance(GetInstanceHttpRequest request) { + return getInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Instance resource. Gets a list of available instances by making a list() + * request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   GetInstanceHttpRequest request = GetInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   ApiFuture<Instance> future = instanceClient.getInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Instance response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getInstanceCallable() { + return stub.getInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance's serial port output. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Integer port = 0;
+   *   String start = "";
+   *   SerialPortOutput response = instanceClient.getSerialPortOutputInstance(instance, port, start);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param port Specifies which COM or serial port to retrieve data from. + * @param start Returns output starting from a specific byte position. Use this to page through + * output when the output is too large to return in a single request. For the initial request, + * leave this field unspecified. For subsequent calls, this field should be set to the next + * value returned in the previous call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SerialPortOutput getSerialPortOutputInstance( + ProjectZoneInstanceName instance, Integer port, String start) { + + GetSerialPortOutputInstanceHttpRequest request = + GetSerialPortOutputInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setPort(port) + .setStart(start) + .build(); + return getSerialPortOutputInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance's serial port output. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Integer port = 0;
+   *   String start = "";
+   *   SerialPortOutput response = instanceClient.getSerialPortOutputInstance(instance.toString(), port, start);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param port Specifies which COM or serial port to retrieve data from. + * @param start Returns output starting from a specific byte position. Use this to page through + * output when the output is too large to return in a single request. For the initial request, + * leave this field unspecified. For subsequent calls, this field should be set to the next + * value returned in the previous call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SerialPortOutput getSerialPortOutputInstance( + String instance, Integer port, String start) { + + GetSerialPortOutputInstanceHttpRequest request = + GetSerialPortOutputInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setPort(port) + .setStart(start) + .build(); + return getSerialPortOutputInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance's serial port output. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Integer port = 0;
+   *   String start = "";
+   *   GetSerialPortOutputInstanceHttpRequest request = GetSerialPortOutputInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setPort(port)
+   *     .setStart(start)
+   *     .build();
+   *   SerialPortOutput response = instanceClient.getSerialPortOutputInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SerialPortOutput getSerialPortOutputInstance( + GetSerialPortOutputInstanceHttpRequest request) { + return getSerialPortOutputInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance's serial port output. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Integer port = 0;
+   *   String start = "";
+   *   GetSerialPortOutputInstanceHttpRequest request = GetSerialPortOutputInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setPort(port)
+   *     .setStart(start)
+   *     .build();
+   *   ApiFuture<SerialPortOutput> future = instanceClient.getSerialPortOutputInstanceCallable().futureCall(request);
+   *   // Do something
+   *   SerialPortOutput response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getSerialPortOutputInstanceCallable() { + return stub.getSerialPortOutputInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Instance instanceResource = Instance.newBuilder().build();
+   *   Operation response = instanceClient.insertInstance(zone, instanceResource);
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @param instanceResource An Instance resource. (== resource_for beta.instances ==) (== + * resource_for v1.instances ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstance(ProjectZoneName zone, Instance instanceResource) { + + InsertInstanceHttpRequest request = + InsertInstanceHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .setInstanceResource(instanceResource) + .build(); + return insertInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Instance instanceResource = Instance.newBuilder().build();
+   *   Operation response = instanceClient.insertInstance(zone.toString(), instanceResource);
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @param instanceResource An Instance resource. (== resource_for beta.instances ==) (== + * resource_for v1.instances ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstance(String zone, Instance instanceResource) { + + InsertInstanceHttpRequest request = + InsertInstanceHttpRequest.newBuilder() + .setZone(zone) + .setInstanceResource(instanceResource) + .build(); + return insertInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Instance instanceResource = Instance.newBuilder().build();
+   *   InsertInstanceHttpRequest request = InsertInstanceHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setInstanceResource(instanceResource)
+   *     .build();
+   *   Operation response = instanceClient.insertInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstance(InsertInstanceHttpRequest request) { + return insertInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Instance instanceResource = Instance.newBuilder().build();
+   *   InsertInstanceHttpRequest request = InsertInstanceHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setInstanceResource(instanceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.insertInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertInstanceCallable() { + return stub.insertInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instances contained within the specified zone. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (Instance element : instanceClient.listInstances(zone).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstancesPagedResponse listInstances(ProjectZoneName zone) { + ListInstancesHttpRequest request = + ListInstancesHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .build(); + return listInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instances contained within the specified zone. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (Instance element : instanceClient.listInstances(zone.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstancesPagedResponse listInstances(String zone) { + ListInstancesHttpRequest request = ListInstancesHttpRequest.newBuilder().setZone(zone).build(); + return listInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instances contained within the specified zone. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListInstancesHttpRequest request = ListInstancesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   for (Instance element : instanceClient.listInstances(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstancesPagedResponse listInstances(ListInstancesHttpRequest request) { + return listInstancesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instances contained within the specified zone. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListInstancesHttpRequest request = ListInstancesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   ApiFuture<ListInstancesPagedResponse> future = instanceClient.listInstancesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Instance element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listInstancesPagedCallable() { + return stub.listInstancesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instances contained within the specified zone. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListInstancesHttpRequest request = ListInstancesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   while (true) {
+   *     InstanceList response = instanceClient.listInstancesCallable().call(request);
+   *     for (Instance element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listInstancesCallable() { + return stub.listInstancesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of referrers to instances contained within the specified zone. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   for (Reference element : instanceClient.listReferrersInstances(instance).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param instance Name of the target instance scoping this request, or '-' if the request should + * span over all instances in the container. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListReferrersInstancesPagedResponse listReferrersInstances( + ProjectZoneInstanceName instance) { + ListReferrersInstancesHttpRequest request = + ListReferrersInstancesHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .build(); + return listReferrersInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of referrers to instances contained within the specified zone. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   for (Reference element : instanceClient.listReferrersInstances(instance.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param instance Name of the target instance scoping this request, or '-' if the request should + * span over all instances in the container. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListReferrersInstancesPagedResponse listReferrersInstances(String instance) { + ListReferrersInstancesHttpRequest request = + ListReferrersInstancesHttpRequest.newBuilder().setInstance(instance).build(); + return listReferrersInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of referrers to instances contained within the specified zone. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   ListReferrersInstancesHttpRequest request = ListReferrersInstancesHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   for (Reference element : instanceClient.listReferrersInstances(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListReferrersInstancesPagedResponse listReferrersInstances( + ListReferrersInstancesHttpRequest request) { + return listReferrersInstancesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of referrers to instances contained within the specified zone. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   ListReferrersInstancesHttpRequest request = ListReferrersInstancesHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   ApiFuture<ListReferrersInstancesPagedResponse> future = instanceClient.listReferrersInstancesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Reference element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listReferrersInstancesPagedCallable() { + return stub.listReferrersInstancesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of referrers to instances contained within the specified zone. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   ListReferrersInstancesHttpRequest request = ListReferrersInstancesHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   while (true) {
+   *     InstanceListReferrers response = instanceClient.listReferrersInstancesCallable().call(request);
+   *     for (Reference element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listReferrersInstancesCallable() { + return stub.listReferrersInstancesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Performs a reset on the instance. For more information, see Resetting an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Operation response = instanceClient.resetInstance(instance);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resetInstance(ProjectZoneInstanceName instance) { + + ResetInstanceHttpRequest request = + ResetInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .build(); + return resetInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Performs a reset on the instance. For more information, see Resetting an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Operation response = instanceClient.resetInstance(instance.toString());
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resetInstance(String instance) { + + ResetInstanceHttpRequest request = + ResetInstanceHttpRequest.newBuilder().setInstance(instance).build(); + return resetInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Performs a reset on the instance. For more information, see Resetting an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   ResetInstanceHttpRequest request = ResetInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   Operation response = instanceClient.resetInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resetInstance(ResetInstanceHttpRequest request) { + return resetInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Performs a reset on the instance. For more information, see Resetting an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   ResetInstanceHttpRequest request = ResetInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.resetInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable resetInstanceCallable() { + return stub.resetInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets deletion protection on the instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
+   *   Boolean deletionProtection = false;
+   *   Operation response = instanceClient.setDeletionProtectionInstance(resource, deletionProtection);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param deletionProtection Whether the resource should be protected against deletion. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setDeletionProtectionInstance( + ProjectZoneInstanceResourceName resource, Boolean deletionProtection) { + + SetDeletionProtectionInstanceHttpRequest request = + SetDeletionProtectionInstanceHttpRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setDeletionProtection(deletionProtection) + .build(); + return setDeletionProtectionInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets deletion protection on the instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
+   *   Boolean deletionProtection = false;
+   *   Operation response = instanceClient.setDeletionProtectionInstance(resource.toString(), deletionProtection);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param deletionProtection Whether the resource should be protected against deletion. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setDeletionProtectionInstance( + String resource, Boolean deletionProtection) { + + SetDeletionProtectionInstanceHttpRequest request = + SetDeletionProtectionInstanceHttpRequest.newBuilder() + .setResource(resource) + .setDeletionProtection(deletionProtection) + .build(); + return setDeletionProtectionInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets deletion protection on the instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
+   *   Boolean deletionProtection = false;
+   *   SetDeletionProtectionInstanceHttpRequest request = SetDeletionProtectionInstanceHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setDeletionProtection(deletionProtection)
+   *     .build();
+   *   Operation response = instanceClient.setDeletionProtectionInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setDeletionProtectionInstance( + SetDeletionProtectionInstanceHttpRequest request) { + return setDeletionProtectionInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets deletion protection on the instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
+   *   Boolean deletionProtection = false;
+   *   SetDeletionProtectionInstanceHttpRequest request = SetDeletionProtectionInstanceHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setDeletionProtection(deletionProtection)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.setDeletionProtectionInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setDeletionProtectionInstanceCallable() { + return stub.setDeletionProtectionInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the auto-delete flag for a disk attached to an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Boolean autoDelete = false;
+   *   String deviceName = "";
+   *   Operation response = instanceClient.setDiskAutoDeleteInstance(instance, autoDelete, deviceName);
+   * }
+   * 
+ * + * @param instance The instance name. + * @param autoDelete Whether to auto-delete the disk when the instance is deleted. + * @param deviceName The device name of the disk to modify. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setDiskAutoDeleteInstance( + ProjectZoneInstanceName instance, Boolean autoDelete, String deviceName) { + + SetDiskAutoDeleteInstanceHttpRequest request = + SetDiskAutoDeleteInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setAutoDelete(autoDelete) + .setDeviceName(deviceName) + .build(); + return setDiskAutoDeleteInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the auto-delete flag for a disk attached to an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Boolean autoDelete = false;
+   *   String deviceName = "";
+   *   Operation response = instanceClient.setDiskAutoDeleteInstance(instance.toString(), autoDelete, deviceName);
+   * }
+   * 
+ * + * @param instance The instance name. + * @param autoDelete Whether to auto-delete the disk when the instance is deleted. + * @param deviceName The device name of the disk to modify. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setDiskAutoDeleteInstance( + String instance, Boolean autoDelete, String deviceName) { + + SetDiskAutoDeleteInstanceHttpRequest request = + SetDiskAutoDeleteInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setAutoDelete(autoDelete) + .setDeviceName(deviceName) + .build(); + return setDiskAutoDeleteInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the auto-delete flag for a disk attached to an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Boolean autoDelete = false;
+   *   String deviceName = "";
+   *   SetDiskAutoDeleteInstanceHttpRequest request = SetDiskAutoDeleteInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setAutoDelete(autoDelete)
+   *     .setDeviceName(deviceName)
+   *     .build();
+   *   Operation response = instanceClient.setDiskAutoDeleteInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setDiskAutoDeleteInstance(SetDiskAutoDeleteInstanceHttpRequest request) { + return setDiskAutoDeleteInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the auto-delete flag for a disk attached to an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Boolean autoDelete = false;
+   *   String deviceName = "";
+   *   SetDiskAutoDeleteInstanceHttpRequest request = SetDiskAutoDeleteInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setAutoDelete(autoDelete)
+   *     .setDeviceName(deviceName)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.setDiskAutoDeleteInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setDiskAutoDeleteInstanceCallable() { + return stub.setDiskAutoDeleteInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets labels on an instance. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetLabelsRequest instancesSetLabelsRequestResource = InstancesSetLabelsRequest.newBuilder().build();
+   *   Operation response = instanceClient.setLabelsInstance(instance, instancesSetLabelsRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param instancesSetLabelsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsInstance( + ProjectZoneInstanceName instance, + InstancesSetLabelsRequest instancesSetLabelsRequestResource) { + + SetLabelsInstanceHttpRequest request = + SetLabelsInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setInstancesSetLabelsRequestResource(instancesSetLabelsRequestResource) + .build(); + return setLabelsInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets labels on an instance. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetLabelsRequest instancesSetLabelsRequestResource = InstancesSetLabelsRequest.newBuilder().build();
+   *   Operation response = instanceClient.setLabelsInstance(instance.toString(), instancesSetLabelsRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param instancesSetLabelsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsInstance( + String instance, InstancesSetLabelsRequest instancesSetLabelsRequestResource) { + + SetLabelsInstanceHttpRequest request = + SetLabelsInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setInstancesSetLabelsRequestResource(instancesSetLabelsRequestResource) + .build(); + return setLabelsInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets labels on an instance. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetLabelsRequest instancesSetLabelsRequestResource = InstancesSetLabelsRequest.newBuilder().build();
+   *   SetLabelsInstanceHttpRequest request = SetLabelsInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesSetLabelsRequestResource(instancesSetLabelsRequestResource)
+   *     .build();
+   *   Operation response = instanceClient.setLabelsInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsInstance(SetLabelsInstanceHttpRequest request) { + return setLabelsInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets labels on an instance. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetLabelsRequest instancesSetLabelsRequestResource = InstancesSetLabelsRequest.newBuilder().build();
+   *   SetLabelsInstanceHttpRequest request = SetLabelsInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesSetLabelsRequestResource(instancesSetLabelsRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.setLabelsInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable setLabelsInstanceCallable() { + return stub.setLabelsInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the number and/or type of accelerator for a stopped instance to the values specified in + * the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource = InstancesSetMachineResourcesRequest.newBuilder().build();
+   *   Operation response = instanceClient.setMachineResourcesInstance(instance, instancesSetMachineResourcesRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param instancesSetMachineResourcesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMachineResourcesInstance( + ProjectZoneInstanceName instance, + InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource) { + + SetMachineResourcesInstanceHttpRequest request = + SetMachineResourcesInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setInstancesSetMachineResourcesRequestResource( + instancesSetMachineResourcesRequestResource) + .build(); + return setMachineResourcesInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the number and/or type of accelerator for a stopped instance to the values specified in + * the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource = InstancesSetMachineResourcesRequest.newBuilder().build();
+   *   Operation response = instanceClient.setMachineResourcesInstance(instance.toString(), instancesSetMachineResourcesRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param instancesSetMachineResourcesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMachineResourcesInstance( + String instance, + InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource) { + + SetMachineResourcesInstanceHttpRequest request = + SetMachineResourcesInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setInstancesSetMachineResourcesRequestResource( + instancesSetMachineResourcesRequestResource) + .build(); + return setMachineResourcesInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the number and/or type of accelerator for a stopped instance to the values specified in + * the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource = InstancesSetMachineResourcesRequest.newBuilder().build();
+   *   SetMachineResourcesInstanceHttpRequest request = SetMachineResourcesInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesSetMachineResourcesRequestResource(instancesSetMachineResourcesRequestResource)
+   *     .build();
+   *   Operation response = instanceClient.setMachineResourcesInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMachineResourcesInstance( + SetMachineResourcesInstanceHttpRequest request) { + return setMachineResourcesInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the number and/or type of accelerator for a stopped instance to the values specified in + * the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource = InstancesSetMachineResourcesRequest.newBuilder().build();
+   *   SetMachineResourcesInstanceHttpRequest request = SetMachineResourcesInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesSetMachineResourcesRequestResource(instancesSetMachineResourcesRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.setMachineResourcesInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setMachineResourcesInstanceCallable() { + return stub.setMachineResourcesInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the machine type for a stopped instance to the machine type specified in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource = InstancesSetMachineTypeRequest.newBuilder().build();
+   *   Operation response = instanceClient.setMachineTypeInstance(instance, instancesSetMachineTypeRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param instancesSetMachineTypeRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMachineTypeInstance( + ProjectZoneInstanceName instance, + InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource) { + + SetMachineTypeInstanceHttpRequest request = + SetMachineTypeInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setInstancesSetMachineTypeRequestResource(instancesSetMachineTypeRequestResource) + .build(); + return setMachineTypeInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the machine type for a stopped instance to the machine type specified in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource = InstancesSetMachineTypeRequest.newBuilder().build();
+   *   Operation response = instanceClient.setMachineTypeInstance(instance.toString(), instancesSetMachineTypeRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param instancesSetMachineTypeRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMachineTypeInstance( + String instance, InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource) { + + SetMachineTypeInstanceHttpRequest request = + SetMachineTypeInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setInstancesSetMachineTypeRequestResource(instancesSetMachineTypeRequestResource) + .build(); + return setMachineTypeInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the machine type for a stopped instance to the machine type specified in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource = InstancesSetMachineTypeRequest.newBuilder().build();
+   *   SetMachineTypeInstanceHttpRequest request = SetMachineTypeInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesSetMachineTypeRequestResource(instancesSetMachineTypeRequestResource)
+   *     .build();
+   *   Operation response = instanceClient.setMachineTypeInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMachineTypeInstance(SetMachineTypeInstanceHttpRequest request) { + return setMachineTypeInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the machine type for a stopped instance to the machine type specified in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource = InstancesSetMachineTypeRequest.newBuilder().build();
+   *   SetMachineTypeInstanceHttpRequest request = SetMachineTypeInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesSetMachineTypeRequestResource(instancesSetMachineTypeRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.setMachineTypeInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setMachineTypeInstanceCallable() { + return stub.setMachineTypeInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets metadata for the specified instance to the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Metadata metadataResource = Metadata.newBuilder().build();
+   *   Operation response = instanceClient.setMetadataInstance(instance, metadataResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param metadataResource A metadata key/value entry. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMetadataInstance( + ProjectZoneInstanceName instance, Metadata metadataResource) { + + SetMetadataInstanceHttpRequest request = + SetMetadataInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setMetadataResource(metadataResource) + .build(); + return setMetadataInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets metadata for the specified instance to the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Metadata metadataResource = Metadata.newBuilder().build();
+   *   Operation response = instanceClient.setMetadataInstance(instance.toString(), metadataResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param metadataResource A metadata key/value entry. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMetadataInstance(String instance, Metadata metadataResource) { + + SetMetadataInstanceHttpRequest request = + SetMetadataInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setMetadataResource(metadataResource) + .build(); + return setMetadataInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets metadata for the specified instance to the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Metadata metadataResource = Metadata.newBuilder().build();
+   *   SetMetadataInstanceHttpRequest request = SetMetadataInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setMetadataResource(metadataResource)
+   *     .build();
+   *   Operation response = instanceClient.setMetadataInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMetadataInstance(SetMetadataInstanceHttpRequest request) { + return setMetadataInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets metadata for the specified instance to the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Metadata metadataResource = Metadata.newBuilder().build();
+   *   SetMetadataInstanceHttpRequest request = SetMetadataInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setMetadataResource(metadataResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.setMetadataInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setMetadataInstanceCallable() { + return stub.setMetadataInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the minimum CPU platform that this instance should use. This method can only be called + * on a stopped instance. For more information, read Specifying a Minimum CPU Platform. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource = InstancesSetMinCpuPlatformRequest.newBuilder().build();
+   *   Operation response = instanceClient.setMinCpuPlatformInstance(instance, instancesSetMinCpuPlatformRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param instancesSetMinCpuPlatformRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMinCpuPlatformInstance( + ProjectZoneInstanceName instance, + InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource) { + + SetMinCpuPlatformInstanceHttpRequest request = + SetMinCpuPlatformInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setInstancesSetMinCpuPlatformRequestResource(instancesSetMinCpuPlatformRequestResource) + .build(); + return setMinCpuPlatformInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the minimum CPU platform that this instance should use. This method can only be called + * on a stopped instance. For more information, read Specifying a Minimum CPU Platform. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource = InstancesSetMinCpuPlatformRequest.newBuilder().build();
+   *   Operation response = instanceClient.setMinCpuPlatformInstance(instance.toString(), instancesSetMinCpuPlatformRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param instancesSetMinCpuPlatformRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMinCpuPlatformInstance( + String instance, + InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource) { + + SetMinCpuPlatformInstanceHttpRequest request = + SetMinCpuPlatformInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setInstancesSetMinCpuPlatformRequestResource(instancesSetMinCpuPlatformRequestResource) + .build(); + return setMinCpuPlatformInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the minimum CPU platform that this instance should use. This method can only be called + * on a stopped instance. For more information, read Specifying a Minimum CPU Platform. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource = InstancesSetMinCpuPlatformRequest.newBuilder().build();
+   *   SetMinCpuPlatformInstanceHttpRequest request = SetMinCpuPlatformInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesSetMinCpuPlatformRequestResource(instancesSetMinCpuPlatformRequestResource)
+   *     .build();
+   *   Operation response = instanceClient.setMinCpuPlatformInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setMinCpuPlatformInstance(SetMinCpuPlatformInstanceHttpRequest request) { + return setMinCpuPlatformInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the minimum CPU platform that this instance should use. This method can only be called + * on a stopped instance. For more information, read Specifying a Minimum CPU Platform. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource = InstancesSetMinCpuPlatformRequest.newBuilder().build();
+   *   SetMinCpuPlatformInstanceHttpRequest request = SetMinCpuPlatformInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesSetMinCpuPlatformRequestResource(instancesSetMinCpuPlatformRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.setMinCpuPlatformInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setMinCpuPlatformInstanceCallable() { + return stub.setMinCpuPlatformInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets an instance's scheduling options. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Scheduling schedulingResource = Scheduling.newBuilder().build();
+   *   Operation response = instanceClient.setSchedulingInstance(instance, schedulingResource);
+   * }
+   * 
+ * + * @param instance Instance name. + * @param schedulingResource Sets the scheduling options for an Instance. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSchedulingInstance( + ProjectZoneInstanceName instance, Scheduling schedulingResource) { + + SetSchedulingInstanceHttpRequest request = + SetSchedulingInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setSchedulingResource(schedulingResource) + .build(); + return setSchedulingInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets an instance's scheduling options. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Scheduling schedulingResource = Scheduling.newBuilder().build();
+   *   Operation response = instanceClient.setSchedulingInstance(instance.toString(), schedulingResource);
+   * }
+   * 
+ * + * @param instance Instance name. + * @param schedulingResource Sets the scheduling options for an Instance. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSchedulingInstance(String instance, Scheduling schedulingResource) { + + SetSchedulingInstanceHttpRequest request = + SetSchedulingInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setSchedulingResource(schedulingResource) + .build(); + return setSchedulingInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets an instance's scheduling options. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Scheduling schedulingResource = Scheduling.newBuilder().build();
+   *   SetSchedulingInstanceHttpRequest request = SetSchedulingInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setSchedulingResource(schedulingResource)
+   *     .build();
+   *   Operation response = instanceClient.setSchedulingInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSchedulingInstance(SetSchedulingInstanceHttpRequest request) { + return setSchedulingInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets an instance's scheduling options. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Scheduling schedulingResource = Scheduling.newBuilder().build();
+   *   SetSchedulingInstanceHttpRequest request = SetSchedulingInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setSchedulingResource(schedulingResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.setSchedulingInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setSchedulingInstanceCallable() { + return stub.setSchedulingInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the service account on the instance. For more information, read Changing the service + * account and access scopes for an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = InstancesSetServiceAccountRequest.newBuilder().build();
+   *   Operation response = instanceClient.setServiceAccountInstance(instance, instancesSetServiceAccountRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance resource to start. + * @param instancesSetServiceAccountRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setServiceAccountInstance( + ProjectZoneInstanceName instance, + InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource) { + + SetServiceAccountInstanceHttpRequest request = + SetServiceAccountInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setInstancesSetServiceAccountRequestResource(instancesSetServiceAccountRequestResource) + .build(); + return setServiceAccountInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the service account on the instance. For more information, read Changing the service + * account and access scopes for an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = InstancesSetServiceAccountRequest.newBuilder().build();
+   *   Operation response = instanceClient.setServiceAccountInstance(instance.toString(), instancesSetServiceAccountRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance resource to start. + * @param instancesSetServiceAccountRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setServiceAccountInstance( + String instance, + InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource) { + + SetServiceAccountInstanceHttpRequest request = + SetServiceAccountInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setInstancesSetServiceAccountRequestResource(instancesSetServiceAccountRequestResource) + .build(); + return setServiceAccountInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the service account on the instance. For more information, read Changing the service + * account and access scopes for an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = InstancesSetServiceAccountRequest.newBuilder().build();
+   *   SetServiceAccountInstanceHttpRequest request = SetServiceAccountInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesSetServiceAccountRequestResource(instancesSetServiceAccountRequestResource)
+   *     .build();
+   *   Operation response = instanceClient.setServiceAccountInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setServiceAccountInstance(SetServiceAccountInstanceHttpRequest request) { + return setServiceAccountInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the service account on the instance. For more information, read Changing the service + * account and access scopes for an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = InstancesSetServiceAccountRequest.newBuilder().build();
+   *   SetServiceAccountInstanceHttpRequest request = SetServiceAccountInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesSetServiceAccountRequestResource(instancesSetServiceAccountRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.setServiceAccountInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setServiceAccountInstanceCallable() { + return stub.setServiceAccountInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets tags for the specified instance to the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Tags tagsResource = Tags.newBuilder().build();
+   *   Operation response = instanceClient.setTagsInstance(instance, tagsResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param tagsResource A set of instance tags. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTagsInstance(ProjectZoneInstanceName instance, Tags tagsResource) { + + SetTagsInstanceHttpRequest request = + SetTagsInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setTagsResource(tagsResource) + .build(); + return setTagsInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets tags for the specified instance to the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Tags tagsResource = Tags.newBuilder().build();
+   *   Operation response = instanceClient.setTagsInstance(instance.toString(), tagsResource);
+   * }
+   * 
+ * + * @param instance Name of the instance scoping this request. + * @param tagsResource A set of instance tags. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTagsInstance(String instance, Tags tagsResource) { + + SetTagsInstanceHttpRequest request = + SetTagsInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setTagsResource(tagsResource) + .build(); + return setTagsInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets tags for the specified instance to the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Tags tagsResource = Tags.newBuilder().build();
+   *   SetTagsInstanceHttpRequest request = SetTagsInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setTagsResource(tagsResource)
+   *     .build();
+   *   Operation response = instanceClient.setTagsInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTagsInstance(SetTagsInstanceHttpRequest request) { + return setTagsInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets tags for the specified instance to the data included in the request. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Tags tagsResource = Tags.newBuilder().build();
+   *   SetTagsInstanceHttpRequest request = SetTagsInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setTagsResource(tagsResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.setTagsInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable setTagsInstanceCallable() { + return stub.setTagsInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Starts an instance that was stopped using the instances().stop method. For more information, + * see Restart an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Operation response = instanceClient.startInstance(instance);
+   * }
+   * 
+ * + * @param instance Name of the instance resource to start. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation startInstance(ProjectZoneInstanceName instance) { + + StartInstanceHttpRequest request = + StartInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .build(); + return startInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Starts an instance that was stopped using the instances().stop method. For more information, + * see Restart an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Operation response = instanceClient.startInstance(instance.toString());
+   * }
+   * 
+ * + * @param instance Name of the instance resource to start. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation startInstance(String instance) { + + StartInstanceHttpRequest request = + StartInstanceHttpRequest.newBuilder().setInstance(instance).build(); + return startInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Starts an instance that was stopped using the instances().stop method. For more information, + * see Restart an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   StartInstanceHttpRequest request = StartInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   Operation response = instanceClient.startInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation startInstance(StartInstanceHttpRequest request) { + return startInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Starts an instance that was stopped using the instances().stop method. For more information, + * see Restart an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   StartInstanceHttpRequest request = StartInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.startInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable startInstanceCallable() { + return stub.startInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Starts an instance that was stopped using the instances().stop method. For more information, + * see Restart an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource = InstancesStartWithEncryptionKeyRequest.newBuilder().build();
+   *   Operation response = instanceClient.startWithEncryptionKeyInstance(instance, instancesStartWithEncryptionKeyRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance resource to start. + * @param instancesStartWithEncryptionKeyRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation startWithEncryptionKeyInstance( + ProjectZoneInstanceName instance, + InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource) { + + StartWithEncryptionKeyInstanceHttpRequest request = + StartWithEncryptionKeyInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setInstancesStartWithEncryptionKeyRequestResource( + instancesStartWithEncryptionKeyRequestResource) + .build(); + return startWithEncryptionKeyInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Starts an instance that was stopped using the instances().stop method. For more information, + * see Restart an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource = InstancesStartWithEncryptionKeyRequest.newBuilder().build();
+   *   Operation response = instanceClient.startWithEncryptionKeyInstance(instance.toString(), instancesStartWithEncryptionKeyRequestResource);
+   * }
+   * 
+ * + * @param instance Name of the instance resource to start. + * @param instancesStartWithEncryptionKeyRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation startWithEncryptionKeyInstance( + String instance, + InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource) { + + StartWithEncryptionKeyInstanceHttpRequest request = + StartWithEncryptionKeyInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setInstancesStartWithEncryptionKeyRequestResource( + instancesStartWithEncryptionKeyRequestResource) + .build(); + return startWithEncryptionKeyInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Starts an instance that was stopped using the instances().stop method. For more information, + * see Restart an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource = InstancesStartWithEncryptionKeyRequest.newBuilder().build();
+   *   StartWithEncryptionKeyInstanceHttpRequest request = StartWithEncryptionKeyInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesStartWithEncryptionKeyRequestResource(instancesStartWithEncryptionKeyRequestResource)
+   *     .build();
+   *   Operation response = instanceClient.startWithEncryptionKeyInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation startWithEncryptionKeyInstance( + StartWithEncryptionKeyInstanceHttpRequest request) { + return startWithEncryptionKeyInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Starts an instance that was stopped using the instances().stop method. For more information, + * see Restart an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource = InstancesStartWithEncryptionKeyRequest.newBuilder().build();
+   *   StartWithEncryptionKeyInstanceHttpRequest request = StartWithEncryptionKeyInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setInstancesStartWithEncryptionKeyRequestResource(instancesStartWithEncryptionKeyRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.startWithEncryptionKeyInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + startWithEncryptionKeyInstanceCallable() { + return stub.startWithEncryptionKeyInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a + * later time. Stopped instances do not incur VM usage charges while they are stopped. However, + * resources that the VM is using, such as persistent disks and static IP addresses, will continue + * to be charged until they are deleted. For more information, see Stopping an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Operation response = instanceClient.stopInstance(instance);
+   * }
+   * 
+ * + * @param instance Name of the instance resource to stop. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation stopInstance(ProjectZoneInstanceName instance) { + + StopInstanceHttpRequest request = + StopInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .build(); + return stopInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a + * later time. Stopped instances do not incur VM usage charges while they are stopped. However, + * resources that the VM is using, such as persistent disks and static IP addresses, will continue + * to be charged until they are deleted. For more information, see Stopping an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   Operation response = instanceClient.stopInstance(instance.toString());
+   * }
+   * 
+ * + * @param instance Name of the instance resource to stop. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation stopInstance(String instance) { + + StopInstanceHttpRequest request = + StopInstanceHttpRequest.newBuilder().setInstance(instance).build(); + return stopInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a + * later time. Stopped instances do not incur VM usage charges while they are stopped. However, + * resources that the VM is using, such as persistent disks and static IP addresses, will continue + * to be charged until they are deleted. For more information, see Stopping an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   StopInstanceHttpRequest request = StopInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   Operation response = instanceClient.stopInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation stopInstance(StopInstanceHttpRequest request) { + return stopInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a + * later time. Stopped instances do not incur VM usage charges while they are stopped. However, + * resources that the VM is using, such as persistent disks and static IP addresses, will continue + * to be charged until they are deleted. For more information, see Stopping an instance. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   StopInstanceHttpRequest request = StopInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.stopInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable stopInstanceCallable() { + return stub.stopInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified access config from an instance's network interface with the data included + * in the request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
+   *   Operation response = instanceClient.updateAccessConfigInstance(instance, networkInterface, accessConfigResource);
+   * }
+   * 
+ * + * @param instance The instance name for this request. + * @param networkInterface The name of the network interface where the access config is attached. + * @param accessConfigResource An access configuration attached to an instance's network + * interface. Only one access config per instance is supported. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateAccessConfigInstance( + ProjectZoneInstanceName instance, + String networkInterface, + AccessConfig accessConfigResource) { + + UpdateAccessConfigInstanceHttpRequest request = + UpdateAccessConfigInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setNetworkInterface(networkInterface) + .setAccessConfigResource(accessConfigResource) + .build(); + return updateAccessConfigInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified access config from an instance's network interface with the data included + * in the request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
+   *   Operation response = instanceClient.updateAccessConfigInstance(instance.toString(), networkInterface, accessConfigResource);
+   * }
+   * 
+ * + * @param instance The instance name for this request. + * @param networkInterface The name of the network interface where the access config is attached. + * @param accessConfigResource An access configuration attached to an instance's network + * interface. Only one access config per instance is supported. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateAccessConfigInstance( + String instance, String networkInterface, AccessConfig accessConfigResource) { + + UpdateAccessConfigInstanceHttpRequest request = + UpdateAccessConfigInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setNetworkInterface(networkInterface) + .setAccessConfigResource(accessConfigResource) + .build(); + return updateAccessConfigInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified access config from an instance's network interface with the data included + * in the request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
+   *   UpdateAccessConfigInstanceHttpRequest request = UpdateAccessConfigInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setNetworkInterface(networkInterface)
+   *     .setAccessConfigResource(accessConfigResource)
+   *     .build();
+   *   Operation response = instanceClient.updateAccessConfigInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateAccessConfigInstance(UpdateAccessConfigInstanceHttpRequest request) { + return updateAccessConfigInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified access config from an instance's network interface with the data included + * in the request. This method supports PATCH semantics and uses the JSON merge patch format and + * processing rules. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
+   *   UpdateAccessConfigInstanceHttpRequest request = UpdateAccessConfigInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setNetworkInterface(networkInterface)
+   *     .setAccessConfigResource(accessConfigResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.updateAccessConfigInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + updateAccessConfigInstanceCallable() { + return stub.updateAccessConfigInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an instance's network interface. This method follows PATCH semantics. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build();
+   *   Operation response = instanceClient.updateNetworkInterfaceInstance(instance, networkInterface, networkInterfaceResource);
+   * }
+   * 
+ * + * @param instance The instance name for this request. + * @param networkInterface The name of the network interface to update. + * @param networkInterfaceResource A network interface resource attached to an instance. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateNetworkInterfaceInstance( + ProjectZoneInstanceName instance, + String networkInterface, + NetworkInterface networkInterfaceResource) { + + UpdateNetworkInterfaceInstanceHttpRequest request = + UpdateNetworkInterfaceInstanceHttpRequest.newBuilder() + .setInstance(instance == null ? null : instance.toString()) + .setNetworkInterface(networkInterface) + .setNetworkInterfaceResource(networkInterfaceResource) + .build(); + return updateNetworkInterfaceInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an instance's network interface. This method follows PATCH semantics. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build();
+   *   Operation response = instanceClient.updateNetworkInterfaceInstance(instance.toString(), networkInterface, networkInterfaceResource);
+   * }
+   * 
+ * + * @param instance The instance name for this request. + * @param networkInterface The name of the network interface to update. + * @param networkInterfaceResource A network interface resource attached to an instance. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateNetworkInterfaceInstance( + String instance, String networkInterface, NetworkInterface networkInterfaceResource) { + + UpdateNetworkInterfaceInstanceHttpRequest request = + UpdateNetworkInterfaceInstanceHttpRequest.newBuilder() + .setInstance(instance) + .setNetworkInterface(networkInterface) + .setNetworkInterfaceResource(networkInterfaceResource) + .build(); + return updateNetworkInterfaceInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an instance's network interface. This method follows PATCH semantics. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build();
+   *   UpdateNetworkInterfaceInstanceHttpRequest request = UpdateNetworkInterfaceInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setNetworkInterface(networkInterface)
+   *     .setNetworkInterfaceResource(networkInterfaceResource)
+   *     .build();
+   *   Operation response = instanceClient.updateNetworkInterfaceInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateNetworkInterfaceInstance( + UpdateNetworkInterfaceInstanceHttpRequest request) { + return updateNetworkInterfaceInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an instance's network interface. This method follows PATCH semantics. + * + *

Sample code: + * + *


+   * try (InstanceClient instanceClient = InstanceClient.create()) {
+   *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+   *   String networkInterface = "";
+   *   NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build();
+   *   UpdateNetworkInterfaceInstanceHttpRequest request = UpdateNetworkInterfaceInstanceHttpRequest.newBuilder()
+   *     .setInstance(instance.toString())
+   *     .setNetworkInterface(networkInterface)
+   *     .setNetworkInterfaceResource(networkInterfaceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceClient.updateNetworkInterfaceInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + updateNetworkInterfaceInstanceCallable() { + return stub.updateNetworkInterfaceInstanceCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListInstancesPagedResponse + extends AbstractPagedListResponse< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, InstancesScopedList, + AggregatedListInstancesPage, AggregatedListInstancesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListInstancesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public AggregatedListInstancesPagedResponse apply(AggregatedListInstancesPage input) { + return new AggregatedListInstancesPagedResponse(input); + } + }); + } + + private AggregatedListInstancesPagedResponse(AggregatedListInstancesPage page) { + super(page, AggregatedListInstancesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListInstancesPage + extends AbstractPage< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, InstancesScopedList, + AggregatedListInstancesPage> { + + private AggregatedListInstancesPage( + PageContext + context, + InstanceAggregatedList response) { + super(context, response); + } + + private static AggregatedListInstancesPage createEmptyPage() { + return new AggregatedListInstancesPage(null, null); + } + + @Override + protected AggregatedListInstancesPage createPage( + PageContext + context, + InstanceAggregatedList response) { + return new AggregatedListInstancesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListInstancesFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, InstancesScopedList, + AggregatedListInstancesPage, AggregatedListInstancesFixedSizeCollection> { + + private AggregatedListInstancesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListInstancesFixedSizeCollection createEmptyCollection() { + return new AggregatedListInstancesFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListInstancesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListInstancesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListInstancesPagedResponse + extends AbstractPagedListResponse< + ListInstancesHttpRequest, InstanceList, Instance, ListInstancesPage, + ListInstancesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListInstancesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListInstancesPagedResponse apply(ListInstancesPage input) { + return new ListInstancesPagedResponse(input); + } + }); + } + + private ListInstancesPagedResponse(ListInstancesPage page) { + super(page, ListInstancesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListInstancesPage + extends AbstractPage { + + private ListInstancesPage( + PageContext context, + InstanceList response) { + super(context, response); + } + + private static ListInstancesPage createEmptyPage() { + return new ListInstancesPage(null, null); + } + + @Override + protected ListInstancesPage createPage( + PageContext context, + InstanceList response) { + return new ListInstancesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListInstancesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListInstancesHttpRequest, InstanceList, Instance, ListInstancesPage, + ListInstancesFixedSizeCollection> { + + private ListInstancesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListInstancesFixedSizeCollection createEmptyCollection() { + return new ListInstancesFixedSizeCollection(null, 0); + } + + @Override + protected ListInstancesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListInstancesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListReferrersInstancesPagedResponse + extends AbstractPagedListResponse< + ListReferrersInstancesHttpRequest, InstanceListReferrers, Reference, + ListReferrersInstancesPage, ListReferrersInstancesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListReferrersInstancesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListReferrersInstancesPagedResponse apply(ListReferrersInstancesPage input) { + return new ListReferrersInstancesPagedResponse(input); + } + }); + } + + private ListReferrersInstancesPagedResponse(ListReferrersInstancesPage page) { + super(page, ListReferrersInstancesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListReferrersInstancesPage + extends AbstractPage< + ListReferrersInstancesHttpRequest, InstanceListReferrers, Reference, + ListReferrersInstancesPage> { + + private ListReferrersInstancesPage( + PageContext context, + InstanceListReferrers response) { + super(context, response); + } + + private static ListReferrersInstancesPage createEmptyPage() { + return new ListReferrersInstancesPage(null, null); + } + + @Override + protected ListReferrersInstancesPage createPage( + PageContext context, + InstanceListReferrers response) { + return new ListReferrersInstancesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListReferrersInstancesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListReferrersInstancesHttpRequest, InstanceListReferrers, Reference, + ListReferrersInstancesPage, ListReferrersInstancesFixedSizeCollection> { + + private ListReferrersInstancesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListReferrersInstancesFixedSizeCollection createEmptyCollection() { + return new ListReferrersInstancesFixedSizeCollection(null, 0); + } + + @Override + protected ListReferrersInstancesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListReferrersInstancesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroup.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroup.java new file mode 100644 index 000000000000..e8d1b23bc558 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroup.java @@ -0,0 +1,542 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroup implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String fingerprint; + private final String id; + private final String kind; + private final String name; + private final List namedPorts; + private final String network; + private final String region; + private final String selfLink; + private final Integer size; + private final String subnetwork; + private final String zone; + + private InstanceGroup() { + this.creationTimestamp = null; + this.description = null; + this.fingerprint = null; + this.id = null; + this.kind = null; + this.name = null; + this.namedPorts = null; + this.network = null; + this.region = null; + this.selfLink = null; + this.size = null; + this.subnetwork = null; + this.zone = null; + } + + private InstanceGroup( + String creationTimestamp, + String description, + String fingerprint, + String id, + String kind, + String name, + List namedPorts, + String network, + String region, + String selfLink, + Integer size, + String subnetwork, + String zone) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.fingerprint = fingerprint; + this.id = id; + this.kind = kind; + this.name = name; + this.namedPorts = namedPorts; + this.network = network; + this.region = region; + this.selfLink = selfLink; + this.size = size; + this.subnetwork = subnetwork; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("namedPorts")) { + return namedPorts; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("size")) { + return size; + } + if (fieldName.equals("subnetwork")) { + return subnetwork; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getFingerprint() { + return fingerprint; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public List getNamedPortsList() { + return namedPorts; + } + + public String getNetwork() { + return network; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public Integer getSize() { + return size; + } + + public String getSubnetwork() { + return subnetwork; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroup prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroup getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroup DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroup(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String fingerprint; + private String id; + private String kind; + private String name; + private List namedPorts; + private String network; + private String region; + private String selfLink; + private Integer size; + private String subnetwork; + private String zone; + + Builder() {} + + public Builder mergeFrom(InstanceGroup other) { + if (other == InstanceGroup.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNamedPortsList() != null) { + this.namedPorts = other.namedPorts; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSize() != null) { + this.size = other.size; + } + if (other.getSubnetwork() != null) { + this.subnetwork = other.subnetwork; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(InstanceGroup source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.fingerprint = source.fingerprint; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.namedPorts = source.namedPorts; + this.network = source.network; + this.region = source.region; + this.selfLink = source.selfLink; + this.size = source.size; + this.subnetwork = source.subnetwork; + this.zone = source.zone; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public List getNamedPortsList() { + return namedPorts; + } + + public Builder addAllNamedPorts(List namedPorts) { + if (this.namedPorts == null) { + this.namedPorts = new ArrayList<>(namedPorts.size()); + } + this.namedPorts.addAll(namedPorts); + return this; + } + + public Builder addNamedPorts(NamedPort namedPorts) { + this.namedPorts.add(namedPorts); + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Integer getSize() { + return size; + } + + public Builder setSize(Integer size) { + this.size = size; + return this; + } + + public String getSubnetwork() { + return subnetwork; + } + + public Builder setSubnetwork(String subnetwork) { + this.subnetwork = subnetwork; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public InstanceGroup build() { + + return new InstanceGroup( + creationTimestamp, + description, + fingerprint, + id, + kind, + name, + namedPorts, + network, + region, + selfLink, + size, + subnetwork, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.addAllNamedPorts(this.namedPorts); + newBuilder.setNetwork(this.network); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setSize(this.size); + newBuilder.setSubnetwork(this.subnetwork); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroup{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "fingerprint=" + + fingerprint + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "namedPorts=" + + namedPorts + + ", " + + "network=" + + network + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + ", " + + "size=" + + size + + ", " + + "subnetwork=" + + subnetwork + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroup) { + InstanceGroup that = (InstanceGroup) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.namedPorts, that.getNamedPortsList()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.size, that.getSize()) + && Objects.equals(this.subnetwork, that.getSubnetwork()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + description, + fingerprint, + id, + kind, + name, + namedPorts, + network, + region, + selfLink, + size, + subnetwork, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupAggregatedList.java new file mode 100644 index 000000000000..ccf256b918a3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InstanceGroupAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InstanceGroupAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstanceGroupAggregatedList other) { + if (other == InstanceGroupAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstanceGroupAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstanceGroupAggregatedList build() { + + return new InstanceGroupAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupAggregatedList) { + InstanceGroupAggregatedList that = (InstanceGroupAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupClient.java new file mode 100644 index 000000000000..7080dd8c45d8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupClient.java @@ -0,0 +1,1586 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.InstanceGroupStub; +import com.google.cloud.compute.v1.stub.InstanceGroupStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+ *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+ *   InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource = InstanceGroupsAddInstancesRequest.newBuilder().build();
+ *   Operation response = instanceGroupClient.addInstancesInstanceGroup(instanceGroup, instanceGroupsAddInstancesRequestResource);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the instanceGroupClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of InstanceGroupSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * InstanceGroupSettings instanceGroupSettings =
+ *     InstanceGroupSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * InstanceGroupClient instanceGroupClient =
+ *     InstanceGroupClient.create(instanceGroupSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * InstanceGroupSettings instanceGroupSettings =
+ *     InstanceGroupSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * InstanceGroupClient instanceGroupClient =
+ *     InstanceGroupClient.create(instanceGroupSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceGroupClient implements BackgroundResource { + private final InstanceGroupSettings settings; + private final InstanceGroupStub stub; + + /** Constructs an instance of InstanceGroupClient with default settings. */ + public static final InstanceGroupClient create() throws IOException { + return create(InstanceGroupSettings.newBuilder().build()); + } + + /** + * Constructs an instance of InstanceGroupClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final InstanceGroupClient create(InstanceGroupSettings settings) + throws IOException { + return new InstanceGroupClient(settings); + } + + /** + * Constructs an instance of InstanceGroupClient, using the given stub for making calls. This is + * for advanced usage - prefer to use InstanceGroupSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final InstanceGroupClient create(InstanceGroupStub stub) { + return new InstanceGroupClient(stub); + } + + /** + * Constructs an instance of InstanceGroupClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected InstanceGroupClient(InstanceGroupSettings settings) throws IOException { + this.settings = settings; + this.stub = ((InstanceGroupStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected InstanceGroupClient(InstanceGroupStub stub) { + this.settings = null; + this.stub = stub; + } + + public final InstanceGroupSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InstanceGroupStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds a list of instances to the specified instance group. All of the instances in the instance + * group must be in the same network/subnetwork. Read Adding instances for more information. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource = InstanceGroupsAddInstancesRequest.newBuilder().build();
+   *   Operation response = instanceGroupClient.addInstancesInstanceGroup(instanceGroup, instanceGroupsAddInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group where you are adding instances. + * @param instanceGroupsAddInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addInstancesInstanceGroup( + ProjectZoneInstanceGroupName instanceGroup, + InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource) { + + AddInstancesInstanceGroupHttpRequest request = + AddInstancesInstanceGroupHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup == null ? null : instanceGroup.toString()) + .setInstanceGroupsAddInstancesRequestResource(instanceGroupsAddInstancesRequestResource) + .build(); + return addInstancesInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds a list of instances to the specified instance group. All of the instances in the instance + * group must be in the same network/subnetwork. Read Adding instances for more information. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource = InstanceGroupsAddInstancesRequest.newBuilder().build();
+   *   Operation response = instanceGroupClient.addInstancesInstanceGroup(instanceGroup.toString(), instanceGroupsAddInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group where you are adding instances. + * @param instanceGroupsAddInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addInstancesInstanceGroup( + String instanceGroup, + InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource) { + + AddInstancesInstanceGroupHttpRequest request = + AddInstancesInstanceGroupHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup) + .setInstanceGroupsAddInstancesRequestResource(instanceGroupsAddInstancesRequestResource) + .build(); + return addInstancesInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds a list of instances to the specified instance group. All of the instances in the instance + * group must be in the same network/subnetwork. Read Adding instances for more information. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource = InstanceGroupsAddInstancesRequest.newBuilder().build();
+   *   AddInstancesInstanceGroupHttpRequest request = AddInstancesInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setInstanceGroupsAddInstancesRequestResource(instanceGroupsAddInstancesRequestResource)
+   *     .build();
+   *   Operation response = instanceGroupClient.addInstancesInstanceGroup(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addInstancesInstanceGroup(AddInstancesInstanceGroupHttpRequest request) { + return addInstancesInstanceGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds a list of instances to the specified instance group. All of the instances in the instance + * group must be in the same network/subnetwork. Read Adding instances for more information. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource = InstanceGroupsAddInstancesRequest.newBuilder().build();
+   *   AddInstancesInstanceGroupHttpRequest request = AddInstancesInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setInstanceGroupsAddInstancesRequestResource(instanceGroupsAddInstancesRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupClient.addInstancesInstanceGroupCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + addInstancesInstanceGroupCallable() { + return stub.addInstancesInstanceGroupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance groups and sorts them by zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InstanceGroupsScopedList element : instanceGroupClient.aggregatedListInstanceGroups(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInstanceGroupsPagedResponse aggregatedListInstanceGroups( + ProjectName project) { + AggregatedListInstanceGroupsHttpRequest request = + AggregatedListInstanceGroupsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListInstanceGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance groups and sorts them by zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InstanceGroupsScopedList element : instanceGroupClient.aggregatedListInstanceGroups(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInstanceGroupsPagedResponse aggregatedListInstanceGroups( + String project) { + AggregatedListInstanceGroupsHttpRequest request = + AggregatedListInstanceGroupsHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListInstanceGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance groups and sorts them by zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInstanceGroupsHttpRequest request = AggregatedListInstanceGroupsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (InstanceGroupsScopedList element : instanceGroupClient.aggregatedListInstanceGroups(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInstanceGroupsPagedResponse aggregatedListInstanceGroups( + AggregatedListInstanceGroupsHttpRequest request) { + return aggregatedListInstanceGroupsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance groups and sorts them by zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInstanceGroupsHttpRequest request = AggregatedListInstanceGroupsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListInstanceGroupsPagedResponse> future = instanceGroupClient.aggregatedListInstanceGroupsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InstanceGroupsScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListInstanceGroupsHttpRequest, AggregatedListInstanceGroupsPagedResponse> + aggregatedListInstanceGroupsPagedCallable() { + return stub.aggregatedListInstanceGroupsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance groups and sorts them by zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInstanceGroupsHttpRequest request = AggregatedListInstanceGroupsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     InstanceGroupAggregatedList response = instanceGroupClient.aggregatedListInstanceGroupsCallable().call(request);
+   *     for (InstanceGroupsScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListInstanceGroupsCallable() { + return stub.aggregatedListInstanceGroupsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified instance group. The instances in the group are not deleted. Note that + * instance group must not belong to a backend service. Read Deleting an instance group for more + * information. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   Operation response = instanceGroupClient.deleteInstanceGroup(instanceGroup);
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstanceGroup(ProjectZoneInstanceGroupName instanceGroup) { + + DeleteInstanceGroupHttpRequest request = + DeleteInstanceGroupHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup == null ? null : instanceGroup.toString()) + .build(); + return deleteInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified instance group. The instances in the group are not deleted. Note that + * instance group must not belong to a backend service. Read Deleting an instance group for more + * information. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   Operation response = instanceGroupClient.deleteInstanceGroup(instanceGroup.toString());
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstanceGroup(String instanceGroup) { + + DeleteInstanceGroupHttpRequest request = + DeleteInstanceGroupHttpRequest.newBuilder().setInstanceGroup(instanceGroup).build(); + return deleteInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified instance group. The instances in the group are not deleted. Note that + * instance group must not belong to a backend service. Read Deleting an instance group for more + * information. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   DeleteInstanceGroupHttpRequest request = DeleteInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .build();
+   *   Operation response = instanceGroupClient.deleteInstanceGroup(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstanceGroup(DeleteInstanceGroupHttpRequest request) { + return deleteInstanceGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified instance group. The instances in the group are not deleted. Note that + * instance group must not belong to a backend service. Read Deleting an instance group for more + * information. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   DeleteInstanceGroupHttpRequest request = DeleteInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupClient.deleteInstanceGroupCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteInstanceGroupCallable() { + return stub.deleteInstanceGroupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance group. Gets a list of available instance groups by making a + * list() request. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroup response = instanceGroupClient.getInstanceGroup(instanceGroup);
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroup getInstanceGroup(ProjectZoneInstanceGroupName instanceGroup) { + + GetInstanceGroupHttpRequest request = + GetInstanceGroupHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup == null ? null : instanceGroup.toString()) + .build(); + return getInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance group. Gets a list of available instance groups by making a + * list() request. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroup response = instanceGroupClient.getInstanceGroup(instanceGroup.toString());
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroup getInstanceGroup(String instanceGroup) { + + GetInstanceGroupHttpRequest request = + GetInstanceGroupHttpRequest.newBuilder().setInstanceGroup(instanceGroup).build(); + return getInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance group. Gets a list of available instance groups by making a + * list() request. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   GetInstanceGroupHttpRequest request = GetInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .build();
+   *   InstanceGroup response = instanceGroupClient.getInstanceGroup(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroup getInstanceGroup(GetInstanceGroupHttpRequest request) { + return getInstanceGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance group. Gets a list of available instance groups by making a + * list() request. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   GetInstanceGroupHttpRequest request = GetInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .build();
+   *   ApiFuture<InstanceGroup> future = instanceGroupClient.getInstanceGroupCallable().futureCall(request);
+   *   // Do something
+   *   InstanceGroup response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getInstanceGroupCallable() { + return stub.getInstanceGroupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance group in the specified project using the parameters that are included in + * the request. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build();
+   *   Operation response = instanceGroupClient.insertInstanceGroup(zone, instanceGroupResource);
+   * }
+   * 
+ * + * @param zone The name of the zone where you want to create the instance group. + * @param instanceGroupResource InstanceGroups (== resource_for beta.instanceGroups ==) (== + * resource_for v1.instanceGroups ==) (== resource_for beta.regionInstanceGroups ==) (== + * resource_for v1.regionInstanceGroups ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstanceGroup( + ProjectZoneName zone, InstanceGroup instanceGroupResource) { + + InsertInstanceGroupHttpRequest request = + InsertInstanceGroupHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .setInstanceGroupResource(instanceGroupResource) + .build(); + return insertInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance group in the specified project using the parameters that are included in + * the request. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build();
+   *   Operation response = instanceGroupClient.insertInstanceGroup(zone.toString(), instanceGroupResource);
+   * }
+   * 
+ * + * @param zone The name of the zone where you want to create the instance group. + * @param instanceGroupResource InstanceGroups (== resource_for beta.instanceGroups ==) (== + * resource_for v1.instanceGroups ==) (== resource_for beta.regionInstanceGroups ==) (== + * resource_for v1.regionInstanceGroups ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstanceGroup(String zone, InstanceGroup instanceGroupResource) { + + InsertInstanceGroupHttpRequest request = + InsertInstanceGroupHttpRequest.newBuilder() + .setZone(zone) + .setInstanceGroupResource(instanceGroupResource) + .build(); + return insertInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance group in the specified project using the parameters that are included in + * the request. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build();
+   *   InsertInstanceGroupHttpRequest request = InsertInstanceGroupHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setInstanceGroupResource(instanceGroupResource)
+   *     .build();
+   *   Operation response = instanceGroupClient.insertInstanceGroup(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstanceGroup(InsertInstanceGroupHttpRequest request) { + return insertInstanceGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance group in the specified project using the parameters that are included in + * the request. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build();
+   *   InsertInstanceGroupHttpRequest request = InsertInstanceGroupHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setInstanceGroupResource(instanceGroupResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupClient.insertInstanceGroupCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertInstanceGroupCallable() { + return stub.insertInstanceGroupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance groups that are located in the specified project and zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (InstanceGroup element : instanceGroupClient.listInstanceGroups(zone).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone where the instance group is located. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstanceGroupsPagedResponse listInstanceGroups(ProjectZoneName zone) { + ListInstanceGroupsHttpRequest request = + ListInstanceGroupsHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .build(); + return listInstanceGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance groups that are located in the specified project and zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (InstanceGroup element : instanceGroupClient.listInstanceGroups(zone.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone where the instance group is located. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstanceGroupsPagedResponse listInstanceGroups(String zone) { + ListInstanceGroupsHttpRequest request = + ListInstanceGroupsHttpRequest.newBuilder().setZone(zone).build(); + return listInstanceGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance groups that are located in the specified project and zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListInstanceGroupsHttpRequest request = ListInstanceGroupsHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   for (InstanceGroup element : instanceGroupClient.listInstanceGroups(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstanceGroupsPagedResponse listInstanceGroups( + ListInstanceGroupsHttpRequest request) { + return listInstanceGroupsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance groups that are located in the specified project and zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListInstanceGroupsHttpRequest request = ListInstanceGroupsHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   ApiFuture<ListInstanceGroupsPagedResponse> future = instanceGroupClient.listInstanceGroupsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InstanceGroup element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listInstanceGroupsPagedCallable() { + return stub.listInstanceGroupsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance groups that are located in the specified project and zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListInstanceGroupsHttpRequest request = ListInstanceGroupsHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   while (true) {
+   *     InstanceGroupList response = instanceGroupClient.listInstanceGroupsCallable().call(request);
+   *     for (InstanceGroup element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listInstanceGroupsCallable() { + return stub.listInstanceGroupsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the specified instance group. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource = InstanceGroupsListInstancesRequest.newBuilder().build();
+   *   for (InstanceWithNamedPorts element : instanceGroupClient.listInstancesInstanceGroups(instanceGroup, instanceGroupsListInstancesRequestResource).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group from which you want to generate a list of + * included instances. + * @param instanceGroupsListInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstancesInstanceGroupsPagedResponse listInstancesInstanceGroups( + ProjectZoneInstanceGroupName instanceGroup, + InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource) { + ListInstancesInstanceGroupsHttpRequest request = + ListInstancesInstanceGroupsHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup == null ? null : instanceGroup.toString()) + .setInstanceGroupsListInstancesRequestResource( + instanceGroupsListInstancesRequestResource) + .build(); + return listInstancesInstanceGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the specified instance group. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource = InstanceGroupsListInstancesRequest.newBuilder().build();
+   *   for (InstanceWithNamedPorts element : instanceGroupClient.listInstancesInstanceGroups(instanceGroup.toString(), instanceGroupsListInstancesRequestResource).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group from which you want to generate a list of + * included instances. + * @param instanceGroupsListInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstancesInstanceGroupsPagedResponse listInstancesInstanceGroups( + String instanceGroup, + InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource) { + ListInstancesInstanceGroupsHttpRequest request = + ListInstancesInstanceGroupsHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup) + .setInstanceGroupsListInstancesRequestResource( + instanceGroupsListInstancesRequestResource) + .build(); + return listInstancesInstanceGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the specified instance group. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource = InstanceGroupsListInstancesRequest.newBuilder().build();
+   *   ListInstancesInstanceGroupsHttpRequest request = ListInstancesInstanceGroupsHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setInstanceGroupsListInstancesRequestResource(instanceGroupsListInstancesRequestResource)
+   *     .build();
+   *   for (InstanceWithNamedPorts element : instanceGroupClient.listInstancesInstanceGroups(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstancesInstanceGroupsPagedResponse listInstancesInstanceGroups( + ListInstancesInstanceGroupsHttpRequest request) { + return listInstancesInstanceGroupsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the specified instance group. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource = InstanceGroupsListInstancesRequest.newBuilder().build();
+   *   ListInstancesInstanceGroupsHttpRequest request = ListInstancesInstanceGroupsHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setInstanceGroupsListInstancesRequestResource(instanceGroupsListInstancesRequestResource)
+   *     .build();
+   *   ApiFuture<ListInstancesInstanceGroupsPagedResponse> future = instanceGroupClient.listInstancesInstanceGroupsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InstanceWithNamedPorts element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListInstancesInstanceGroupsHttpRequest, ListInstancesInstanceGroupsPagedResponse> + listInstancesInstanceGroupsPagedCallable() { + return stub.listInstancesInstanceGroupsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the specified instance group. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource = InstanceGroupsListInstancesRequest.newBuilder().build();
+   *   ListInstancesInstanceGroupsHttpRequest request = ListInstancesInstanceGroupsHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setInstanceGroupsListInstancesRequestResource(instanceGroupsListInstancesRequestResource)
+   *     .build();
+   *   while (true) {
+   *     InstanceGroupsListInstances response = instanceGroupClient.listInstancesInstanceGroupsCallable().call(request);
+   *     for (InstanceWithNamedPorts element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listInstancesInstanceGroupsCallable() { + return stub.listInstancesInstanceGroupsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes one or more instances from the specified instance group, but does not delete those + * instances. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration before the VM instance is removed or + * deleted. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource = InstanceGroupsRemoveInstancesRequest.newBuilder().build();
+   *   Operation response = instanceGroupClient.removeInstancesInstanceGroup(instanceGroup, instanceGroupsRemoveInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group where the specified instances will be + * removed. + * @param instanceGroupsRemoveInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removeInstancesInstanceGroup( + ProjectZoneInstanceGroupName instanceGroup, + InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource) { + + RemoveInstancesInstanceGroupHttpRequest request = + RemoveInstancesInstanceGroupHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup == null ? null : instanceGroup.toString()) + .setInstanceGroupsRemoveInstancesRequestResource( + instanceGroupsRemoveInstancesRequestResource) + .build(); + return removeInstancesInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes one or more instances from the specified instance group, but does not delete those + * instances. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration before the VM instance is removed or + * deleted. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource = InstanceGroupsRemoveInstancesRequest.newBuilder().build();
+   *   Operation response = instanceGroupClient.removeInstancesInstanceGroup(instanceGroup.toString(), instanceGroupsRemoveInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group where the specified instances will be + * removed. + * @param instanceGroupsRemoveInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removeInstancesInstanceGroup( + String instanceGroup, + InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource) { + + RemoveInstancesInstanceGroupHttpRequest request = + RemoveInstancesInstanceGroupHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup) + .setInstanceGroupsRemoveInstancesRequestResource( + instanceGroupsRemoveInstancesRequestResource) + .build(); + return removeInstancesInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes one or more instances from the specified instance group, but does not delete those + * instances. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration before the VM instance is removed or + * deleted. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource = InstanceGroupsRemoveInstancesRequest.newBuilder().build();
+   *   RemoveInstancesInstanceGroupHttpRequest request = RemoveInstancesInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setInstanceGroupsRemoveInstancesRequestResource(instanceGroupsRemoveInstancesRequestResource)
+   *     .build();
+   *   Operation response = instanceGroupClient.removeInstancesInstanceGroup(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removeInstancesInstanceGroup( + RemoveInstancesInstanceGroupHttpRequest request) { + return removeInstancesInstanceGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes one or more instances from the specified instance group, but does not delete those + * instances. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration before the VM instance is removed or + * deleted. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource = InstanceGroupsRemoveInstancesRequest.newBuilder().build();
+   *   RemoveInstancesInstanceGroupHttpRequest request = RemoveInstancesInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setInstanceGroupsRemoveInstancesRequestResource(instanceGroupsRemoveInstancesRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupClient.removeInstancesInstanceGroupCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + removeInstancesInstanceGroupCallable() { + return stub.removeInstancesInstanceGroupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the named ports for the specified instance group. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource = InstanceGroupsSetNamedPortsRequest.newBuilder().build();
+   *   Operation response = instanceGroupClient.setNamedPortsInstanceGroup(instanceGroup, instanceGroupsSetNamedPortsRequestResource);
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group where the named ports are updated. + * @param instanceGroupsSetNamedPortsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setNamedPortsInstanceGroup( + ProjectZoneInstanceGroupName instanceGroup, + InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource) { + + SetNamedPortsInstanceGroupHttpRequest request = + SetNamedPortsInstanceGroupHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup == null ? null : instanceGroup.toString()) + .setInstanceGroupsSetNamedPortsRequestResource( + instanceGroupsSetNamedPortsRequestResource) + .build(); + return setNamedPortsInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the named ports for the specified instance group. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource = InstanceGroupsSetNamedPortsRequest.newBuilder().build();
+   *   Operation response = instanceGroupClient.setNamedPortsInstanceGroup(instanceGroup.toString(), instanceGroupsSetNamedPortsRequestResource);
+   * }
+   * 
+ * + * @param instanceGroup The name of the instance group where the named ports are updated. + * @param instanceGroupsSetNamedPortsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setNamedPortsInstanceGroup( + String instanceGroup, + InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource) { + + SetNamedPortsInstanceGroupHttpRequest request = + SetNamedPortsInstanceGroupHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup) + .setInstanceGroupsSetNamedPortsRequestResource( + instanceGroupsSetNamedPortsRequestResource) + .build(); + return setNamedPortsInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the named ports for the specified instance group. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource = InstanceGroupsSetNamedPortsRequest.newBuilder().build();
+   *   SetNamedPortsInstanceGroupHttpRequest request = SetNamedPortsInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setInstanceGroupsSetNamedPortsRequestResource(instanceGroupsSetNamedPortsRequestResource)
+   *     .build();
+   *   Operation response = instanceGroupClient.setNamedPortsInstanceGroup(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setNamedPortsInstanceGroup(SetNamedPortsInstanceGroupHttpRequest request) { + return setNamedPortsInstanceGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the named ports for the specified instance group. + * + *

Sample code: + * + *


+   * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+   *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+   *   InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource = InstanceGroupsSetNamedPortsRequest.newBuilder().build();
+   *   SetNamedPortsInstanceGroupHttpRequest request = SetNamedPortsInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setInstanceGroupsSetNamedPortsRequestResource(instanceGroupsSetNamedPortsRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupClient.setNamedPortsInstanceGroupCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setNamedPortsInstanceGroupCallable() { + return stub.setNamedPortsInstanceGroupCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListInstanceGroupsPagedResponse + extends AbstractPagedListResponse< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + InstanceGroupsScopedList, AggregatedListInstanceGroupsPage, + AggregatedListInstanceGroupsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + InstanceGroupsScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListInstanceGroupsPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + AggregatedListInstanceGroupsPage, AggregatedListInstanceGroupsPagedResponse>() { + @Override + public AggregatedListInstanceGroupsPagedResponse apply( + AggregatedListInstanceGroupsPage input) { + return new AggregatedListInstanceGroupsPagedResponse(input); + } + }); + } + + private AggregatedListInstanceGroupsPagedResponse(AggregatedListInstanceGroupsPage page) { + super(page, AggregatedListInstanceGroupsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListInstanceGroupsPage + extends AbstractPage< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + InstanceGroupsScopedList, AggregatedListInstanceGroupsPage> { + + private AggregatedListInstanceGroupsPage( + PageContext< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + InstanceGroupsScopedList> + context, + InstanceGroupAggregatedList response) { + super(context, response); + } + + private static AggregatedListInstanceGroupsPage createEmptyPage() { + return new AggregatedListInstanceGroupsPage(null, null); + } + + @Override + protected AggregatedListInstanceGroupsPage createPage( + PageContext< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + InstanceGroupsScopedList> + context, + InstanceGroupAggregatedList response) { + return new AggregatedListInstanceGroupsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + InstanceGroupsScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListInstanceGroupsFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + InstanceGroupsScopedList, AggregatedListInstanceGroupsPage, + AggregatedListInstanceGroupsFixedSizeCollection> { + + private AggregatedListInstanceGroupsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListInstanceGroupsFixedSizeCollection createEmptyCollection() { + return new AggregatedListInstanceGroupsFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListInstanceGroupsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListInstanceGroupsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListInstanceGroupsPagedResponse + extends AbstractPagedListResponse< + ListInstanceGroupsHttpRequest, InstanceGroupList, InstanceGroup, ListInstanceGroupsPage, + ListInstanceGroupsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListInstanceGroupsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListInstanceGroupsPagedResponse apply(ListInstanceGroupsPage input) { + return new ListInstanceGroupsPagedResponse(input); + } + }); + } + + private ListInstanceGroupsPagedResponse(ListInstanceGroupsPage page) { + super(page, ListInstanceGroupsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListInstanceGroupsPage + extends AbstractPage< + ListInstanceGroupsHttpRequest, InstanceGroupList, InstanceGroup, ListInstanceGroupsPage> { + + private ListInstanceGroupsPage( + PageContext context, + InstanceGroupList response) { + super(context, response); + } + + private static ListInstanceGroupsPage createEmptyPage() { + return new ListInstanceGroupsPage(null, null); + } + + @Override + protected ListInstanceGroupsPage createPage( + PageContext context, + InstanceGroupList response) { + return new ListInstanceGroupsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListInstanceGroupsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListInstanceGroupsHttpRequest, InstanceGroupList, InstanceGroup, ListInstanceGroupsPage, + ListInstanceGroupsFixedSizeCollection> { + + private ListInstanceGroupsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListInstanceGroupsFixedSizeCollection createEmptyCollection() { + return new ListInstanceGroupsFixedSizeCollection(null, 0); + } + + @Override + protected ListInstanceGroupsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListInstanceGroupsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListInstancesInstanceGroupsPagedResponse + extends AbstractPagedListResponse< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + InstanceWithNamedPorts, ListInstancesInstanceGroupsPage, + ListInstancesInstanceGroupsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + InstanceWithNamedPorts> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListInstancesInstanceGroupsPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + ListInstancesInstanceGroupsPage, ListInstancesInstanceGroupsPagedResponse>() { + @Override + public ListInstancesInstanceGroupsPagedResponse apply( + ListInstancesInstanceGroupsPage input) { + return new ListInstancesInstanceGroupsPagedResponse(input); + } + }); + } + + private ListInstancesInstanceGroupsPagedResponse(ListInstancesInstanceGroupsPage page) { + super(page, ListInstancesInstanceGroupsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListInstancesInstanceGroupsPage + extends AbstractPage< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + InstanceWithNamedPorts, ListInstancesInstanceGroupsPage> { + + private ListInstancesInstanceGroupsPage( + PageContext< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + InstanceWithNamedPorts> + context, + InstanceGroupsListInstances response) { + super(context, response); + } + + private static ListInstancesInstanceGroupsPage createEmptyPage() { + return new ListInstancesInstanceGroupsPage(null, null); + } + + @Override + protected ListInstancesInstanceGroupsPage createPage( + PageContext< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + InstanceWithNamedPorts> + context, + InstanceGroupsListInstances response) { + return new ListInstancesInstanceGroupsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + InstanceWithNamedPorts> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListInstancesInstanceGroupsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + InstanceWithNamedPorts, ListInstancesInstanceGroupsPage, + ListInstancesInstanceGroupsFixedSizeCollection> { + + private ListInstancesInstanceGroupsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListInstancesInstanceGroupsFixedSizeCollection createEmptyCollection() { + return new ListInstancesInstanceGroupsFixedSizeCollection(null, 0); + } + + @Override + protected ListInstancesInstanceGroupsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListInstancesInstanceGroupsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupList.java new file mode 100644 index 000000000000..5d45ba71b0dc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InstanceGroupList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InstanceGroupList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstanceGroupList other) { + if (other == InstanceGroupList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstanceGroupList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(InstanceGroup items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstanceGroupList build() { + + return new InstanceGroupList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupList) { + InstanceGroupList that = (InstanceGroupList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManager.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManager.java new file mode 100644 index 000000000000..c517a08d25fa --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManager.java @@ -0,0 +1,646 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupManager implements ApiMessage { + private final String baseInstanceName; + private final String creationTimestamp; + private final InstanceGroupManagerActionsSummary currentActions; + private final String description; + private final String fingerprint; + private final String id; + private final String instanceGroup; + private final String instanceTemplate; + private final String kind; + private final String name; + private final List namedPorts; + private final String region; + private final String selfLink; + private final List targetPools; + private final Integer targetSize; + private final String zone; + + private InstanceGroupManager() { + this.baseInstanceName = null; + this.creationTimestamp = null; + this.currentActions = null; + this.description = null; + this.fingerprint = null; + this.id = null; + this.instanceGroup = null; + this.instanceTemplate = null; + this.kind = null; + this.name = null; + this.namedPorts = null; + this.region = null; + this.selfLink = null; + this.targetPools = null; + this.targetSize = null; + this.zone = null; + } + + private InstanceGroupManager( + String baseInstanceName, + String creationTimestamp, + InstanceGroupManagerActionsSummary currentActions, + String description, + String fingerprint, + String id, + String instanceGroup, + String instanceTemplate, + String kind, + String name, + List namedPorts, + String region, + String selfLink, + List targetPools, + Integer targetSize, + String zone) { + this.baseInstanceName = baseInstanceName; + this.creationTimestamp = creationTimestamp; + this.currentActions = currentActions; + this.description = description; + this.fingerprint = fingerprint; + this.id = id; + this.instanceGroup = instanceGroup; + this.instanceTemplate = instanceTemplate; + this.kind = kind; + this.name = name; + this.namedPorts = namedPorts; + this.region = region; + this.selfLink = selfLink; + this.targetPools = targetPools; + this.targetSize = targetSize; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("baseInstanceName")) { + return baseInstanceName; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("currentActions")) { + return currentActions; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("instanceGroup")) { + return instanceGroup; + } + if (fieldName.equals("instanceTemplate")) { + return instanceTemplate; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("namedPorts")) { + return namedPorts; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("targetPools")) { + return targetPools; + } + if (fieldName.equals("targetSize")) { + return targetSize; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getBaseInstanceName() { + return baseInstanceName; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public InstanceGroupManagerActionsSummary getCurrentActions() { + return currentActions; + } + + public String getDescription() { + return description; + } + + public String getFingerprint() { + return fingerprint; + } + + public String getId() { + return id; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public List getNamedPortsList() { + return namedPorts; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public List getTargetPoolsList() { + return targetPools; + } + + public Integer getTargetSize() { + return targetSize; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupManager prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupManager getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupManager DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupManager(); + } + + public static class Builder { + private String baseInstanceName; + private String creationTimestamp; + private InstanceGroupManagerActionsSummary currentActions; + private String description; + private String fingerprint; + private String id; + private String instanceGroup; + private String instanceTemplate; + private String kind; + private String name; + private List namedPorts; + private String region; + private String selfLink; + private List targetPools; + private Integer targetSize; + private String zone; + + Builder() {} + + public Builder mergeFrom(InstanceGroupManager other) { + if (other == InstanceGroupManager.getDefaultInstance()) return this; + if (other.getBaseInstanceName() != null) { + this.baseInstanceName = other.baseInstanceName; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getCurrentActions() != null) { + this.currentActions = other.currentActions; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getInstanceGroup() != null) { + this.instanceGroup = other.instanceGroup; + } + if (other.getInstanceTemplate() != null) { + this.instanceTemplate = other.instanceTemplate; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNamedPortsList() != null) { + this.namedPorts = other.namedPorts; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getTargetPoolsList() != null) { + this.targetPools = other.targetPools; + } + if (other.getTargetSize() != null) { + this.targetSize = other.targetSize; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(InstanceGroupManager source) { + this.baseInstanceName = source.baseInstanceName; + this.creationTimestamp = source.creationTimestamp; + this.currentActions = source.currentActions; + this.description = source.description; + this.fingerprint = source.fingerprint; + this.id = source.id; + this.instanceGroup = source.instanceGroup; + this.instanceTemplate = source.instanceTemplate; + this.kind = source.kind; + this.name = source.name; + this.namedPorts = source.namedPorts; + this.region = source.region; + this.selfLink = source.selfLink; + this.targetPools = source.targetPools; + this.targetSize = source.targetSize; + this.zone = source.zone; + } + + public String getBaseInstanceName() { + return baseInstanceName; + } + + public Builder setBaseInstanceName(String baseInstanceName) { + this.baseInstanceName = baseInstanceName; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public InstanceGroupManagerActionsSummary getCurrentActions() { + return currentActions; + } + + public Builder setCurrentActions(InstanceGroupManagerActionsSummary currentActions) { + this.currentActions = currentActions; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public Builder setInstanceTemplate(String instanceTemplate) { + this.instanceTemplate = instanceTemplate; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public List getNamedPortsList() { + return namedPorts; + } + + public Builder addAllNamedPorts(List namedPorts) { + if (this.namedPorts == null) { + this.namedPorts = new ArrayList<>(namedPorts.size()); + } + this.namedPorts.addAll(namedPorts); + return this; + } + + public Builder addNamedPorts(NamedPort namedPorts) { + this.namedPorts.add(namedPorts); + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public List getTargetPoolsList() { + return targetPools; + } + + public Builder addAllTargetPools(List targetPools) { + if (this.targetPools == null) { + this.targetPools = new ArrayList<>(targetPools.size()); + } + this.targetPools.addAll(targetPools); + return this; + } + + public Builder addTargetPools(String targetPools) { + this.targetPools.add(targetPools); + return this; + } + + public Integer getTargetSize() { + return targetSize; + } + + public Builder setTargetSize(Integer targetSize) { + this.targetSize = targetSize; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public InstanceGroupManager build() { + + return new InstanceGroupManager( + baseInstanceName, + creationTimestamp, + currentActions, + description, + fingerprint, + id, + instanceGroup, + instanceTemplate, + kind, + name, + namedPorts, + region, + selfLink, + targetPools, + targetSize, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setBaseInstanceName(this.baseInstanceName); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setCurrentActions(this.currentActions); + newBuilder.setDescription(this.description); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.setId(this.id); + newBuilder.setInstanceGroup(this.instanceGroup); + newBuilder.setInstanceTemplate(this.instanceTemplate); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.addAllNamedPorts(this.namedPorts); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + newBuilder.addAllTargetPools(this.targetPools); + newBuilder.setTargetSize(this.targetSize); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupManager{" + + "baseInstanceName=" + + baseInstanceName + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "currentActions=" + + currentActions + + ", " + + "description=" + + description + + ", " + + "fingerprint=" + + fingerprint + + ", " + + "id=" + + id + + ", " + + "instanceGroup=" + + instanceGroup + + ", " + + "instanceTemplate=" + + instanceTemplate + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "namedPorts=" + + namedPorts + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + ", " + + "targetPools=" + + targetPools + + ", " + + "targetSize=" + + targetSize + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupManager) { + InstanceGroupManager that = (InstanceGroupManager) o; + return Objects.equals(this.baseInstanceName, that.getBaseInstanceName()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.currentActions, that.getCurrentActions()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals(this.instanceTemplate, that.getInstanceTemplate()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.namedPorts, that.getNamedPortsList()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.targetPools, that.getTargetPoolsList()) + && Objects.equals(this.targetSize, that.getTargetSize()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + baseInstanceName, + creationTimestamp, + currentActions, + description, + fingerprint, + id, + instanceGroup, + instanceTemplate, + kind, + name, + namedPorts, + region, + selfLink, + targetPools, + targetSize, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerActionsSummary.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerActionsSummary.java new file mode 100644 index 000000000000..e7dee1d39935 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerActionsSummary.java @@ -0,0 +1,373 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupManagerActionsSummary implements ApiMessage { + private final Integer abandoning; + private final Integer creating; + private final Integer creatingWithoutRetries; + private final Integer deleting; + private final Integer none; + private final Integer recreating; + private final Integer refreshing; + private final Integer restarting; + + private InstanceGroupManagerActionsSummary() { + this.abandoning = null; + this.creating = null; + this.creatingWithoutRetries = null; + this.deleting = null; + this.none = null; + this.recreating = null; + this.refreshing = null; + this.restarting = null; + } + + private InstanceGroupManagerActionsSummary( + Integer abandoning, + Integer creating, + Integer creatingWithoutRetries, + Integer deleting, + Integer none, + Integer recreating, + Integer refreshing, + Integer restarting) { + this.abandoning = abandoning; + this.creating = creating; + this.creatingWithoutRetries = creatingWithoutRetries; + this.deleting = deleting; + this.none = none; + this.recreating = recreating; + this.refreshing = refreshing; + this.restarting = restarting; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("abandoning")) { + return abandoning; + } + if (fieldName.equals("creating")) { + return creating; + } + if (fieldName.equals("creatingWithoutRetries")) { + return creatingWithoutRetries; + } + if (fieldName.equals("deleting")) { + return deleting; + } + if (fieldName.equals("none")) { + return none; + } + if (fieldName.equals("recreating")) { + return recreating; + } + if (fieldName.equals("refreshing")) { + return refreshing; + } + if (fieldName.equals("restarting")) { + return restarting; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getAbandoning() { + return abandoning; + } + + public Integer getCreating() { + return creating; + } + + public Integer getCreatingWithoutRetries() { + return creatingWithoutRetries; + } + + public Integer getDeleting() { + return deleting; + } + + public Integer getNone() { + return none; + } + + public Integer getRecreating() { + return recreating; + } + + public Integer getRefreshing() { + return refreshing; + } + + public Integer getRestarting() { + return restarting; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupManagerActionsSummary prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupManagerActionsSummary getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupManagerActionsSummary DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupManagerActionsSummary(); + } + + public static class Builder { + private Integer abandoning; + private Integer creating; + private Integer creatingWithoutRetries; + private Integer deleting; + private Integer none; + private Integer recreating; + private Integer refreshing; + private Integer restarting; + + Builder() {} + + public Builder mergeFrom(InstanceGroupManagerActionsSummary other) { + if (other == InstanceGroupManagerActionsSummary.getDefaultInstance()) return this; + if (other.getAbandoning() != null) { + this.abandoning = other.abandoning; + } + if (other.getCreating() != null) { + this.creating = other.creating; + } + if (other.getCreatingWithoutRetries() != null) { + this.creatingWithoutRetries = other.creatingWithoutRetries; + } + if (other.getDeleting() != null) { + this.deleting = other.deleting; + } + if (other.getNone() != null) { + this.none = other.none; + } + if (other.getRecreating() != null) { + this.recreating = other.recreating; + } + if (other.getRefreshing() != null) { + this.refreshing = other.refreshing; + } + if (other.getRestarting() != null) { + this.restarting = other.restarting; + } + return this; + } + + Builder(InstanceGroupManagerActionsSummary source) { + this.abandoning = source.abandoning; + this.creating = source.creating; + this.creatingWithoutRetries = source.creatingWithoutRetries; + this.deleting = source.deleting; + this.none = source.none; + this.recreating = source.recreating; + this.refreshing = source.refreshing; + this.restarting = source.restarting; + } + + public Integer getAbandoning() { + return abandoning; + } + + public Builder setAbandoning(Integer abandoning) { + this.abandoning = abandoning; + return this; + } + + public Integer getCreating() { + return creating; + } + + public Builder setCreating(Integer creating) { + this.creating = creating; + return this; + } + + public Integer getCreatingWithoutRetries() { + return creatingWithoutRetries; + } + + public Builder setCreatingWithoutRetries(Integer creatingWithoutRetries) { + this.creatingWithoutRetries = creatingWithoutRetries; + return this; + } + + public Integer getDeleting() { + return deleting; + } + + public Builder setDeleting(Integer deleting) { + this.deleting = deleting; + return this; + } + + public Integer getNone() { + return none; + } + + public Builder setNone(Integer none) { + this.none = none; + return this; + } + + public Integer getRecreating() { + return recreating; + } + + public Builder setRecreating(Integer recreating) { + this.recreating = recreating; + return this; + } + + public Integer getRefreshing() { + return refreshing; + } + + public Builder setRefreshing(Integer refreshing) { + this.refreshing = refreshing; + return this; + } + + public Integer getRestarting() { + return restarting; + } + + public Builder setRestarting(Integer restarting) { + this.restarting = restarting; + return this; + } + + public InstanceGroupManagerActionsSummary build() { + + return new InstanceGroupManagerActionsSummary( + abandoning, + creating, + creatingWithoutRetries, + deleting, + none, + recreating, + refreshing, + restarting); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAbandoning(this.abandoning); + newBuilder.setCreating(this.creating); + newBuilder.setCreatingWithoutRetries(this.creatingWithoutRetries); + newBuilder.setDeleting(this.deleting); + newBuilder.setNone(this.none); + newBuilder.setRecreating(this.recreating); + newBuilder.setRefreshing(this.refreshing); + newBuilder.setRestarting(this.restarting); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupManagerActionsSummary{" + + "abandoning=" + + abandoning + + ", " + + "creating=" + + creating + + ", " + + "creatingWithoutRetries=" + + creatingWithoutRetries + + ", " + + "deleting=" + + deleting + + ", " + + "none=" + + none + + ", " + + "recreating=" + + recreating + + ", " + + "refreshing=" + + refreshing + + ", " + + "restarting=" + + restarting + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupManagerActionsSummary) { + InstanceGroupManagerActionsSummary that = (InstanceGroupManagerActionsSummary) o; + return Objects.equals(this.abandoning, that.getAbandoning()) + && Objects.equals(this.creating, that.getCreating()) + && Objects.equals(this.creatingWithoutRetries, that.getCreatingWithoutRetries()) + && Objects.equals(this.deleting, that.getDeleting()) + && Objects.equals(this.none, that.getNone()) + && Objects.equals(this.recreating, that.getRecreating()) + && Objects.equals(this.refreshing, that.getRefreshing()) + && Objects.equals(this.restarting, that.getRestarting()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + abandoning, + creating, + creatingWithoutRetries, + deleting, + none, + recreating, + refreshing, + restarting); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerAggregatedList.java new file mode 100644 index 000000000000..3f69694136f6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerAggregatedList.java @@ -0,0 +1,299 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupManagerAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InstanceGroupManagerAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InstanceGroupManagerAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupManagerAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupManagerAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupManagerAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupManagerAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstanceGroupManagerAggregatedList other) { + if (other == InstanceGroupManagerAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstanceGroupManagerAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstanceGroupManagerAggregatedList build() { + + return new InstanceGroupManagerAggregatedList( + id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupManagerAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupManagerAggregatedList) { + InstanceGroupManagerAggregatedList that = (InstanceGroupManagerAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerClient.java new file mode 100644 index 000000000000..c266a5718d82 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerClient.java @@ -0,0 +1,2041 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.InstanceGroupManagerStub; +import com.google.cloud.compute.v1.stub.InstanceGroupManagerStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+ *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+ *   InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+ *   Operation response = instanceGroupManagerClient.abandonInstancesInstanceGroupManager(instanceGroupManager, instanceGroupManagersAbandonInstancesRequestResource);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the instanceGroupManagerClient object to clean up + * resources such as threads. In the example above, try-with-resources is used, which automatically + * calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of InstanceGroupManagerSettings + * to create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * InstanceGroupManagerSettings instanceGroupManagerSettings =
+ *     InstanceGroupManagerSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * InstanceGroupManagerClient instanceGroupManagerClient =
+ *     InstanceGroupManagerClient.create(instanceGroupManagerSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * InstanceGroupManagerSettings instanceGroupManagerSettings =
+ *     InstanceGroupManagerSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * InstanceGroupManagerClient instanceGroupManagerClient =
+ *     InstanceGroupManagerClient.create(instanceGroupManagerSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceGroupManagerClient implements BackgroundResource { + private final InstanceGroupManagerSettings settings; + private final InstanceGroupManagerStub stub; + + /** Constructs an instance of InstanceGroupManagerClient with default settings. */ + public static final InstanceGroupManagerClient create() throws IOException { + return create(InstanceGroupManagerSettings.newBuilder().build()); + } + + /** + * Constructs an instance of InstanceGroupManagerClient, using the given settings. The channels + * are created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final InstanceGroupManagerClient create(InstanceGroupManagerSettings settings) + throws IOException { + return new InstanceGroupManagerClient(settings); + } + + /** + * Constructs an instance of InstanceGroupManagerClient, using the given stub for making calls. + * This is for advanced usage - prefer to use InstanceGroupManagerSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final InstanceGroupManagerClient create(InstanceGroupManagerStub stub) { + return new InstanceGroupManagerClient(stub); + } + + /** + * Constructs an instance of InstanceGroupManagerClient, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected InstanceGroupManagerClient(InstanceGroupManagerSettings settings) throws IOException { + this.settings = settings; + this.stub = ((InstanceGroupManagerStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected InstanceGroupManagerClient(InstanceGroupManagerStub stub) { + this.settings = null; + this.stub = stub; + } + + public final InstanceGroupManagerSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InstanceGroupManagerStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to remove the specified instances from the managed instance group. + * Abandoning an instance does not delete the instance, but it does remove the instance from any + * target pools that are applied by the managed instance group. This method reduces the targetSize + * of the managed instance group by the number of instances that you abandon. This operation is + * marked as DONE when the action is scheduled even if the instances have not yet been removed + * from the group. You must separately verify the status of the abandoning action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.abandonInstancesInstanceGroupManager(instanceGroupManager, instanceGroupManagersAbandonInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param instanceGroupManagersAbandonInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation abandonInstancesInstanceGroupManager( + ProjectZoneInstanceGroupManagerName instanceGroupManager, + InstanceGroupManagersAbandonInstancesRequest + instanceGroupManagersAbandonInstancesRequestResource) { + + AbandonInstancesInstanceGroupManagerHttpRequest request = + AbandonInstancesInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .setInstanceGroupManagersAbandonInstancesRequestResource( + instanceGroupManagersAbandonInstancesRequestResource) + .build(); + return abandonInstancesInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to remove the specified instances from the managed instance group. + * Abandoning an instance does not delete the instance, but it does remove the instance from any + * target pools that are applied by the managed instance group. This method reduces the targetSize + * of the managed instance group by the number of instances that you abandon. This operation is + * marked as DONE when the action is scheduled even if the instances have not yet been removed + * from the group. You must separately verify the status of the abandoning action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.abandonInstancesInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagersAbandonInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param instanceGroupManagersAbandonInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation abandonInstancesInstanceGroupManager( + String instanceGroupManager, + InstanceGroupManagersAbandonInstancesRequest + instanceGroupManagersAbandonInstancesRequestResource) { + + AbandonInstancesInstanceGroupManagerHttpRequest request = + AbandonInstancesInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setInstanceGroupManagersAbandonInstancesRequestResource( + instanceGroupManagersAbandonInstancesRequestResource) + .build(); + return abandonInstancesInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to remove the specified instances from the managed instance group. + * Abandoning an instance does not delete the instance, but it does remove the instance from any + * target pools that are applied by the managed instance group. This method reduces the targetSize + * of the managed instance group by the number of instances that you abandon. This operation is + * marked as DONE when the action is scheduled even if the instances have not yet been removed + * from the group. You must separately verify the status of the abandoning action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+   *   AbandonInstancesInstanceGroupManagerHttpRequest request = AbandonInstancesInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setInstanceGroupManagersAbandonInstancesRequestResource(instanceGroupManagersAbandonInstancesRequestResource)
+   *     .build();
+   *   Operation response = instanceGroupManagerClient.abandonInstancesInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation abandonInstancesInstanceGroupManager( + AbandonInstancesInstanceGroupManagerHttpRequest request) { + return abandonInstancesInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to remove the specified instances from the managed instance group. + * Abandoning an instance does not delete the instance, but it does remove the instance from any + * target pools that are applied by the managed instance group. This method reduces the targetSize + * of the managed instance group by the number of instances that you abandon. This operation is + * marked as DONE when the action is scheduled even if the instances have not yet been removed + * from the group. You must separately verify the status of the abandoning action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+   *   AbandonInstancesInstanceGroupManagerHttpRequest request = AbandonInstancesInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setInstanceGroupManagersAbandonInstancesRequestResource(instanceGroupManagersAbandonInstancesRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupManagerClient.abandonInstancesInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + abandonInstancesInstanceGroupManagerCallable() { + return stub.abandonInstancesInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of managed instance groups and groups them by zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InstanceGroupManagersScopedList element : instanceGroupManagerClient.aggregatedListInstanceGroupManagers(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInstanceGroupManagersPagedResponse aggregatedListInstanceGroupManagers( + ProjectName project) { + AggregatedListInstanceGroupManagersHttpRequest request = + AggregatedListInstanceGroupManagersHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListInstanceGroupManagers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of managed instance groups and groups them by zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InstanceGroupManagersScopedList element : instanceGroupManagerClient.aggregatedListInstanceGroupManagers(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInstanceGroupManagersPagedResponse aggregatedListInstanceGroupManagers( + String project) { + AggregatedListInstanceGroupManagersHttpRequest request = + AggregatedListInstanceGroupManagersHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListInstanceGroupManagers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of managed instance groups and groups them by zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInstanceGroupManagersHttpRequest request = AggregatedListInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (InstanceGroupManagersScopedList element : instanceGroupManagerClient.aggregatedListInstanceGroupManagers(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInstanceGroupManagersPagedResponse aggregatedListInstanceGroupManagers( + AggregatedListInstanceGroupManagersHttpRequest request) { + return aggregatedListInstanceGroupManagersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of managed instance groups and groups them by zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInstanceGroupManagersHttpRequest request = AggregatedListInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListInstanceGroupManagersPagedResponse> future = instanceGroupManagerClient.aggregatedListInstanceGroupManagersPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InstanceGroupManagersScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListInstanceGroupManagersHttpRequest, + AggregatedListInstanceGroupManagersPagedResponse> + aggregatedListInstanceGroupManagersPagedCallable() { + return stub.aggregatedListInstanceGroupManagersPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of managed instance groups and groups them by zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInstanceGroupManagersHttpRequest request = AggregatedListInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     InstanceGroupManagerAggregatedList response = instanceGroupManagerClient.aggregatedListInstanceGroupManagersCallable().call(request);
+   *     for (InstanceGroupManagersScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList> + aggregatedListInstanceGroupManagersCallable() { + return stub.aggregatedListInstanceGroupManagersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified managed instance group and all of the instances in that group. Note that + * the instance group must not belong to a backend service. Read Deleting an instance group for + * more information. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   Operation response = instanceGroupManagerClient.deleteInstanceGroupManager(instanceGroupManager);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstanceGroupManager( + ProjectZoneInstanceGroupManagerName instanceGroupManager) { + + DeleteInstanceGroupManagerHttpRequest request = + DeleteInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .build(); + return deleteInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified managed instance group and all of the instances in that group. Note that + * the instance group must not belong to a backend service. Read Deleting an instance group for + * more information. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   Operation response = instanceGroupManagerClient.deleteInstanceGroupManager(instanceGroupManager.toString());
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstanceGroupManager(String instanceGroupManager) { + + DeleteInstanceGroupManagerHttpRequest request = + DeleteInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .build(); + return deleteInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified managed instance group and all of the instances in that group. Note that + * the instance group must not belong to a backend service. Read Deleting an instance group for + * more information. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   DeleteInstanceGroupManagerHttpRequest request = DeleteInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   Operation response = instanceGroupManagerClient.deleteInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstanceGroupManager(DeleteInstanceGroupManagerHttpRequest request) { + return deleteInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified managed instance group and all of the instances in that group. Note that + * the instance group must not belong to a backend service. Read Deleting an instance group for + * more information. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   DeleteInstanceGroupManagerHttpRequest request = DeleteInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupManagerClient.deleteInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteInstanceGroupManagerCallable() { + return stub.deleteInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to delete the specified instances in the managed instance group. The + * instances are also removed from any target pools of which they were a member. This method + * reduces the targetSize of the managed instance group by the number of instances that you + * delete. This operation is marked as DONE when the action is scheduled even if the instances are + * still being deleted. You must separately verify the status of the deleting action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource = InstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.deleteInstancesInstanceGroupManager(instanceGroupManager, instanceGroupManagersDeleteInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param instanceGroupManagersDeleteInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstancesInstanceGroupManager( + ProjectZoneInstanceGroupManagerName instanceGroupManager, + InstanceGroupManagersDeleteInstancesRequest + instanceGroupManagersDeleteInstancesRequestResource) { + + DeleteInstancesInstanceGroupManagerHttpRequest request = + DeleteInstancesInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .setInstanceGroupManagersDeleteInstancesRequestResource( + instanceGroupManagersDeleteInstancesRequestResource) + .build(); + return deleteInstancesInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to delete the specified instances in the managed instance group. The + * instances are also removed from any target pools of which they were a member. This method + * reduces the targetSize of the managed instance group by the number of instances that you + * delete. This operation is marked as DONE when the action is scheduled even if the instances are + * still being deleted. You must separately verify the status of the deleting action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource = InstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.deleteInstancesInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagersDeleteInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param instanceGroupManagersDeleteInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstancesInstanceGroupManager( + String instanceGroupManager, + InstanceGroupManagersDeleteInstancesRequest + instanceGroupManagersDeleteInstancesRequestResource) { + + DeleteInstancesInstanceGroupManagerHttpRequest request = + DeleteInstancesInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setInstanceGroupManagersDeleteInstancesRequestResource( + instanceGroupManagersDeleteInstancesRequestResource) + .build(); + return deleteInstancesInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to delete the specified instances in the managed instance group. The + * instances are also removed from any target pools of which they were a member. This method + * reduces the targetSize of the managed instance group by the number of instances that you + * delete. This operation is marked as DONE when the action is scheduled even if the instances are + * still being deleted. You must separately verify the status of the deleting action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource = InstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
+   *   DeleteInstancesInstanceGroupManagerHttpRequest request = DeleteInstancesInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setInstanceGroupManagersDeleteInstancesRequestResource(instanceGroupManagersDeleteInstancesRequestResource)
+   *     .build();
+   *   Operation response = instanceGroupManagerClient.deleteInstancesInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstancesInstanceGroupManager( + DeleteInstancesInstanceGroupManagerHttpRequest request) { + return deleteInstancesInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to delete the specified instances in the managed instance group. The + * instances are also removed from any target pools of which they were a member. This method + * reduces the targetSize of the managed instance group by the number of instances that you + * delete. This operation is marked as DONE when the action is scheduled even if the instances are + * still being deleted. You must separately verify the status of the deleting action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource = InstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
+   *   DeleteInstancesInstanceGroupManagerHttpRequest request = DeleteInstancesInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setInstanceGroupManagersDeleteInstancesRequestResource(instanceGroupManagersDeleteInstancesRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupManagerClient.deleteInstancesInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteInstancesInstanceGroupManagerCallable() { + return stub.deleteInstancesInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns all of the details about the specified managed instance group. Gets a list of available + * managed instance groups by making a list() request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManager response = instanceGroupManagerClient.getInstanceGroupManager(instanceGroupManager);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroupManager getInstanceGroupManager( + ProjectZoneInstanceGroupManagerName instanceGroupManager) { + + GetInstanceGroupManagerHttpRequest request = + GetInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .build(); + return getInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns all of the details about the specified managed instance group. Gets a list of available + * managed instance groups by making a list() request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManager response = instanceGroupManagerClient.getInstanceGroupManager(instanceGroupManager.toString());
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroupManager getInstanceGroupManager(String instanceGroupManager) { + + GetInstanceGroupManagerHttpRequest request = + GetInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .build(); + return getInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns all of the details about the specified managed instance group. Gets a list of available + * managed instance groups by making a list() request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   GetInstanceGroupManagerHttpRequest request = GetInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   InstanceGroupManager response = instanceGroupManagerClient.getInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroupManager getInstanceGroupManager( + GetInstanceGroupManagerHttpRequest request) { + return getInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns all of the details about the specified managed instance group. Gets a list of available + * managed instance groups by making a list() request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   GetInstanceGroupManagerHttpRequest request = GetInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   ApiFuture<InstanceGroupManager> future = instanceGroupManagerClient.getInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   InstanceGroupManager response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getInstanceGroupManagerCallable() { + return stub.getInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a managed instance group using the information that you specify in the request. After + * the group is created, it schedules an action to create instances in the group using the + * specified instance template. This operation is marked as DONE when the group is created even if + * the instances in the group have not yet been created. You must separately verify the status of + * the individual instances with the listmanagedinstances method. + * + *

A managed instance group can have up to 1000 VM instances per group. Please contact Cloud + * Support if you need an increase in this limit. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.insertInstanceGroupManager(zone, instanceGroupManagerResource);
+   * }
+   * 
+ * + * @param zone The name of the zone where you want to create the managed instance group. + * @param instanceGroupManagerResource An Instance Group Manager resource. (== resource_for + * beta.instanceGroupManagers ==) (== resource_for v1.instanceGroupManagers ==) (== + * resource_for beta.regionInstanceGroupManagers ==) (== resource_for + * v1.regionInstanceGroupManagers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstanceGroupManager( + ProjectZoneName zone, InstanceGroupManager instanceGroupManagerResource) { + + InsertInstanceGroupManagerHttpRequest request = + InsertInstanceGroupManagerHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .setInstanceGroupManagerResource(instanceGroupManagerResource) + .build(); + return insertInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a managed instance group using the information that you specify in the request. After + * the group is created, it schedules an action to create instances in the group using the + * specified instance template. This operation is marked as DONE when the group is created even if + * the instances in the group have not yet been created. You must separately verify the status of + * the individual instances with the listmanagedinstances method. + * + *

A managed instance group can have up to 1000 VM instances per group. Please contact Cloud + * Support if you need an increase in this limit. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.insertInstanceGroupManager(zone.toString(), instanceGroupManagerResource);
+   * }
+   * 
+ * + * @param zone The name of the zone where you want to create the managed instance group. + * @param instanceGroupManagerResource An Instance Group Manager resource. (== resource_for + * beta.instanceGroupManagers ==) (== resource_for v1.instanceGroupManagers ==) (== + * resource_for beta.regionInstanceGroupManagers ==) (== resource_for + * v1.regionInstanceGroupManagers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstanceGroupManager( + String zone, InstanceGroupManager instanceGroupManagerResource) { + + InsertInstanceGroupManagerHttpRequest request = + InsertInstanceGroupManagerHttpRequest.newBuilder() + .setZone(zone) + .setInstanceGroupManagerResource(instanceGroupManagerResource) + .build(); + return insertInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a managed instance group using the information that you specify in the request. After + * the group is created, it schedules an action to create instances in the group using the + * specified instance template. This operation is marked as DONE when the group is created even if + * the instances in the group have not yet been created. You must separately verify the status of + * the individual instances with the listmanagedinstances method. + * + *

A managed instance group can have up to 1000 VM instances per group. Please contact Cloud + * Support if you need an increase in this limit. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
+   *   InsertInstanceGroupManagerHttpRequest request = InsertInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setInstanceGroupManagerResource(instanceGroupManagerResource)
+   *     .build();
+   *   Operation response = instanceGroupManagerClient.insertInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstanceGroupManager(InsertInstanceGroupManagerHttpRequest request) { + return insertInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a managed instance group using the information that you specify in the request. After + * the group is created, it schedules an action to create instances in the group using the + * specified instance template. This operation is marked as DONE when the group is created even if + * the instances in the group have not yet been created. You must separately verify the status of + * the individual instances with the listmanagedinstances method. + * + *

A managed instance group can have up to 1000 VM instances per group. Please contact Cloud + * Support if you need an increase in this limit. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
+   *   InsertInstanceGroupManagerHttpRequest request = InsertInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setInstanceGroupManagerResource(instanceGroupManagerResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupManagerClient.insertInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertInstanceGroupManagerCallable() { + return stub.insertInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of managed instance groups that are contained within the specified project and + * zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (InstanceGroupManager element : instanceGroupManagerClient.listInstanceGroupManagers(zone).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone where the managed instance group is located. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstanceGroupManagersPagedResponse listInstanceGroupManagers( + ProjectZoneName zone) { + ListInstanceGroupManagersHttpRequest request = + ListInstanceGroupManagersHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .build(); + return listInstanceGroupManagers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of managed instance groups that are contained within the specified project and + * zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (InstanceGroupManager element : instanceGroupManagerClient.listInstanceGroupManagers(zone.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone where the managed instance group is located. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstanceGroupManagersPagedResponse listInstanceGroupManagers(String zone) { + ListInstanceGroupManagersHttpRequest request = + ListInstanceGroupManagersHttpRequest.newBuilder().setZone(zone).build(); + return listInstanceGroupManagers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of managed instance groups that are contained within the specified project and + * zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListInstanceGroupManagersHttpRequest request = ListInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   for (InstanceGroupManager element : instanceGroupManagerClient.listInstanceGroupManagers(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstanceGroupManagersPagedResponse listInstanceGroupManagers( + ListInstanceGroupManagersHttpRequest request) { + return listInstanceGroupManagersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of managed instance groups that are contained within the specified project and + * zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListInstanceGroupManagersHttpRequest request = ListInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   ApiFuture<ListInstanceGroupManagersPagedResponse> future = instanceGroupManagerClient.listInstanceGroupManagersPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InstanceGroupManager element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListInstanceGroupManagersHttpRequest, ListInstanceGroupManagersPagedResponse> + listInstanceGroupManagersPagedCallable() { + return stub.listInstanceGroupManagersPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of managed instance groups that are contained within the specified project and + * zone. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListInstanceGroupManagersHttpRequest request = ListInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   while (true) {
+   *     InstanceGroupManagerList response = instanceGroupManagerClient.listInstanceGroupManagersCallable().call(request);
+   *     for (InstanceGroupManager element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listInstanceGroupManagersCallable() { + return stub.listInstanceGroupManagersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all of the instances in the managed instance group. Each instance in the list has a + * currentAction, which indicates the action that the managed instance group is performing on the + * instance. For example, if the group is still creating an instance, the currentAction is + * CREATING. If a previous action failed, the list displays the errors for that failed action. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersListManagedInstancesResponse response = instanceGroupManagerClient.listManagedInstancesInstanceGroupManagers(instanceGroupManager);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroupManagersListManagedInstancesResponse + listManagedInstancesInstanceGroupManagers( + ProjectZoneInstanceGroupManagerName instanceGroupManager) { + + ListManagedInstancesInstanceGroupManagersHttpRequest request = + ListManagedInstancesInstanceGroupManagersHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .build(); + return listManagedInstancesInstanceGroupManagers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all of the instances in the managed instance group. Each instance in the list has a + * currentAction, which indicates the action that the managed instance group is performing on the + * instance. For example, if the group is still creating an instance, the currentAction is + * CREATING. If a previous action failed, the list displays the errors for that failed action. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersListManagedInstancesResponse response = instanceGroupManagerClient.listManagedInstancesInstanceGroupManagers(instanceGroupManager.toString());
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroupManagersListManagedInstancesResponse + listManagedInstancesInstanceGroupManagers(String instanceGroupManager) { + + ListManagedInstancesInstanceGroupManagersHttpRequest request = + ListManagedInstancesInstanceGroupManagersHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .build(); + return listManagedInstancesInstanceGroupManagers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all of the instances in the managed instance group. Each instance in the list has a + * currentAction, which indicates the action that the managed instance group is performing on the + * instance. For example, if the group is still creating an instance, the currentAction is + * CREATING. If a previous action failed, the list displays the errors for that failed action. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   ListManagedInstancesInstanceGroupManagersHttpRequest request = ListManagedInstancesInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   InstanceGroupManagersListManagedInstancesResponse response = instanceGroupManagerClient.listManagedInstancesInstanceGroupManagers(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroupManagersListManagedInstancesResponse + listManagedInstancesInstanceGroupManagers( + ListManagedInstancesInstanceGroupManagersHttpRequest request) { + return listManagedInstancesInstanceGroupManagersCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all of the instances in the managed instance group. Each instance in the list has a + * currentAction, which indicates the action that the managed instance group is performing on the + * instance. For example, if the group is still creating an instance, the currentAction is + * CREATING. If a previous action failed, the list displays the errors for that failed action. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   ListManagedInstancesInstanceGroupManagersHttpRequest request = ListManagedInstancesInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   ApiFuture<InstanceGroupManagersListManagedInstancesResponse> future = instanceGroupManagerClient.listManagedInstancesInstanceGroupManagersCallable().futureCall(request);
+   *   // Do something
+   *   InstanceGroupManagersListManagedInstancesResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersCallable() { + return stub.listManagedInstancesInstanceGroupManagersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to recreate the specified instances in the managed instance group. The + * instances are deleted and recreated using the current instance template for the managed + * instance group. This operation is marked as DONE when the action is scheduled even if the + * instances have not yet been recreated. You must separately verify the status of the recreating + * action with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource = InstanceGroupManagersRecreateInstancesRequest.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.recreateInstancesInstanceGroupManager(instanceGroupManager, instanceGroupManagersRecreateInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param instanceGroupManagersRecreateInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation recreateInstancesInstanceGroupManager( + ProjectZoneInstanceGroupManagerName instanceGroupManager, + InstanceGroupManagersRecreateInstancesRequest + instanceGroupManagersRecreateInstancesRequestResource) { + + RecreateInstancesInstanceGroupManagerHttpRequest request = + RecreateInstancesInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .setInstanceGroupManagersRecreateInstancesRequestResource( + instanceGroupManagersRecreateInstancesRequestResource) + .build(); + return recreateInstancesInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to recreate the specified instances in the managed instance group. The + * instances are deleted and recreated using the current instance template for the managed + * instance group. This operation is marked as DONE when the action is scheduled even if the + * instances have not yet been recreated. You must separately verify the status of the recreating + * action with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource = InstanceGroupManagersRecreateInstancesRequest.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.recreateInstancesInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagersRecreateInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param instanceGroupManagersRecreateInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation recreateInstancesInstanceGroupManager( + String instanceGroupManager, + InstanceGroupManagersRecreateInstancesRequest + instanceGroupManagersRecreateInstancesRequestResource) { + + RecreateInstancesInstanceGroupManagerHttpRequest request = + RecreateInstancesInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setInstanceGroupManagersRecreateInstancesRequestResource( + instanceGroupManagersRecreateInstancesRequestResource) + .build(); + return recreateInstancesInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to recreate the specified instances in the managed instance group. The + * instances are deleted and recreated using the current instance template for the managed + * instance group. This operation is marked as DONE when the action is scheduled even if the + * instances have not yet been recreated. You must separately verify the status of the recreating + * action with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource = InstanceGroupManagersRecreateInstancesRequest.newBuilder().build();
+   *   RecreateInstancesInstanceGroupManagerHttpRequest request = RecreateInstancesInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setInstanceGroupManagersRecreateInstancesRequestResource(instanceGroupManagersRecreateInstancesRequestResource)
+   *     .build();
+   *   Operation response = instanceGroupManagerClient.recreateInstancesInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation recreateInstancesInstanceGroupManager( + RecreateInstancesInstanceGroupManagerHttpRequest request) { + return recreateInstancesInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to recreate the specified instances in the managed instance group. The + * instances are deleted and recreated using the current instance template for the managed + * instance group. This operation is marked as DONE when the action is scheduled even if the + * instances have not yet been recreated. You must separately verify the status of the recreating + * action with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource = InstanceGroupManagersRecreateInstancesRequest.newBuilder().build();
+   *   RecreateInstancesInstanceGroupManagerHttpRequest request = RecreateInstancesInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setInstanceGroupManagersRecreateInstancesRequestResource(instanceGroupManagersRecreateInstancesRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupManagerClient.recreateInstancesInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + recreateInstancesInstanceGroupManagerCallable() { + return stub.recreateInstancesInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the managed instance group. If you increase the size, the group creates new instances + * using the current instance template. If you decrease the size, the group deletes instances. The + * resize operation is marked DONE when the resize actions are scheduled even if the group has not + * yet added or deleted any instances. You must separately verify the status of the creating or + * deleting actions with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   Integer size = 0;
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   Operation response = instanceGroupManagerClient.resizeInstanceGroupManager(size, instanceGroupManager);
+   * }
+   * 
+ * + * @param size The number of running instances that the managed instance group should maintain at + * any given time. The group automatically adds or removes instances to maintain the number of + * instances specified by this parameter. + * @param instanceGroupManager The name of the managed instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeInstanceGroupManager( + Integer size, ProjectZoneInstanceGroupManagerName instanceGroupManager) { + + ResizeInstanceGroupManagerHttpRequest request = + ResizeInstanceGroupManagerHttpRequest.newBuilder() + .setSize(size) + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .build(); + return resizeInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the managed instance group. If you increase the size, the group creates new instances + * using the current instance template. If you decrease the size, the group deletes instances. The + * resize operation is marked DONE when the resize actions are scheduled even if the group has not + * yet added or deleted any instances. You must separately verify the status of the creating or + * deleting actions with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   Integer size = 0;
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   Operation response = instanceGroupManagerClient.resizeInstanceGroupManager(size, instanceGroupManager.toString());
+   * }
+   * 
+ * + * @param size The number of running instances that the managed instance group should maintain at + * any given time. The group automatically adds or removes instances to maintain the number of + * instances specified by this parameter. + * @param instanceGroupManager The name of the managed instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeInstanceGroupManager(Integer size, String instanceGroupManager) { + + ResizeInstanceGroupManagerHttpRequest request = + ResizeInstanceGroupManagerHttpRequest.newBuilder() + .setSize(size) + .setInstanceGroupManager(instanceGroupManager) + .build(); + return resizeInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the managed instance group. If you increase the size, the group creates new instances + * using the current instance template. If you decrease the size, the group deletes instances. The + * resize operation is marked DONE when the resize actions are scheduled even if the group has not + * yet added or deleted any instances. You must separately verify the status of the creating or + * deleting actions with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   Integer size = 0;
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   ResizeInstanceGroupManagerHttpRequest request = ResizeInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setSize(size)
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   Operation response = instanceGroupManagerClient.resizeInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeInstanceGroupManager(ResizeInstanceGroupManagerHttpRequest request) { + return resizeInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the managed instance group. If you increase the size, the group creates new instances + * using the current instance template. If you decrease the size, the group deletes instances. The + * resize operation is marked DONE when the resize actions are scheduled even if the group has not + * yet added or deleted any instances. You must separately verify the status of the creating or + * deleting actions with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   Integer size = 0;
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   ResizeInstanceGroupManagerHttpRequest request = ResizeInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setSize(size)
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupManagerClient.resizeInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + resizeInstanceGroupManagerCallable() { + return stub.resizeInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Specifies the instance template to use when creating new instances in this group. The templates + * for existing instances in the group do not change unless you recreate them. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource = InstanceGroupManagersSetInstanceTemplateRequest.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.setInstanceTemplateInstanceGroupManager(instanceGroupManager, instanceGroupManagersSetInstanceTemplateRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param instanceGroupManagersSetInstanceTemplateRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setInstanceTemplateInstanceGroupManager( + ProjectZoneInstanceGroupManagerName instanceGroupManager, + InstanceGroupManagersSetInstanceTemplateRequest + instanceGroupManagersSetInstanceTemplateRequestResource) { + + SetInstanceTemplateInstanceGroupManagerHttpRequest request = + SetInstanceTemplateInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .setInstanceGroupManagersSetInstanceTemplateRequestResource( + instanceGroupManagersSetInstanceTemplateRequestResource) + .build(); + return setInstanceTemplateInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Specifies the instance template to use when creating new instances in this group. The templates + * for existing instances in the group do not change unless you recreate them. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource = InstanceGroupManagersSetInstanceTemplateRequest.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.setInstanceTemplateInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagersSetInstanceTemplateRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param instanceGroupManagersSetInstanceTemplateRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setInstanceTemplateInstanceGroupManager( + String instanceGroupManager, + InstanceGroupManagersSetInstanceTemplateRequest + instanceGroupManagersSetInstanceTemplateRequestResource) { + + SetInstanceTemplateInstanceGroupManagerHttpRequest request = + SetInstanceTemplateInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setInstanceGroupManagersSetInstanceTemplateRequestResource( + instanceGroupManagersSetInstanceTemplateRequestResource) + .build(); + return setInstanceTemplateInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Specifies the instance template to use when creating new instances in this group. The templates + * for existing instances in the group do not change unless you recreate them. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource = InstanceGroupManagersSetInstanceTemplateRequest.newBuilder().build();
+   *   SetInstanceTemplateInstanceGroupManagerHttpRequest request = SetInstanceTemplateInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setInstanceGroupManagersSetInstanceTemplateRequestResource(instanceGroupManagersSetInstanceTemplateRequestResource)
+   *     .build();
+   *   Operation response = instanceGroupManagerClient.setInstanceTemplateInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setInstanceTemplateInstanceGroupManager( + SetInstanceTemplateInstanceGroupManagerHttpRequest request) { + return setInstanceTemplateInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Specifies the instance template to use when creating new instances in this group. The templates + * for existing instances in the group do not change unless you recreate them. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource = InstanceGroupManagersSetInstanceTemplateRequest.newBuilder().build();
+   *   SetInstanceTemplateInstanceGroupManagerHttpRequest request = SetInstanceTemplateInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setInstanceGroupManagersSetInstanceTemplateRequestResource(instanceGroupManagersSetInstanceTemplateRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupManagerClient.setInstanceTemplateInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setInstanceTemplateInstanceGroupManagerCallable() { + return stub.setInstanceTemplateInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Modifies the target pools to which all instances in this managed instance group are assigned. + * The target pools automatically apply to all of the instances in the managed instance group. + * This operation is marked DONE when you make the request even if the instances have not yet been + * added to their target pools. The change might take some time to apply to all of the instances + * in the group depending on the size of the group. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource = InstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.setTargetPoolsInstanceGroupManager(instanceGroupManager, instanceGroupManagersSetTargetPoolsRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param instanceGroupManagersSetTargetPoolsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetPoolsInstanceGroupManager( + ProjectZoneInstanceGroupManagerName instanceGroupManager, + InstanceGroupManagersSetTargetPoolsRequest + instanceGroupManagersSetTargetPoolsRequestResource) { + + SetTargetPoolsInstanceGroupManagerHttpRequest request = + SetTargetPoolsInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .setInstanceGroupManagersSetTargetPoolsRequestResource( + instanceGroupManagersSetTargetPoolsRequestResource) + .build(); + return setTargetPoolsInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Modifies the target pools to which all instances in this managed instance group are assigned. + * The target pools automatically apply to all of the instances in the managed instance group. + * This operation is marked DONE when you make the request even if the instances have not yet been + * added to their target pools. The change might take some time to apply to all of the instances + * in the group depending on the size of the group. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource = InstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
+   *   Operation response = instanceGroupManagerClient.setTargetPoolsInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagersSetTargetPoolsRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param instanceGroupManagersSetTargetPoolsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetPoolsInstanceGroupManager( + String instanceGroupManager, + InstanceGroupManagersSetTargetPoolsRequest + instanceGroupManagersSetTargetPoolsRequestResource) { + + SetTargetPoolsInstanceGroupManagerHttpRequest request = + SetTargetPoolsInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setInstanceGroupManagersSetTargetPoolsRequestResource( + instanceGroupManagersSetTargetPoolsRequestResource) + .build(); + return setTargetPoolsInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Modifies the target pools to which all instances in this managed instance group are assigned. + * The target pools automatically apply to all of the instances in the managed instance group. + * This operation is marked DONE when you make the request even if the instances have not yet been + * added to their target pools. The change might take some time to apply to all of the instances + * in the group depending on the size of the group. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource = InstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
+   *   SetTargetPoolsInstanceGroupManagerHttpRequest request = SetTargetPoolsInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setInstanceGroupManagersSetTargetPoolsRequestResource(instanceGroupManagersSetTargetPoolsRequestResource)
+   *     .build();
+   *   Operation response = instanceGroupManagerClient.setTargetPoolsInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetPoolsInstanceGroupManager( + SetTargetPoolsInstanceGroupManagerHttpRequest request) { + return setTargetPoolsInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Modifies the target pools to which all instances in this managed instance group are assigned. + * The target pools automatically apply to all of the instances in the managed instance group. + * This operation is marked DONE when you make the request even if the instances have not yet been + * added to their target pools. The change might take some time to apply to all of the instances + * in the group depending on the size of the group. + * + *

Sample code: + * + *


+   * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+   *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource = InstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
+   *   SetTargetPoolsInstanceGroupManagerHttpRequest request = SetTargetPoolsInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setInstanceGroupManagersSetTargetPoolsRequestResource(instanceGroupManagersSetTargetPoolsRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceGroupManagerClient.setTargetPoolsInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setTargetPoolsInstanceGroupManagerCallable() { + return stub.setTargetPoolsInstanceGroupManagerCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListInstanceGroupManagersPagedResponse + extends AbstractPagedListResponse< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + InstanceGroupManagersScopedList, AggregatedListInstanceGroupManagersPage, + AggregatedListInstanceGroupManagersFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + InstanceGroupManagersScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListInstanceGroupManagersPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + AggregatedListInstanceGroupManagersPage, + AggregatedListInstanceGroupManagersPagedResponse>() { + @Override + public AggregatedListInstanceGroupManagersPagedResponse apply( + AggregatedListInstanceGroupManagersPage input) { + return new AggregatedListInstanceGroupManagersPagedResponse(input); + } + }); + } + + private AggregatedListInstanceGroupManagersPagedResponse( + AggregatedListInstanceGroupManagersPage page) { + super(page, AggregatedListInstanceGroupManagersFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListInstanceGroupManagersPage + extends AbstractPage< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + InstanceGroupManagersScopedList, AggregatedListInstanceGroupManagersPage> { + + private AggregatedListInstanceGroupManagersPage( + PageContext< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + InstanceGroupManagersScopedList> + context, + InstanceGroupManagerAggregatedList response) { + super(context, response); + } + + private static AggregatedListInstanceGroupManagersPage createEmptyPage() { + return new AggregatedListInstanceGroupManagersPage(null, null); + } + + @Override + protected AggregatedListInstanceGroupManagersPage createPage( + PageContext< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + InstanceGroupManagersScopedList> + context, + InstanceGroupManagerAggregatedList response) { + return new AggregatedListInstanceGroupManagersPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + InstanceGroupManagersScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListInstanceGroupManagersFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + InstanceGroupManagersScopedList, AggregatedListInstanceGroupManagersPage, + AggregatedListInstanceGroupManagersFixedSizeCollection> { + + private AggregatedListInstanceGroupManagersFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListInstanceGroupManagersFixedSizeCollection createEmptyCollection() { + return new AggregatedListInstanceGroupManagersFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListInstanceGroupManagersFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListInstanceGroupManagersFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListInstanceGroupManagersPagedResponse + extends AbstractPagedListResponse< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, InstanceGroupManager, + ListInstanceGroupManagersPage, ListInstanceGroupManagersFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + InstanceGroupManager> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListInstanceGroupManagersPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListInstanceGroupManagersPagedResponse apply( + ListInstanceGroupManagersPage input) { + return new ListInstanceGroupManagersPagedResponse(input); + } + }); + } + + private ListInstanceGroupManagersPagedResponse(ListInstanceGroupManagersPage page) { + super(page, ListInstanceGroupManagersFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListInstanceGroupManagersPage + extends AbstractPage< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, InstanceGroupManager, + ListInstanceGroupManagersPage> { + + private ListInstanceGroupManagersPage( + PageContext< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + InstanceGroupManager> + context, + InstanceGroupManagerList response) { + super(context, response); + } + + private static ListInstanceGroupManagersPage createEmptyPage() { + return new ListInstanceGroupManagersPage(null, null); + } + + @Override + protected ListInstanceGroupManagersPage createPage( + PageContext< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + InstanceGroupManager> + context, + InstanceGroupManagerList response) { + return new ListInstanceGroupManagersPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + InstanceGroupManager> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListInstanceGroupManagersFixedSizeCollection + extends AbstractFixedSizeCollection< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, InstanceGroupManager, + ListInstanceGroupManagersPage, ListInstanceGroupManagersFixedSizeCollection> { + + private ListInstanceGroupManagersFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListInstanceGroupManagersFixedSizeCollection createEmptyCollection() { + return new ListInstanceGroupManagersFixedSizeCollection(null, 0); + } + + @Override + protected ListInstanceGroupManagersFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListInstanceGroupManagersFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerList.java new file mode 100644 index 000000000000..cf3f5523287f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupManagerList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InstanceGroupManagerList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InstanceGroupManagerList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupManagerList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupManagerList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupManagerList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupManagerList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstanceGroupManagerList other) { + if (other == InstanceGroupManagerList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstanceGroupManagerList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(InstanceGroupManager items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstanceGroupManagerList build() { + + return new InstanceGroupManagerList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupManagerList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupManagerList) { + InstanceGroupManagerList that = (InstanceGroupManagerList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerSettings.java new file mode 100644 index 000000000000..e50865548ae6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerSettings.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.InstanceGroupManagerStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InstanceGroupManagerClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of abandonInstancesInstanceGroupManager to 30 seconds: + * + *

+ * 
+ * InstanceGroupManagerSettings.Builder instanceGroupManagerSettingsBuilder =
+ *     InstanceGroupManagerSettings.newBuilder();
+ * instanceGroupManagerSettingsBuilder.abandonInstancesInstanceGroupManagerSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InstanceGroupManagerSettings instanceGroupManagerSettings = instanceGroupManagerSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceGroupManagerSettings extends ClientSettings { + /** + * Returns the object with the settings used for calls to abandonInstancesInstanceGroupManager. + */ + public UnaryCallSettings + abandonInstancesInstanceGroupManagerSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()) + .abandonInstancesInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to aggregatedListInstanceGroupManagers. */ + public PagedCallSettings< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + AggregatedListInstanceGroupManagersPagedResponse> + aggregatedListInstanceGroupManagersSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()) + .aggregatedListInstanceGroupManagersSettings(); + } + + /** Returns the object with the settings used for calls to deleteInstanceGroupManager. */ + public UnaryCallSettings + deleteInstanceGroupManagerSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()) + .deleteInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to deleteInstancesInstanceGroupManager. */ + public UnaryCallSettings + deleteInstancesInstanceGroupManagerSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()) + .deleteInstancesInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to getInstanceGroupManager. */ + public UnaryCallSettings + getInstanceGroupManagerSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()).getInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to insertInstanceGroupManager. */ + public UnaryCallSettings + insertInstanceGroupManagerSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()) + .insertInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to listInstanceGroupManagers. */ + public PagedCallSettings< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + ListInstanceGroupManagersPagedResponse> + listInstanceGroupManagersSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()) + .listInstanceGroupManagersSettings(); + } + + /** + * Returns the object with the settings used for calls to + * listManagedInstancesInstanceGroupManagers. + */ + public UnaryCallSettings< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()) + .listManagedInstancesInstanceGroupManagersSettings(); + } + + /** + * Returns the object with the settings used for calls to recreateInstancesInstanceGroupManager. + */ + public UnaryCallSettings + recreateInstancesInstanceGroupManagerSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()) + .recreateInstancesInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to resizeInstanceGroupManager. */ + public UnaryCallSettings + resizeInstanceGroupManagerSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()) + .resizeInstanceGroupManagerSettings(); + } + + /** + * Returns the object with the settings used for calls to setInstanceTemplateInstanceGroupManager. + */ + public UnaryCallSettings + setInstanceTemplateInstanceGroupManagerSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()) + .setInstanceTemplateInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to setTargetPoolsInstanceGroupManager. */ + public UnaryCallSettings + setTargetPoolsInstanceGroupManagerSettings() { + return ((InstanceGroupManagerStubSettings) getStubSettings()) + .setTargetPoolsInstanceGroupManagerSettings(); + } + + public static final InstanceGroupManagerSettings create(InstanceGroupManagerStubSettings stub) + throws IOException { + return new InstanceGroupManagerSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstanceGroupManagerStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return InstanceGroupManagerStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return InstanceGroupManagerStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return InstanceGroupManagerStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return InstanceGroupManagerStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstanceGroupManagerStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return InstanceGroupManagerStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return InstanceGroupManagerStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InstanceGroupManagerSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for InstanceGroupManagerSettings. */ + public static class Builder + extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(InstanceGroupManagerStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(InstanceGroupManagerStubSettings.newBuilder()); + } + + protected Builder(InstanceGroupManagerSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(InstanceGroupManagerStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public InstanceGroupManagerStubSettings.Builder getStubSettingsBuilder() { + return ((InstanceGroupManagerStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** + * Returns the builder for the settings used for calls to abandonInstancesInstanceGroupManager. + */ + public UnaryCallSettings.Builder + abandonInstancesInstanceGroupManagerSettings() { + return getStubSettingsBuilder().abandonInstancesInstanceGroupManagerSettings(); + } + + /** + * Returns the builder for the settings used for calls to aggregatedListInstanceGroupManagers. + */ + public PagedCallSettings.Builder< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + AggregatedListInstanceGroupManagersPagedResponse> + aggregatedListInstanceGroupManagersSettings() { + return getStubSettingsBuilder().aggregatedListInstanceGroupManagersSettings(); + } + + /** Returns the builder for the settings used for calls to deleteInstanceGroupManager. */ + public UnaryCallSettings.Builder + deleteInstanceGroupManagerSettings() { + return getStubSettingsBuilder().deleteInstanceGroupManagerSettings(); + } + + /** + * Returns the builder for the settings used for calls to deleteInstancesInstanceGroupManager. + */ + public UnaryCallSettings.Builder + deleteInstancesInstanceGroupManagerSettings() { + return getStubSettingsBuilder().deleteInstancesInstanceGroupManagerSettings(); + } + + /** Returns the builder for the settings used for calls to getInstanceGroupManager. */ + public UnaryCallSettings.Builder + getInstanceGroupManagerSettings() { + return getStubSettingsBuilder().getInstanceGroupManagerSettings(); + } + + /** Returns the builder for the settings used for calls to insertInstanceGroupManager. */ + public UnaryCallSettings.Builder + insertInstanceGroupManagerSettings() { + return getStubSettingsBuilder().insertInstanceGroupManagerSettings(); + } + + /** Returns the builder for the settings used for calls to listInstanceGroupManagers. */ + public PagedCallSettings.Builder< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + ListInstanceGroupManagersPagedResponse> + listInstanceGroupManagersSettings() { + return getStubSettingsBuilder().listInstanceGroupManagersSettings(); + } + + /** + * Returns the builder for the settings used for calls to + * listManagedInstancesInstanceGroupManagers. + */ + public UnaryCallSettings.Builder< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersSettings() { + return getStubSettingsBuilder().listManagedInstancesInstanceGroupManagersSettings(); + } + + /** + * Returns the builder for the settings used for calls to recreateInstancesInstanceGroupManager. + */ + public UnaryCallSettings.Builder + recreateInstancesInstanceGroupManagerSettings() { + return getStubSettingsBuilder().recreateInstancesInstanceGroupManagerSettings(); + } + + /** Returns the builder for the settings used for calls to resizeInstanceGroupManager. */ + public UnaryCallSettings.Builder + resizeInstanceGroupManagerSettings() { + return getStubSettingsBuilder().resizeInstanceGroupManagerSettings(); + } + + /** + * Returns the builder for the settings used for calls to + * setInstanceTemplateInstanceGroupManager. + */ + public UnaryCallSettings.Builder + setInstanceTemplateInstanceGroupManagerSettings() { + return getStubSettingsBuilder().setInstanceTemplateInstanceGroupManagerSettings(); + } + + /** + * Returns the builder for the settings used for calls to setTargetPoolsInstanceGroupManager. + */ + public UnaryCallSettings.Builder + setTargetPoolsInstanceGroupManagerSettings() { + return getStubSettingsBuilder().setTargetPoolsInstanceGroupManagerSettings(); + } + + @Override + public InstanceGroupManagerSettings build() throws IOException { + return new InstanceGroupManagerSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersAbandonInstancesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersAbandonInstancesRequest.java new file mode 100644 index 000000000000..b4b0f1a82ce7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersAbandonInstancesRequest.java @@ -0,0 +1,152 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupManagersAbandonInstancesRequest implements ApiMessage { + private final List instances; + + private InstanceGroupManagersAbandonInstancesRequest() { + this.instances = null; + } + + private InstanceGroupManagersAbandonInstancesRequest(List instances) { + this.instances = instances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instances")) { + return instances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstancesList() { + return instances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupManagersAbandonInstancesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupManagersAbandonInstancesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupManagersAbandonInstancesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupManagersAbandonInstancesRequest(); + } + + public static class Builder { + private List instances; + + Builder() {} + + public Builder mergeFrom(InstanceGroupManagersAbandonInstancesRequest other) { + if (other == InstanceGroupManagersAbandonInstancesRequest.getDefaultInstance()) return this; + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + return this; + } + + Builder(InstanceGroupManagersAbandonInstancesRequest source) { + this.instances = source.instances; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(String instances) { + this.instances.add(instances); + return this; + } + + public InstanceGroupManagersAbandonInstancesRequest build() { + return new InstanceGroupManagersAbandonInstancesRequest(instances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstances(this.instances); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupManagersAbandonInstancesRequest{" + "instances=" + instances + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupManagersAbandonInstancesRequest) { + InstanceGroupManagersAbandonInstancesRequest that = + (InstanceGroupManagersAbandonInstancesRequest) o; + return Objects.equals(this.instances, that.getInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersDeleteInstancesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersDeleteInstancesRequest.java new file mode 100644 index 000000000000..8b7e1fde5548 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersDeleteInstancesRequest.java @@ -0,0 +1,152 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupManagersDeleteInstancesRequest implements ApiMessage { + private final List instances; + + private InstanceGroupManagersDeleteInstancesRequest() { + this.instances = null; + } + + private InstanceGroupManagersDeleteInstancesRequest(List instances) { + this.instances = instances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instances")) { + return instances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstancesList() { + return instances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupManagersDeleteInstancesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupManagersDeleteInstancesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupManagersDeleteInstancesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupManagersDeleteInstancesRequest(); + } + + public static class Builder { + private List instances; + + Builder() {} + + public Builder mergeFrom(InstanceGroupManagersDeleteInstancesRequest other) { + if (other == InstanceGroupManagersDeleteInstancesRequest.getDefaultInstance()) return this; + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + return this; + } + + Builder(InstanceGroupManagersDeleteInstancesRequest source) { + this.instances = source.instances; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(String instances) { + this.instances.add(instances); + return this; + } + + public InstanceGroupManagersDeleteInstancesRequest build() { + return new InstanceGroupManagersDeleteInstancesRequest(instances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstances(this.instances); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupManagersDeleteInstancesRequest{" + "instances=" + instances + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupManagersDeleteInstancesRequest) { + InstanceGroupManagersDeleteInstancesRequest that = + (InstanceGroupManagersDeleteInstancesRequest) o; + return Objects.equals(this.instances, that.getInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersListManagedInstancesResponse.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersListManagedInstancesResponse.java new file mode 100644 index 000000000000..56adcdd6f18f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersListManagedInstancesResponse.java @@ -0,0 +1,157 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupManagersListManagedInstancesResponse implements ApiMessage { + private final List managedInstances; + + private InstanceGroupManagersListManagedInstancesResponse() { + this.managedInstances = null; + } + + private InstanceGroupManagersListManagedInstancesResponse( + List managedInstances) { + this.managedInstances = managedInstances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("managedInstances")) { + return managedInstances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getManagedInstancesList() { + return managedInstances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupManagersListManagedInstancesResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupManagersListManagedInstancesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupManagersListManagedInstancesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupManagersListManagedInstancesResponse(); + } + + public static class Builder { + private List managedInstances; + + Builder() {} + + public Builder mergeFrom(InstanceGroupManagersListManagedInstancesResponse other) { + if (other == InstanceGroupManagersListManagedInstancesResponse.getDefaultInstance()) + return this; + if (other.getManagedInstancesList() != null) { + this.managedInstances = other.managedInstances; + } + return this; + } + + Builder(InstanceGroupManagersListManagedInstancesResponse source) { + this.managedInstances = source.managedInstances; + } + + public List getManagedInstancesList() { + return managedInstances; + } + + public Builder addAllManagedInstances(List managedInstances) { + if (this.managedInstances == null) { + this.managedInstances = new ArrayList<>(managedInstances.size()); + } + this.managedInstances.addAll(managedInstances); + return this; + } + + public Builder addManagedInstances(ManagedInstance managedInstances) { + this.managedInstances.add(managedInstances); + return this; + } + + public InstanceGroupManagersListManagedInstancesResponse build() { + return new InstanceGroupManagersListManagedInstancesResponse(managedInstances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllManagedInstances(this.managedInstances); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupManagersListManagedInstancesResponse{" + + "managedInstances=" + + managedInstances + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupManagersListManagedInstancesResponse) { + InstanceGroupManagersListManagedInstancesResponse that = + (InstanceGroupManagersListManagedInstancesResponse) o; + return Objects.equals(this.managedInstances, that.getManagedInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(managedInstances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersRecreateInstancesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersRecreateInstancesRequest.java new file mode 100644 index 000000000000..26b38255944f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersRecreateInstancesRequest.java @@ -0,0 +1,152 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupManagersRecreateInstancesRequest implements ApiMessage { + private final List instances; + + private InstanceGroupManagersRecreateInstancesRequest() { + this.instances = null; + } + + private InstanceGroupManagersRecreateInstancesRequest(List instances) { + this.instances = instances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instances")) { + return instances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstancesList() { + return instances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupManagersRecreateInstancesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupManagersRecreateInstancesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupManagersRecreateInstancesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupManagersRecreateInstancesRequest(); + } + + public static class Builder { + private List instances; + + Builder() {} + + public Builder mergeFrom(InstanceGroupManagersRecreateInstancesRequest other) { + if (other == InstanceGroupManagersRecreateInstancesRequest.getDefaultInstance()) return this; + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + return this; + } + + Builder(InstanceGroupManagersRecreateInstancesRequest source) { + this.instances = source.instances; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(String instances) { + this.instances.add(instances); + return this; + } + + public InstanceGroupManagersRecreateInstancesRequest build() { + return new InstanceGroupManagersRecreateInstancesRequest(instances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstances(this.instances); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupManagersRecreateInstancesRequest{" + "instances=" + instances + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupManagersRecreateInstancesRequest) { + InstanceGroupManagersRecreateInstancesRequest that = + (InstanceGroupManagersRecreateInstancesRequest) o; + return Objects.equals(this.instances, that.getInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersScopedList.java new file mode 100644 index 000000000000..2423d1f5b481 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersScopedList.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupManagersScopedList implements ApiMessage { + private final List instanceGroupManagers; + private final Warning warning; + + private InstanceGroupManagersScopedList() { + this.instanceGroupManagers = null; + this.warning = null; + } + + private InstanceGroupManagersScopedList( + List instanceGroupManagers, Warning warning) { + this.instanceGroupManagers = instanceGroupManagers; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instanceGroupManagers")) { + return instanceGroupManagers; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstanceGroupManagersList() { + return instanceGroupManagers; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupManagersScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupManagersScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupManagersScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupManagersScopedList(); + } + + public static class Builder { + private List instanceGroupManagers; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstanceGroupManagersScopedList other) { + if (other == InstanceGroupManagersScopedList.getDefaultInstance()) return this; + if (other.getInstanceGroupManagersList() != null) { + this.instanceGroupManagers = other.instanceGroupManagers; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstanceGroupManagersScopedList source) { + this.instanceGroupManagers = source.instanceGroupManagers; + this.warning = source.warning; + } + + public List getInstanceGroupManagersList() { + return instanceGroupManagers; + } + + public Builder addAllInstanceGroupManagers(List instanceGroupManagers) { + if (this.instanceGroupManagers == null) { + this.instanceGroupManagers = new ArrayList<>(instanceGroupManagers.size()); + } + this.instanceGroupManagers.addAll(instanceGroupManagers); + return this; + } + + public Builder addInstanceGroupManagers(InstanceGroupManager instanceGroupManagers) { + this.instanceGroupManagers.add(instanceGroupManagers); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstanceGroupManagersScopedList build() { + + return new InstanceGroupManagersScopedList(instanceGroupManagers, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstanceGroupManagers(this.instanceGroupManagers); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupManagersScopedList{" + + "instanceGroupManagers=" + + instanceGroupManagers + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupManagersScopedList) { + InstanceGroupManagersScopedList that = (InstanceGroupManagersScopedList) o; + return Objects.equals(this.instanceGroupManagers, that.getInstanceGroupManagersList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instanceGroupManagers, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersSetInstanceTemplateRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersSetInstanceTemplateRequest.java new file mode 100644 index 000000000000..a5a25c5e287b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersSetInstanceTemplateRequest.java @@ -0,0 +1,147 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupManagersSetInstanceTemplateRequest implements ApiMessage { + private final String instanceTemplate; + + private InstanceGroupManagersSetInstanceTemplateRequest() { + this.instanceTemplate = null; + } + + private InstanceGroupManagersSetInstanceTemplateRequest(String instanceTemplate) { + this.instanceTemplate = instanceTemplate; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instanceTemplate")) { + return instanceTemplate; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupManagersSetInstanceTemplateRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupManagersSetInstanceTemplateRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupManagersSetInstanceTemplateRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupManagersSetInstanceTemplateRequest(); + } + + public static class Builder { + private String instanceTemplate; + + Builder() {} + + public Builder mergeFrom(InstanceGroupManagersSetInstanceTemplateRequest other) { + if (other == InstanceGroupManagersSetInstanceTemplateRequest.getDefaultInstance()) + return this; + if (other.getInstanceTemplate() != null) { + this.instanceTemplate = other.instanceTemplate; + } + return this; + } + + Builder(InstanceGroupManagersSetInstanceTemplateRequest source) { + this.instanceTemplate = source.instanceTemplate; + } + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public Builder setInstanceTemplate(String instanceTemplate) { + this.instanceTemplate = instanceTemplate; + return this; + } + + public InstanceGroupManagersSetInstanceTemplateRequest build() { + return new InstanceGroupManagersSetInstanceTemplateRequest(instanceTemplate); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setInstanceTemplate(this.instanceTemplate); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupManagersSetInstanceTemplateRequest{" + + "instanceTemplate=" + + instanceTemplate + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupManagersSetInstanceTemplateRequest) { + InstanceGroupManagersSetInstanceTemplateRequest that = + (InstanceGroupManagersSetInstanceTemplateRequest) o; + return Objects.equals(this.instanceTemplate, that.getInstanceTemplate()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instanceTemplate); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersSetTargetPoolsRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersSetTargetPoolsRequest.java new file mode 100644 index 000000000000..b725f6531a08 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagersSetTargetPoolsRequest.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupManagersSetTargetPoolsRequest implements ApiMessage { + private final String fingerprint; + private final List targetPools; + + private InstanceGroupManagersSetTargetPoolsRequest() { + this.fingerprint = null; + this.targetPools = null; + } + + private InstanceGroupManagersSetTargetPoolsRequest(String fingerprint, List targetPools) { + this.fingerprint = fingerprint; + this.targetPools = targetPools; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("targetPools")) { + return targetPools; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getFingerprint() { + return fingerprint; + } + + public List getTargetPoolsList() { + return targetPools; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupManagersSetTargetPoolsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupManagersSetTargetPoolsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupManagersSetTargetPoolsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupManagersSetTargetPoolsRequest(); + } + + public static class Builder { + private String fingerprint; + private List targetPools; + + Builder() {} + + public Builder mergeFrom(InstanceGroupManagersSetTargetPoolsRequest other) { + if (other == InstanceGroupManagersSetTargetPoolsRequest.getDefaultInstance()) return this; + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getTargetPoolsList() != null) { + this.targetPools = other.targetPools; + } + return this; + } + + Builder(InstanceGroupManagersSetTargetPoolsRequest source) { + this.fingerprint = source.fingerprint; + this.targetPools = source.targetPools; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public List getTargetPoolsList() { + return targetPools; + } + + public Builder addAllTargetPools(List targetPools) { + if (this.targetPools == null) { + this.targetPools = new ArrayList<>(targetPools.size()); + } + this.targetPools.addAll(targetPools); + return this; + } + + public Builder addTargetPools(String targetPools) { + this.targetPools.add(targetPools); + return this; + } + + public InstanceGroupManagersSetTargetPoolsRequest build() { + + return new InstanceGroupManagersSetTargetPoolsRequest(fingerprint, targetPools); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.addAllTargetPools(this.targetPools); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupManagersSetTargetPoolsRequest{" + + "fingerprint=" + + fingerprint + + ", " + + "targetPools=" + + targetPools + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupManagersSetTargetPoolsRequest) { + InstanceGroupManagersSetTargetPoolsRequest that = + (InstanceGroupManagersSetTargetPoolsRequest) o; + return Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.targetPools, that.getTargetPoolsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(fingerprint, targetPools); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupSettings.java new file mode 100644 index 000000000000..6817b237372b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupSettings.java @@ -0,0 +1,292 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InstanceGroupClient.AggregatedListInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupClient.ListInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupClient.ListInstancesInstanceGroupsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.InstanceGroupStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InstanceGroupClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of addInstancesInstanceGroup to 30 seconds: + * + *

+ * 
+ * InstanceGroupSettings.Builder instanceGroupSettingsBuilder =
+ *     InstanceGroupSettings.newBuilder();
+ * instanceGroupSettingsBuilder.addInstancesInstanceGroupSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InstanceGroupSettings instanceGroupSettings = instanceGroupSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceGroupSettings extends ClientSettings { + /** Returns the object with the settings used for calls to addInstancesInstanceGroup. */ + public UnaryCallSettings + addInstancesInstanceGroupSettings() { + return ((InstanceGroupStubSettings) getStubSettings()).addInstancesInstanceGroupSettings(); + } + + /** Returns the object with the settings used for calls to aggregatedListInstanceGroups. */ + public PagedCallSettings< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + AggregatedListInstanceGroupsPagedResponse> + aggregatedListInstanceGroupsSettings() { + return ((InstanceGroupStubSettings) getStubSettings()).aggregatedListInstanceGroupsSettings(); + } + + /** Returns the object with the settings used for calls to deleteInstanceGroup. */ + public UnaryCallSettings + deleteInstanceGroupSettings() { + return ((InstanceGroupStubSettings) getStubSettings()).deleteInstanceGroupSettings(); + } + + /** Returns the object with the settings used for calls to getInstanceGroup. */ + public UnaryCallSettings getInstanceGroupSettings() { + return ((InstanceGroupStubSettings) getStubSettings()).getInstanceGroupSettings(); + } + + /** Returns the object with the settings used for calls to insertInstanceGroup. */ + public UnaryCallSettings + insertInstanceGroupSettings() { + return ((InstanceGroupStubSettings) getStubSettings()).insertInstanceGroupSettings(); + } + + /** Returns the object with the settings used for calls to listInstanceGroups. */ + public PagedCallSettings< + ListInstanceGroupsHttpRequest, InstanceGroupList, ListInstanceGroupsPagedResponse> + listInstanceGroupsSettings() { + return ((InstanceGroupStubSettings) getStubSettings()).listInstanceGroupsSettings(); + } + + /** Returns the object with the settings used for calls to listInstancesInstanceGroups. */ + public PagedCallSettings< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + ListInstancesInstanceGroupsPagedResponse> + listInstancesInstanceGroupsSettings() { + return ((InstanceGroupStubSettings) getStubSettings()).listInstancesInstanceGroupsSettings(); + } + + /** Returns the object with the settings used for calls to removeInstancesInstanceGroup. */ + public UnaryCallSettings + removeInstancesInstanceGroupSettings() { + return ((InstanceGroupStubSettings) getStubSettings()).removeInstancesInstanceGroupSettings(); + } + + /** Returns the object with the settings used for calls to setNamedPortsInstanceGroup. */ + public UnaryCallSettings + setNamedPortsInstanceGroupSettings() { + return ((InstanceGroupStubSettings) getStubSettings()).setNamedPortsInstanceGroupSettings(); + } + + public static final InstanceGroupSettings create(InstanceGroupStubSettings stub) + throws IOException { + return new InstanceGroupSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstanceGroupStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return InstanceGroupStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return InstanceGroupStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return InstanceGroupStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return InstanceGroupStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstanceGroupStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return InstanceGroupStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return InstanceGroupStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InstanceGroupSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for InstanceGroupSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(InstanceGroupStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(InstanceGroupStubSettings.newBuilder()); + } + + protected Builder(InstanceGroupSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(InstanceGroupStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public InstanceGroupStubSettings.Builder getStubSettingsBuilder() { + return ((InstanceGroupStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to addInstancesInstanceGroup. */ + public UnaryCallSettings.Builder + addInstancesInstanceGroupSettings() { + return getStubSettingsBuilder().addInstancesInstanceGroupSettings(); + } + + /** Returns the builder for the settings used for calls to aggregatedListInstanceGroups. */ + public PagedCallSettings.Builder< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + AggregatedListInstanceGroupsPagedResponse> + aggregatedListInstanceGroupsSettings() { + return getStubSettingsBuilder().aggregatedListInstanceGroupsSettings(); + } + + /** Returns the builder for the settings used for calls to deleteInstanceGroup. */ + public UnaryCallSettings.Builder + deleteInstanceGroupSettings() { + return getStubSettingsBuilder().deleteInstanceGroupSettings(); + } + + /** Returns the builder for the settings used for calls to getInstanceGroup. */ + public UnaryCallSettings.Builder + getInstanceGroupSettings() { + return getStubSettingsBuilder().getInstanceGroupSettings(); + } + + /** Returns the builder for the settings used for calls to insertInstanceGroup. */ + public UnaryCallSettings.Builder + insertInstanceGroupSettings() { + return getStubSettingsBuilder().insertInstanceGroupSettings(); + } + + /** Returns the builder for the settings used for calls to listInstanceGroups. */ + public PagedCallSettings.Builder< + ListInstanceGroupsHttpRequest, InstanceGroupList, ListInstanceGroupsPagedResponse> + listInstanceGroupsSettings() { + return getStubSettingsBuilder().listInstanceGroupsSettings(); + } + + /** Returns the builder for the settings used for calls to listInstancesInstanceGroups. */ + public PagedCallSettings.Builder< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + ListInstancesInstanceGroupsPagedResponse> + listInstancesInstanceGroupsSettings() { + return getStubSettingsBuilder().listInstancesInstanceGroupsSettings(); + } + + /** Returns the builder for the settings used for calls to removeInstancesInstanceGroup. */ + public UnaryCallSettings.Builder + removeInstancesInstanceGroupSettings() { + return getStubSettingsBuilder().removeInstancesInstanceGroupSettings(); + } + + /** Returns the builder for the settings used for calls to setNamedPortsInstanceGroup. */ + public UnaryCallSettings.Builder + setNamedPortsInstanceGroupSettings() { + return getStubSettingsBuilder().setNamedPortsInstanceGroupSettings(); + } + + @Override + public InstanceGroupSettings build() throws IOException { + return new InstanceGroupSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsAddInstancesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsAddInstancesRequest.java new file mode 100644 index 000000000000..019168d28d14 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsAddInstancesRequest.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupsAddInstancesRequest implements ApiMessage { + private final List instances; + + private InstanceGroupsAddInstancesRequest() { + this.instances = null; + } + + private InstanceGroupsAddInstancesRequest(List instances) { + this.instances = instances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instances")) { + return instances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstancesList() { + return instances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupsAddInstancesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupsAddInstancesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupsAddInstancesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupsAddInstancesRequest(); + } + + public static class Builder { + private List instances; + + Builder() {} + + public Builder mergeFrom(InstanceGroupsAddInstancesRequest other) { + if (other == InstanceGroupsAddInstancesRequest.getDefaultInstance()) return this; + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + return this; + } + + Builder(InstanceGroupsAddInstancesRequest source) { + this.instances = source.instances; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(InstanceReference instances) { + this.instances.add(instances); + return this; + } + + public InstanceGroupsAddInstancesRequest build() { + return new InstanceGroupsAddInstancesRequest(instances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstances(this.instances); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupsAddInstancesRequest{" + "instances=" + instances + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupsAddInstancesRequest) { + InstanceGroupsAddInstancesRequest that = (InstanceGroupsAddInstancesRequest) o; + return Objects.equals(this.instances, that.getInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsListInstances.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsListInstances.java new file mode 100644 index 000000000000..f981f564e892 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsListInstances.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupsListInstances implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InstanceGroupsListInstances() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InstanceGroupsListInstances( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupsListInstances prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupsListInstances getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupsListInstances DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupsListInstances(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstanceGroupsListInstances other) { + if (other == InstanceGroupsListInstances.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstanceGroupsListInstances source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(InstanceWithNamedPorts items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstanceGroupsListInstances build() { + + return new InstanceGroupsListInstances(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupsListInstances{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupsListInstances) { + InstanceGroupsListInstances that = (InstanceGroupsListInstances) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsListInstancesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsListInstancesRequest.java new file mode 100644 index 000000000000..84f5a6944f18 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsListInstancesRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupsListInstancesRequest implements ApiMessage { + private final String instanceState; + + private InstanceGroupsListInstancesRequest() { + this.instanceState = null; + } + + private InstanceGroupsListInstancesRequest(String instanceState) { + this.instanceState = instanceState; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instanceState")) { + return instanceState; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getInstanceState() { + return instanceState; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupsListInstancesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupsListInstancesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupsListInstancesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupsListInstancesRequest(); + } + + public static class Builder { + private String instanceState; + + Builder() {} + + public Builder mergeFrom(InstanceGroupsListInstancesRequest other) { + if (other == InstanceGroupsListInstancesRequest.getDefaultInstance()) return this; + if (other.getInstanceState() != null) { + this.instanceState = other.instanceState; + } + return this; + } + + Builder(InstanceGroupsListInstancesRequest source) { + this.instanceState = source.instanceState; + } + + public String getInstanceState() { + return instanceState; + } + + public Builder setInstanceState(String instanceState) { + this.instanceState = instanceState; + return this; + } + + public InstanceGroupsListInstancesRequest build() { + return new InstanceGroupsListInstancesRequest(instanceState); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setInstanceState(this.instanceState); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupsListInstancesRequest{" + "instanceState=" + instanceState + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupsListInstancesRequest) { + InstanceGroupsListInstancesRequest that = (InstanceGroupsListInstancesRequest) o; + return Objects.equals(this.instanceState, that.getInstanceState()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instanceState); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsRemoveInstancesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsRemoveInstancesRequest.java new file mode 100644 index 000000000000..3e5bf339f895 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsRemoveInstancesRequest.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupsRemoveInstancesRequest implements ApiMessage { + private final List instances; + + private InstanceGroupsRemoveInstancesRequest() { + this.instances = null; + } + + private InstanceGroupsRemoveInstancesRequest(List instances) { + this.instances = instances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instances")) { + return instances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstancesList() { + return instances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupsRemoveInstancesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupsRemoveInstancesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupsRemoveInstancesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupsRemoveInstancesRequest(); + } + + public static class Builder { + private List instances; + + Builder() {} + + public Builder mergeFrom(InstanceGroupsRemoveInstancesRequest other) { + if (other == InstanceGroupsRemoveInstancesRequest.getDefaultInstance()) return this; + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + return this; + } + + Builder(InstanceGroupsRemoveInstancesRequest source) { + this.instances = source.instances; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(InstanceReference instances) { + this.instances.add(instances); + return this; + } + + public InstanceGroupsRemoveInstancesRequest build() { + return new InstanceGroupsRemoveInstancesRequest(instances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstances(this.instances); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupsRemoveInstancesRequest{" + "instances=" + instances + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupsRemoveInstancesRequest) { + InstanceGroupsRemoveInstancesRequest that = (InstanceGroupsRemoveInstancesRequest) o; + return Objects.equals(this.instances, that.getInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsScopedList.java new file mode 100644 index 000000000000..88f22ad13a7d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsScopedList.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupsScopedList implements ApiMessage { + private final List instanceGroups; + private final Warning warning; + + private InstanceGroupsScopedList() { + this.instanceGroups = null; + this.warning = null; + } + + private InstanceGroupsScopedList(List instanceGroups, Warning warning) { + this.instanceGroups = instanceGroups; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instanceGroups")) { + return instanceGroups; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstanceGroupsList() { + return instanceGroups; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupsScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupsScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupsScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupsScopedList(); + } + + public static class Builder { + private List instanceGroups; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstanceGroupsScopedList other) { + if (other == InstanceGroupsScopedList.getDefaultInstance()) return this; + if (other.getInstanceGroupsList() != null) { + this.instanceGroups = other.instanceGroups; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstanceGroupsScopedList source) { + this.instanceGroups = source.instanceGroups; + this.warning = source.warning; + } + + public List getInstanceGroupsList() { + return instanceGroups; + } + + public Builder addAllInstanceGroups(List instanceGroups) { + if (this.instanceGroups == null) { + this.instanceGroups = new ArrayList<>(instanceGroups.size()); + } + this.instanceGroups.addAll(instanceGroups); + return this; + } + + public Builder addInstanceGroups(InstanceGroup instanceGroups) { + this.instanceGroups.add(instanceGroups); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstanceGroupsScopedList build() { + + return new InstanceGroupsScopedList(instanceGroups, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstanceGroups(this.instanceGroups); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupsScopedList{" + + "instanceGroups=" + + instanceGroups + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupsScopedList) { + InstanceGroupsScopedList that = (InstanceGroupsScopedList) o; + return Objects.equals(this.instanceGroups, that.getInstanceGroupsList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instanceGroups, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsSetNamedPortsRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsSetNamedPortsRequest.java new file mode 100644 index 000000000000..d5a0eea248dd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupsSetNamedPortsRequest.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceGroupsSetNamedPortsRequest implements ApiMessage { + private final String fingerprint; + private final List namedPorts; + + private InstanceGroupsSetNamedPortsRequest() { + this.fingerprint = null; + this.namedPorts = null; + } + + private InstanceGroupsSetNamedPortsRequest(String fingerprint, List namedPorts) { + this.fingerprint = fingerprint; + this.namedPorts = namedPorts; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("namedPorts")) { + return namedPorts; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getFingerprint() { + return fingerprint; + } + + public List getNamedPortsList() { + return namedPorts; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceGroupsSetNamedPortsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceGroupsSetNamedPortsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceGroupsSetNamedPortsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceGroupsSetNamedPortsRequest(); + } + + public static class Builder { + private String fingerprint; + private List namedPorts; + + Builder() {} + + public Builder mergeFrom(InstanceGroupsSetNamedPortsRequest other) { + if (other == InstanceGroupsSetNamedPortsRequest.getDefaultInstance()) return this; + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getNamedPortsList() != null) { + this.namedPorts = other.namedPorts; + } + return this; + } + + Builder(InstanceGroupsSetNamedPortsRequest source) { + this.fingerprint = source.fingerprint; + this.namedPorts = source.namedPorts; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public List getNamedPortsList() { + return namedPorts; + } + + public Builder addAllNamedPorts(List namedPorts) { + if (this.namedPorts == null) { + this.namedPorts = new ArrayList<>(namedPorts.size()); + } + this.namedPorts.addAll(namedPorts); + return this; + } + + public Builder addNamedPorts(NamedPort namedPorts) { + this.namedPorts.add(namedPorts); + return this; + } + + public InstanceGroupsSetNamedPortsRequest build() { + + return new InstanceGroupsSetNamedPortsRequest(fingerprint, namedPorts); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.addAllNamedPorts(this.namedPorts); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceGroupsSetNamedPortsRequest{" + + "fingerprint=" + + fingerprint + + ", " + + "namedPorts=" + + namedPorts + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceGroupsSetNamedPortsRequest) { + InstanceGroupsSetNamedPortsRequest that = (InstanceGroupsSetNamedPortsRequest) o; + return Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.namedPorts, that.getNamedPortsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(fingerprint, namedPorts); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceList.java new file mode 100644 index 000000000000..ce2e48dc6a78 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InstanceList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InstanceList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstanceList other) { + if (other == InstanceList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstanceList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Instance items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstanceList build() { + + return new InstanceList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceList) { + InstanceList that = (InstanceList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceListReferrers.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceListReferrers.java new file mode 100644 index 000000000000..28412fdaae8f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceListReferrers.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceListReferrers implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InstanceListReferrers() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InstanceListReferrers( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceListReferrers prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceListReferrers getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceListReferrers DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceListReferrers(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstanceListReferrers other) { + if (other == InstanceListReferrers.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstanceListReferrers source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Reference items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstanceListReferrers build() { + + return new InstanceListReferrers(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceListReferrers{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceListReferrers) { + InstanceListReferrers that = (InstanceListReferrers) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceMoveRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceMoveRequest.java new file mode 100644 index 000000000000..88ff621565a8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceMoveRequest.java @@ -0,0 +1,175 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceMoveRequest implements ApiMessage { + private final String destinationZone; + private final String targetInstance; + + private InstanceMoveRequest() { + this.destinationZone = null; + this.targetInstance = null; + } + + private InstanceMoveRequest(String destinationZone, String targetInstance) { + this.destinationZone = destinationZone; + this.targetInstance = targetInstance; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("destinationZone")) { + return destinationZone; + } + if (fieldName.equals("targetInstance")) { + return targetInstance; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getDestinationZone() { + return destinationZone; + } + + public String getTargetInstance() { + return targetInstance; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceMoveRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceMoveRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceMoveRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceMoveRequest(); + } + + public static class Builder { + private String destinationZone; + private String targetInstance; + + Builder() {} + + public Builder mergeFrom(InstanceMoveRequest other) { + if (other == InstanceMoveRequest.getDefaultInstance()) return this; + if (other.getDestinationZone() != null) { + this.destinationZone = other.destinationZone; + } + if (other.getTargetInstance() != null) { + this.targetInstance = other.targetInstance; + } + return this; + } + + Builder(InstanceMoveRequest source) { + this.destinationZone = source.destinationZone; + this.targetInstance = source.targetInstance; + } + + public String getDestinationZone() { + return destinationZone; + } + + public Builder setDestinationZone(String destinationZone) { + this.destinationZone = destinationZone; + return this; + } + + public String getTargetInstance() { + return targetInstance; + } + + public Builder setTargetInstance(String targetInstance) { + this.targetInstance = targetInstance; + return this; + } + + public InstanceMoveRequest build() { + + return new InstanceMoveRequest(destinationZone, targetInstance); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDestinationZone(this.destinationZone); + newBuilder.setTargetInstance(this.targetInstance); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceMoveRequest{" + + "destinationZone=" + + destinationZone + + ", " + + "targetInstance=" + + targetInstance + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceMoveRequest) { + InstanceMoveRequest that = (InstanceMoveRequest) o; + return Objects.equals(this.destinationZone, that.getDestinationZone()) + && Objects.equals(this.targetInstance, that.getTargetInstance()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(destinationZone, targetInstance); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceProperties.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceProperties.java new file mode 100644 index 000000000000..d03e13b7b481 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceProperties.java @@ -0,0 +1,535 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceProperties implements ApiMessage { + private final Boolean canIpForward; + private final String description; + private final List disks; + private final List guestAccelerators; + private final Map labels; + private final String machineType; + private final Metadata metadata; + private final String minCpuPlatform; + private final List networkInterfaces; + private final Scheduling scheduling; + private final List serviceAccounts; + private final Tags tags; + + private InstanceProperties() { + this.canIpForward = null; + this.description = null; + this.disks = null; + this.guestAccelerators = null; + this.labels = null; + this.machineType = null; + this.metadata = null; + this.minCpuPlatform = null; + this.networkInterfaces = null; + this.scheduling = null; + this.serviceAccounts = null; + this.tags = null; + } + + private InstanceProperties( + Boolean canIpForward, + String description, + List disks, + List guestAccelerators, + Map labels, + String machineType, + Metadata metadata, + String minCpuPlatform, + List networkInterfaces, + Scheduling scheduling, + List serviceAccounts, + Tags tags) { + this.canIpForward = canIpForward; + this.description = description; + this.disks = disks; + this.guestAccelerators = guestAccelerators; + this.labels = labels; + this.machineType = machineType; + this.metadata = metadata; + this.minCpuPlatform = minCpuPlatform; + this.networkInterfaces = networkInterfaces; + this.scheduling = scheduling; + this.serviceAccounts = serviceAccounts; + this.tags = tags; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("canIpForward")) { + return canIpForward; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("disks")) { + return disks; + } + if (fieldName.equals("guestAccelerators")) { + return guestAccelerators; + } + if (fieldName.equals("labels")) { + return labels; + } + if (fieldName.equals("machineType")) { + return machineType; + } + if (fieldName.equals("metadata")) { + return metadata; + } + if (fieldName.equals("minCpuPlatform")) { + return minCpuPlatform; + } + if (fieldName.equals("networkInterfaces")) { + return networkInterfaces; + } + if (fieldName.equals("scheduling")) { + return scheduling; + } + if (fieldName.equals("serviceAccounts")) { + return serviceAccounts; + } + if (fieldName.equals("tags")) { + return tags; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getCanIpForward() { + return canIpForward; + } + + public String getDescription() { + return description; + } + + public List getDisksList() { + return disks; + } + + public List getGuestAcceleratorsList() { + return guestAccelerators; + } + + public Map getLabelsMap() { + return labels; + } + + public String getMachineType() { + return machineType; + } + + public Metadata getMetadata() { + return metadata; + } + + public String getMinCpuPlatform() { + return minCpuPlatform; + } + + public List getNetworkInterfacesList() { + return networkInterfaces; + } + + public Scheduling getScheduling() { + return scheduling; + } + + public List getServiceAccountsList() { + return serviceAccounts; + } + + public Tags getTags() { + return tags; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceProperties prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceProperties getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceProperties DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceProperties(); + } + + public static class Builder { + private Boolean canIpForward; + private String description; + private List disks; + private List guestAccelerators; + private Map labels; + private String machineType; + private Metadata metadata; + private String minCpuPlatform; + private List networkInterfaces; + private Scheduling scheduling; + private List serviceAccounts; + private Tags tags; + + Builder() {} + + public Builder mergeFrom(InstanceProperties other) { + if (other == InstanceProperties.getDefaultInstance()) return this; + if (other.getCanIpForward() != null) { + this.canIpForward = other.canIpForward; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getDisksList() != null) { + this.disks = other.disks; + } + if (other.getGuestAcceleratorsList() != null) { + this.guestAccelerators = other.guestAccelerators; + } + if (other.getLabelsMap() != null) { + this.labels = other.labels; + } + if (other.getMachineType() != null) { + this.machineType = other.machineType; + } + if (other.getMetadata() != null) { + this.metadata = other.metadata; + } + if (other.getMinCpuPlatform() != null) { + this.minCpuPlatform = other.minCpuPlatform; + } + if (other.getNetworkInterfacesList() != null) { + this.networkInterfaces = other.networkInterfaces; + } + if (other.getScheduling() != null) { + this.scheduling = other.scheduling; + } + if (other.getServiceAccountsList() != null) { + this.serviceAccounts = other.serviceAccounts; + } + if (other.getTags() != null) { + this.tags = other.tags; + } + return this; + } + + Builder(InstanceProperties source) { + this.canIpForward = source.canIpForward; + this.description = source.description; + this.disks = source.disks; + this.guestAccelerators = source.guestAccelerators; + this.labels = source.labels; + this.machineType = source.machineType; + this.metadata = source.metadata; + this.minCpuPlatform = source.minCpuPlatform; + this.networkInterfaces = source.networkInterfaces; + this.scheduling = source.scheduling; + this.serviceAccounts = source.serviceAccounts; + this.tags = source.tags; + } + + public Boolean getCanIpForward() { + return canIpForward; + } + + public Builder setCanIpForward(Boolean canIpForward) { + this.canIpForward = canIpForward; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public List getDisksList() { + return disks; + } + + public Builder addAllDisks(List disks) { + if (this.disks == null) { + this.disks = new ArrayList<>(disks.size()); + } + this.disks.addAll(disks); + return this; + } + + public Builder addDisks(AttachedDisk disks) { + this.disks.add(disks); + return this; + } + + public List getGuestAcceleratorsList() { + return guestAccelerators; + } + + public Builder addAllGuestAccelerators(List guestAccelerators) { + if (this.guestAccelerators == null) { + this.guestAccelerators = new ArrayList<>(guestAccelerators.size()); + } + this.guestAccelerators.addAll(guestAccelerators); + return this; + } + + public Builder addGuestAccelerators(AcceleratorConfig guestAccelerators) { + this.guestAccelerators.add(guestAccelerators); + return this; + } + + public Map getLabelsMap() { + return labels; + } + + public Builder putAllLabels(Map labels) { + this.labels = labels; + return this; + } + + public String getMachineType() { + return machineType; + } + + public Builder setMachineType(String machineType) { + this.machineType = machineType; + return this; + } + + public Metadata getMetadata() { + return metadata; + } + + public Builder setMetadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + public String getMinCpuPlatform() { + return minCpuPlatform; + } + + public Builder setMinCpuPlatform(String minCpuPlatform) { + this.minCpuPlatform = minCpuPlatform; + return this; + } + + public List getNetworkInterfacesList() { + return networkInterfaces; + } + + public Builder addAllNetworkInterfaces(List networkInterfaces) { + if (this.networkInterfaces == null) { + this.networkInterfaces = new ArrayList<>(networkInterfaces.size()); + } + this.networkInterfaces.addAll(networkInterfaces); + return this; + } + + public Builder addNetworkInterfaces(NetworkInterface networkInterfaces) { + this.networkInterfaces.add(networkInterfaces); + return this; + } + + public Scheduling getScheduling() { + return scheduling; + } + + public Builder setScheduling(Scheduling scheduling) { + this.scheduling = scheduling; + return this; + } + + public List getServiceAccountsList() { + return serviceAccounts; + } + + public Builder addAllServiceAccounts(List serviceAccounts) { + if (this.serviceAccounts == null) { + this.serviceAccounts = new ArrayList<>(serviceAccounts.size()); + } + this.serviceAccounts.addAll(serviceAccounts); + return this; + } + + public Builder addServiceAccounts(ServiceAccount serviceAccounts) { + this.serviceAccounts.add(serviceAccounts); + return this; + } + + public Tags getTags() { + return tags; + } + + public Builder setTags(Tags tags) { + this.tags = tags; + return this; + } + + public InstanceProperties build() { + + return new InstanceProperties( + canIpForward, + description, + disks, + guestAccelerators, + labels, + machineType, + metadata, + minCpuPlatform, + networkInterfaces, + scheduling, + serviceAccounts, + tags); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCanIpForward(this.canIpForward); + newBuilder.setDescription(this.description); + newBuilder.addAllDisks(this.disks); + newBuilder.addAllGuestAccelerators(this.guestAccelerators); + newBuilder.putAllLabels(this.labels); + newBuilder.setMachineType(this.machineType); + newBuilder.setMetadata(this.metadata); + newBuilder.setMinCpuPlatform(this.minCpuPlatform); + newBuilder.addAllNetworkInterfaces(this.networkInterfaces); + newBuilder.setScheduling(this.scheduling); + newBuilder.addAllServiceAccounts(this.serviceAccounts); + newBuilder.setTags(this.tags); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceProperties{" + + "canIpForward=" + + canIpForward + + ", " + + "description=" + + description + + ", " + + "disks=" + + disks + + ", " + + "guestAccelerators=" + + guestAccelerators + + ", " + + "labels=" + + labels + + ", " + + "machineType=" + + machineType + + ", " + + "metadata=" + + metadata + + ", " + + "minCpuPlatform=" + + minCpuPlatform + + ", " + + "networkInterfaces=" + + networkInterfaces + + ", " + + "scheduling=" + + scheduling + + ", " + + "serviceAccounts=" + + serviceAccounts + + ", " + + "tags=" + + tags + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceProperties) { + InstanceProperties that = (InstanceProperties) o; + return Objects.equals(this.canIpForward, that.getCanIpForward()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.disks, that.getDisksList()) + && Objects.equals(this.guestAccelerators, that.getGuestAcceleratorsList()) + && Objects.equals(this.labels, that.getLabelsMap()) + && Objects.equals(this.machineType, that.getMachineType()) + && Objects.equals(this.metadata, that.getMetadata()) + && Objects.equals(this.minCpuPlatform, that.getMinCpuPlatform()) + && Objects.equals(this.networkInterfaces, that.getNetworkInterfacesList()) + && Objects.equals(this.scheduling, that.getScheduling()) + && Objects.equals(this.serviceAccounts, that.getServiceAccountsList()) + && Objects.equals(this.tags, that.getTags()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + canIpForward, + description, + disks, + guestAccelerators, + labels, + machineType, + metadata, + minCpuPlatform, + networkInterfaces, + scheduling, + serviceAccounts, + tags); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceReference.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceReference.java new file mode 100644 index 000000000000..c535675b686e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceReference.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceReference implements ApiMessage { + private final String instance; + + private InstanceReference() { + this.instance = null; + } + + private InstanceReference(String instance) { + this.instance = instance; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instance")) { + return instance; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getInstance() { + return instance; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceReference prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceReference getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceReference DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceReference(); + } + + public static class Builder { + private String instance; + + Builder() {} + + public Builder mergeFrom(InstanceReference other) { + if (other == InstanceReference.getDefaultInstance()) return this; + if (other.getInstance() != null) { + this.instance = other.instance; + } + return this; + } + + Builder(InstanceReference source) { + this.instance = source.instance; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public InstanceReference build() { + return new InstanceReference(instance); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setInstance(this.instance); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceReference{" + "instance=" + instance + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceReference) { + InstanceReference that = (InstanceReference) o; + return Objects.equals(this.instance, that.getInstance()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instance); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceSettings.java new file mode 100644 index 000000000000..eb0dc4b8c8c9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceSettings.java @@ -0,0 +1,493 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InstanceClient.AggregatedListInstancesPagedResponse; +import static com.google.cloud.compute.v1.InstanceClient.ListInstancesPagedResponse; +import static com.google.cloud.compute.v1.InstanceClient.ListReferrersInstancesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.InstanceStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InstanceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of addAccessConfigInstance to 30 seconds: + * + *

+ * 
+ * InstanceSettings.Builder instanceSettingsBuilder =
+ *     InstanceSettings.newBuilder();
+ * instanceSettingsBuilder.addAccessConfigInstanceSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InstanceSettings instanceSettings = instanceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to addAccessConfigInstance. */ + public UnaryCallSettings + addAccessConfigInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).addAccessConfigInstanceSettings(); + } + + /** Returns the object with the settings used for calls to aggregatedListInstances. */ + public PagedCallSettings< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, + AggregatedListInstancesPagedResponse> + aggregatedListInstancesSettings() { + return ((InstanceStubSettings) getStubSettings()).aggregatedListInstancesSettings(); + } + + /** Returns the object with the settings used for calls to attachDiskInstance. */ + public UnaryCallSettings attachDiskInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).attachDiskInstanceSettings(); + } + + /** Returns the object with the settings used for calls to deleteInstance. */ + public UnaryCallSettings deleteInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).deleteInstanceSettings(); + } + + /** Returns the object with the settings used for calls to deleteAccessConfigInstance. */ + public UnaryCallSettings + deleteAccessConfigInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).deleteAccessConfigInstanceSettings(); + } + + /** Returns the object with the settings used for calls to detachDiskInstance. */ + public UnaryCallSettings detachDiskInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).detachDiskInstanceSettings(); + } + + /** Returns the object with the settings used for calls to getInstance. */ + public UnaryCallSettings getInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).getInstanceSettings(); + } + + /** Returns the object with the settings used for calls to getSerialPortOutputInstance. */ + public UnaryCallSettings + getSerialPortOutputInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).getSerialPortOutputInstanceSettings(); + } + + /** Returns the object with the settings used for calls to insertInstance. */ + public UnaryCallSettings insertInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).insertInstanceSettings(); + } + + /** Returns the object with the settings used for calls to listInstances. */ + public PagedCallSettings + listInstancesSettings() { + return ((InstanceStubSettings) getStubSettings()).listInstancesSettings(); + } + + /** Returns the object with the settings used for calls to listReferrersInstances. */ + public PagedCallSettings< + ListReferrersInstancesHttpRequest, InstanceListReferrers, + ListReferrersInstancesPagedResponse> + listReferrersInstancesSettings() { + return ((InstanceStubSettings) getStubSettings()).listReferrersInstancesSettings(); + } + + /** Returns the object with the settings used for calls to resetInstance. */ + public UnaryCallSettings resetInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).resetInstanceSettings(); + } + + /** Returns the object with the settings used for calls to setDeletionProtectionInstance. */ + public UnaryCallSettings + setDeletionProtectionInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).setDeletionProtectionInstanceSettings(); + } + + /** Returns the object with the settings used for calls to setDiskAutoDeleteInstance. */ + public UnaryCallSettings + setDiskAutoDeleteInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).setDiskAutoDeleteInstanceSettings(); + } + + /** Returns the object with the settings used for calls to setLabelsInstance. */ + public UnaryCallSettings setLabelsInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).setLabelsInstanceSettings(); + } + + /** Returns the object with the settings used for calls to setMachineResourcesInstance. */ + public UnaryCallSettings + setMachineResourcesInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).setMachineResourcesInstanceSettings(); + } + + /** Returns the object with the settings used for calls to setMachineTypeInstance. */ + public UnaryCallSettings + setMachineTypeInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).setMachineTypeInstanceSettings(); + } + + /** Returns the object with the settings used for calls to setMetadataInstance. */ + public UnaryCallSettings + setMetadataInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).setMetadataInstanceSettings(); + } + + /** Returns the object with the settings used for calls to setMinCpuPlatformInstance. */ + public UnaryCallSettings + setMinCpuPlatformInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).setMinCpuPlatformInstanceSettings(); + } + + /** Returns the object with the settings used for calls to setSchedulingInstance. */ + public UnaryCallSettings + setSchedulingInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).setSchedulingInstanceSettings(); + } + + /** Returns the object with the settings used for calls to setServiceAccountInstance. */ + public UnaryCallSettings + setServiceAccountInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).setServiceAccountInstanceSettings(); + } + + /** Returns the object with the settings used for calls to setTagsInstance. */ + public UnaryCallSettings setTagsInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).setTagsInstanceSettings(); + } + + /** Returns the object with the settings used for calls to startInstance. */ + public UnaryCallSettings startInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).startInstanceSettings(); + } + + /** Returns the object with the settings used for calls to startWithEncryptionKeyInstance. */ + public UnaryCallSettings + startWithEncryptionKeyInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).startWithEncryptionKeyInstanceSettings(); + } + + /** Returns the object with the settings used for calls to stopInstance. */ + public UnaryCallSettings stopInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).stopInstanceSettings(); + } + + /** Returns the object with the settings used for calls to updateAccessConfigInstance. */ + public UnaryCallSettings + updateAccessConfigInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).updateAccessConfigInstanceSettings(); + } + + /** Returns the object with the settings used for calls to updateNetworkInterfaceInstance. */ + public UnaryCallSettings + updateNetworkInterfaceInstanceSettings() { + return ((InstanceStubSettings) getStubSettings()).updateNetworkInterfaceInstanceSettings(); + } + + public static final InstanceSettings create(InstanceStubSettings stub) throws IOException { + return new InstanceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstanceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return InstanceStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return InstanceStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return InstanceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return InstanceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstanceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return InstanceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return InstanceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InstanceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for InstanceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(InstanceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(InstanceStubSettings.newBuilder()); + } + + protected Builder(InstanceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(InstanceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public InstanceStubSettings.Builder getStubSettingsBuilder() { + return ((InstanceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to addAccessConfigInstance. */ + public UnaryCallSettings.Builder + addAccessConfigInstanceSettings() { + return getStubSettingsBuilder().addAccessConfigInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to aggregatedListInstances. */ + public PagedCallSettings.Builder< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, + AggregatedListInstancesPagedResponse> + aggregatedListInstancesSettings() { + return getStubSettingsBuilder().aggregatedListInstancesSettings(); + } + + /** Returns the builder for the settings used for calls to attachDiskInstance. */ + public UnaryCallSettings.Builder + attachDiskInstanceSettings() { + return getStubSettingsBuilder().attachDiskInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to deleteInstance. */ + public UnaryCallSettings.Builder + deleteInstanceSettings() { + return getStubSettingsBuilder().deleteInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to deleteAccessConfigInstance. */ + public UnaryCallSettings.Builder + deleteAccessConfigInstanceSettings() { + return getStubSettingsBuilder().deleteAccessConfigInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to detachDiskInstance. */ + public UnaryCallSettings.Builder + detachDiskInstanceSettings() { + return getStubSettingsBuilder().detachDiskInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to getInstance. */ + public UnaryCallSettings.Builder getInstanceSettings() { + return getStubSettingsBuilder().getInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to getSerialPortOutputInstance. */ + public UnaryCallSettings.Builder + getSerialPortOutputInstanceSettings() { + return getStubSettingsBuilder().getSerialPortOutputInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to insertInstance. */ + public UnaryCallSettings.Builder + insertInstanceSettings() { + return getStubSettingsBuilder().insertInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to listInstances. */ + public PagedCallSettings.Builder< + ListInstancesHttpRequest, InstanceList, ListInstancesPagedResponse> + listInstancesSettings() { + return getStubSettingsBuilder().listInstancesSettings(); + } + + /** Returns the builder for the settings used for calls to listReferrersInstances. */ + public PagedCallSettings.Builder< + ListReferrersInstancesHttpRequest, InstanceListReferrers, + ListReferrersInstancesPagedResponse> + listReferrersInstancesSettings() { + return getStubSettingsBuilder().listReferrersInstancesSettings(); + } + + /** Returns the builder for the settings used for calls to resetInstance. */ + public UnaryCallSettings.Builder resetInstanceSettings() { + return getStubSettingsBuilder().resetInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to setDeletionProtectionInstance. */ + public UnaryCallSettings.Builder + setDeletionProtectionInstanceSettings() { + return getStubSettingsBuilder().setDeletionProtectionInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to setDiskAutoDeleteInstance. */ + public UnaryCallSettings.Builder + setDiskAutoDeleteInstanceSettings() { + return getStubSettingsBuilder().setDiskAutoDeleteInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to setLabelsInstance. */ + public UnaryCallSettings.Builder + setLabelsInstanceSettings() { + return getStubSettingsBuilder().setLabelsInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to setMachineResourcesInstance. */ + public UnaryCallSettings.Builder + setMachineResourcesInstanceSettings() { + return getStubSettingsBuilder().setMachineResourcesInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to setMachineTypeInstance. */ + public UnaryCallSettings.Builder + setMachineTypeInstanceSettings() { + return getStubSettingsBuilder().setMachineTypeInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to setMetadataInstance. */ + public UnaryCallSettings.Builder + setMetadataInstanceSettings() { + return getStubSettingsBuilder().setMetadataInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to setMinCpuPlatformInstance. */ + public UnaryCallSettings.Builder + setMinCpuPlatformInstanceSettings() { + return getStubSettingsBuilder().setMinCpuPlatformInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to setSchedulingInstance. */ + public UnaryCallSettings.Builder + setSchedulingInstanceSettings() { + return getStubSettingsBuilder().setSchedulingInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to setServiceAccountInstance. */ + public UnaryCallSettings.Builder + setServiceAccountInstanceSettings() { + return getStubSettingsBuilder().setServiceAccountInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to setTagsInstance. */ + public UnaryCallSettings.Builder + setTagsInstanceSettings() { + return getStubSettingsBuilder().setTagsInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to startInstance. */ + public UnaryCallSettings.Builder startInstanceSettings() { + return getStubSettingsBuilder().startInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to startWithEncryptionKeyInstance. */ + public UnaryCallSettings.Builder + startWithEncryptionKeyInstanceSettings() { + return getStubSettingsBuilder().startWithEncryptionKeyInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to stopInstance. */ + public UnaryCallSettings.Builder stopInstanceSettings() { + return getStubSettingsBuilder().stopInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to updateAccessConfigInstance. */ + public UnaryCallSettings.Builder + updateAccessConfigInstanceSettings() { + return getStubSettingsBuilder().updateAccessConfigInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to updateNetworkInterfaceInstance. */ + public UnaryCallSettings.Builder + updateNetworkInterfaceInstanceSettings() { + return getStubSettingsBuilder().updateNetworkInterfaceInstanceSettings(); + } + + @Override + public InstanceSettings build() throws IOException { + return new InstanceSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplate.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplate.java new file mode 100644 index 000000000000..acc02653fe16 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplate.java @@ -0,0 +1,328 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceTemplate implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String id; + private final String kind; + private final String name; + private final InstanceProperties properties; + private final String selfLink; + + private InstanceTemplate() { + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.kind = null; + this.name = null; + this.properties = null; + this.selfLink = null; + } + + private InstanceTemplate( + String creationTimestamp, + String description, + String id, + String kind, + String name, + InstanceProperties properties, + String selfLink) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.kind = kind; + this.name = name; + this.properties = properties; + this.selfLink = selfLink; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("properties")) { + return properties; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public InstanceProperties getProperties() { + return properties; + } + + public String getSelfLink() { + return selfLink; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceTemplate prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceTemplate getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceTemplate DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceTemplate(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String id; + private String kind; + private String name; + private InstanceProperties properties; + private String selfLink; + + Builder() {} + + public Builder mergeFrom(InstanceTemplate other) { + if (other == InstanceTemplate.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getProperties() != null) { + this.properties = other.properties; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + return this; + } + + Builder(InstanceTemplate source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.properties = source.properties; + this.selfLink = source.selfLink; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public InstanceProperties getProperties() { + return properties; + } + + public Builder setProperties(InstanceProperties properties) { + this.properties = properties; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public InstanceTemplate build() { + + return new InstanceTemplate( + creationTimestamp, description, id, kind, name, properties, selfLink); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setProperties(this.properties); + newBuilder.setSelfLink(this.selfLink); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceTemplate{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "properties=" + + properties + + ", " + + "selfLink=" + + selfLink + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceTemplate) { + InstanceTemplate that = (InstanceTemplate) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.properties, that.getProperties()) + && Objects.equals(this.selfLink, that.getSelfLink()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(creationTimestamp, description, id, kind, name, properties, selfLink); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplateClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplateClient.java new file mode 100644 index 000000000000..6e2e6bb04675 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplateClient.java @@ -0,0 +1,742 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.InstanceTemplateStub; +import com.google.cloud.compute.v1.stub.InstanceTemplateStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+ *   ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
+ *   Operation response = instanceTemplateClient.deleteInstanceTemplate(instanceTemplate);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the instanceTemplateClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of InstanceTemplateSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * InstanceTemplateSettings instanceTemplateSettings =
+ *     InstanceTemplateSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * InstanceTemplateClient instanceTemplateClient =
+ *     InstanceTemplateClient.create(instanceTemplateSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * InstanceTemplateSettings instanceTemplateSettings =
+ *     InstanceTemplateSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * InstanceTemplateClient instanceTemplateClient =
+ *     InstanceTemplateClient.create(instanceTemplateSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceTemplateClient implements BackgroundResource { + private final InstanceTemplateSettings settings; + private final InstanceTemplateStub stub; + + /** Constructs an instance of InstanceTemplateClient with default settings. */ + public static final InstanceTemplateClient create() throws IOException { + return create(InstanceTemplateSettings.newBuilder().build()); + } + + /** + * Constructs an instance of InstanceTemplateClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final InstanceTemplateClient create(InstanceTemplateSettings settings) + throws IOException { + return new InstanceTemplateClient(settings); + } + + /** + * Constructs an instance of InstanceTemplateClient, using the given stub for making calls. This + * is for advanced usage - prefer to use InstanceTemplateSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final InstanceTemplateClient create(InstanceTemplateStub stub) { + return new InstanceTemplateClient(stub); + } + + /** + * Constructs an instance of InstanceTemplateClient, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected InstanceTemplateClient(InstanceTemplateSettings settings) throws IOException { + this.settings = settings; + this.stub = ((InstanceTemplateStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected InstanceTemplateClient(InstanceTemplateStub stub) { + this.settings = null; + this.stub = stub; + } + + public final InstanceTemplateSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InstanceTemplateStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified instance template. Deleting an instance template is permanent and cannot + * be undone. It's not possible to delete templates which are in use by an instance group. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
+   *   Operation response = instanceTemplateClient.deleteInstanceTemplate(instanceTemplate);
+   * }
+   * 
+ * + * @param instanceTemplate The name of the instance template to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstanceTemplate( + ProjectGlobalInstanceTemplateName instanceTemplate) { + + DeleteInstanceTemplateHttpRequest request = + DeleteInstanceTemplateHttpRequest.newBuilder() + .setInstanceTemplate(instanceTemplate == null ? null : instanceTemplate.toString()) + .build(); + return deleteInstanceTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified instance template. Deleting an instance template is permanent and cannot + * be undone. It's not possible to delete templates which are in use by an instance group. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
+   *   Operation response = instanceTemplateClient.deleteInstanceTemplate(instanceTemplate.toString());
+   * }
+   * 
+ * + * @param instanceTemplate The name of the instance template to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstanceTemplate(String instanceTemplate) { + + DeleteInstanceTemplateHttpRequest request = + DeleteInstanceTemplateHttpRequest.newBuilder() + .setInstanceTemplate(instanceTemplate) + .build(); + return deleteInstanceTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified instance template. Deleting an instance template is permanent and cannot + * be undone. It's not possible to delete templates which are in use by an instance group. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
+   *   DeleteInstanceTemplateHttpRequest request = DeleteInstanceTemplateHttpRequest.newBuilder()
+   *     .setInstanceTemplate(instanceTemplate.toString())
+   *     .build();
+   *   Operation response = instanceTemplateClient.deleteInstanceTemplate(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstanceTemplate(DeleteInstanceTemplateHttpRequest request) { + return deleteInstanceTemplateCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified instance template. Deleting an instance template is permanent and cannot + * be undone. It's not possible to delete templates which are in use by an instance group. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
+   *   DeleteInstanceTemplateHttpRequest request = DeleteInstanceTemplateHttpRequest.newBuilder()
+   *     .setInstanceTemplate(instanceTemplate.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = instanceTemplateClient.deleteInstanceTemplateCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteInstanceTemplateCallable() { + return stub.deleteInstanceTemplateCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance template. Gets a list of available instance templates by making + * a list() request. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
+   *   InstanceTemplate response = instanceTemplateClient.getInstanceTemplate(instanceTemplate);
+   * }
+   * 
+ * + * @param instanceTemplate The name of the instance template. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceTemplate getInstanceTemplate( + ProjectGlobalInstanceTemplateName instanceTemplate) { + + GetInstanceTemplateHttpRequest request = + GetInstanceTemplateHttpRequest.newBuilder() + .setInstanceTemplate(instanceTemplate == null ? null : instanceTemplate.toString()) + .build(); + return getInstanceTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance template. Gets a list of available instance templates by making + * a list() request. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
+   *   InstanceTemplate response = instanceTemplateClient.getInstanceTemplate(instanceTemplate.toString());
+   * }
+   * 
+ * + * @param instanceTemplate The name of the instance template. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceTemplate getInstanceTemplate(String instanceTemplate) { + + GetInstanceTemplateHttpRequest request = + GetInstanceTemplateHttpRequest.newBuilder().setInstanceTemplate(instanceTemplate).build(); + return getInstanceTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance template. Gets a list of available instance templates by making + * a list() request. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
+   *   GetInstanceTemplateHttpRequest request = GetInstanceTemplateHttpRequest.newBuilder()
+   *     .setInstanceTemplate(instanceTemplate.toString())
+   *     .build();
+   *   InstanceTemplate response = instanceTemplateClient.getInstanceTemplate(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceTemplate getInstanceTemplate(GetInstanceTemplateHttpRequest request) { + return getInstanceTemplateCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance template. Gets a list of available instance templates by making + * a list() request. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
+   *   GetInstanceTemplateHttpRequest request = GetInstanceTemplateHttpRequest.newBuilder()
+   *     .setInstanceTemplate(instanceTemplate.toString())
+   *     .build();
+   *   ApiFuture<InstanceTemplate> future = instanceTemplateClient.getInstanceTemplateCallable().futureCall(request);
+   *   // Do something
+   *   InstanceTemplate response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getInstanceTemplateCallable() { + return stub.getInstanceTemplateCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance template in the specified project using the data that is included in the + * request. If you are creating a new template to update an existing instance group, your new + * instance template must use the same network or, if applicable, the same subnetwork as the + * original template. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   InstanceTemplate instanceTemplateResource = InstanceTemplate.newBuilder().build();
+   *   Operation response = instanceTemplateClient.insertInstanceTemplate(project, instanceTemplateResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param instanceTemplateResource An Instance Template resource. (== resource_for + * beta.instanceTemplates ==) (== resource_for v1.instanceTemplates ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstanceTemplate( + ProjectName project, InstanceTemplate instanceTemplateResource) { + + InsertInstanceTemplateHttpRequest request = + InsertInstanceTemplateHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setInstanceTemplateResource(instanceTemplateResource) + .build(); + return insertInstanceTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance template in the specified project using the data that is included in the + * request. If you are creating a new template to update an existing instance group, your new + * instance template must use the same network or, if applicable, the same subnetwork as the + * original template. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   InstanceTemplate instanceTemplateResource = InstanceTemplate.newBuilder().build();
+   *   Operation response = instanceTemplateClient.insertInstanceTemplate(project.toString(), instanceTemplateResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param instanceTemplateResource An Instance Template resource. (== resource_for + * beta.instanceTemplates ==) (== resource_for v1.instanceTemplates ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstanceTemplate( + String project, InstanceTemplate instanceTemplateResource) { + + InsertInstanceTemplateHttpRequest request = + InsertInstanceTemplateHttpRequest.newBuilder() + .setProject(project) + .setInstanceTemplateResource(instanceTemplateResource) + .build(); + return insertInstanceTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance template in the specified project using the data that is included in the + * request. If you are creating a new template to update an existing instance group, your new + * instance template must use the same network or, if applicable, the same subnetwork as the + * original template. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   InstanceTemplate instanceTemplateResource = InstanceTemplate.newBuilder().build();
+   *   InsertInstanceTemplateHttpRequest request = InsertInstanceTemplateHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setInstanceTemplateResource(instanceTemplateResource)
+   *     .build();
+   *   Operation response = instanceTemplateClient.insertInstanceTemplate(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInstanceTemplate(InsertInstanceTemplateHttpRequest request) { + return insertInstanceTemplateCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an instance template in the specified project using the data that is included in the + * request. If you are creating a new template to update an existing instance group, your new + * instance template must use the same network or, if applicable, the same subnetwork as the + * original template. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   InstanceTemplate instanceTemplateResource = InstanceTemplate.newBuilder().build();
+   *   InsertInstanceTemplateHttpRequest request = InsertInstanceTemplateHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setInstanceTemplateResource(instanceTemplateResource)
+   *     .build();
+   *   ApiFuture<Operation> future = instanceTemplateClient.insertInstanceTemplateCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertInstanceTemplateCallable() { + return stub.insertInstanceTemplateCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of instance templates that are contained within the specified project and + * zone. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InstanceTemplate element : instanceTemplateClient.listInstanceTemplates(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstanceTemplatesPagedResponse listInstanceTemplates(ProjectName project) { + ListInstanceTemplatesHttpRequest request = + ListInstanceTemplatesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listInstanceTemplates(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of instance templates that are contained within the specified project and + * zone. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InstanceTemplate element : instanceTemplateClient.listInstanceTemplates(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstanceTemplatesPagedResponse listInstanceTemplates(String project) { + ListInstanceTemplatesHttpRequest request = + ListInstanceTemplatesHttpRequest.newBuilder().setProject(project).build(); + return listInstanceTemplates(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of instance templates that are contained within the specified project and + * zone. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListInstanceTemplatesHttpRequest request = ListInstanceTemplatesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (InstanceTemplate element : instanceTemplateClient.listInstanceTemplates(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstanceTemplatesPagedResponse listInstanceTemplates( + ListInstanceTemplatesHttpRequest request) { + return listInstanceTemplatesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of instance templates that are contained within the specified project and + * zone. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListInstanceTemplatesHttpRequest request = ListInstanceTemplatesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListInstanceTemplatesPagedResponse> future = instanceTemplateClient.listInstanceTemplatesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InstanceTemplate element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listInstanceTemplatesPagedCallable() { + return stub.listInstanceTemplatesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of instance templates that are contained within the specified project and + * zone. + * + *

Sample code: + * + *


+   * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListInstanceTemplatesHttpRequest request = ListInstanceTemplatesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     InstanceTemplateList response = instanceTemplateClient.listInstanceTemplatesCallable().call(request);
+   *     for (InstanceTemplate element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listInstanceTemplatesCallable() { + return stub.listInstanceTemplatesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListInstanceTemplatesPagedResponse + extends AbstractPagedListResponse< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, InstanceTemplate, + ListInstanceTemplatesPage, ListInstanceTemplatesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListInstanceTemplatesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListInstanceTemplatesPagedResponse apply(ListInstanceTemplatesPage input) { + return new ListInstanceTemplatesPagedResponse(input); + } + }); + } + + private ListInstanceTemplatesPagedResponse(ListInstanceTemplatesPage page) { + super(page, ListInstanceTemplatesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListInstanceTemplatesPage + extends AbstractPage< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, InstanceTemplate, + ListInstanceTemplatesPage> { + + private ListInstanceTemplatesPage( + PageContext + context, + InstanceTemplateList response) { + super(context, response); + } + + private static ListInstanceTemplatesPage createEmptyPage() { + return new ListInstanceTemplatesPage(null, null); + } + + @Override + protected ListInstanceTemplatesPage createPage( + PageContext + context, + InstanceTemplateList response) { + return new ListInstanceTemplatesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListInstanceTemplatesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, InstanceTemplate, + ListInstanceTemplatesPage, ListInstanceTemplatesFixedSizeCollection> { + + private ListInstanceTemplatesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListInstanceTemplatesFixedSizeCollection createEmptyCollection() { + return new ListInstanceTemplatesFixedSizeCollection(null, 0); + } + + @Override + protected ListInstanceTemplatesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListInstanceTemplatesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplateList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplateList.java new file mode 100644 index 000000000000..161856e0997d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplateList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceTemplateList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InstanceTemplateList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InstanceTemplateList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceTemplateList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceTemplateList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceTemplateList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceTemplateList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstanceTemplateList other) { + if (other == InstanceTemplateList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstanceTemplateList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(InstanceTemplate items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstanceTemplateList build() { + + return new InstanceTemplateList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceTemplateList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceTemplateList) { + InstanceTemplateList that = (InstanceTemplateList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplateSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplateSettings.java new file mode 100644 index 000000000000..610405c1f47e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplateSettings.java @@ -0,0 +1,225 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InstanceTemplateClient.ListInstanceTemplatesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.InstanceTemplateStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InstanceTemplateClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteInstanceTemplate to 30 seconds: + * + *

+ * 
+ * InstanceTemplateSettings.Builder instanceTemplateSettingsBuilder =
+ *     InstanceTemplateSettings.newBuilder();
+ * instanceTemplateSettingsBuilder.deleteInstanceTemplateSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InstanceTemplateSettings instanceTemplateSettings = instanceTemplateSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceTemplateSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteInstanceTemplate. */ + public UnaryCallSettings + deleteInstanceTemplateSettings() { + return ((InstanceTemplateStubSettings) getStubSettings()).deleteInstanceTemplateSettings(); + } + + /** Returns the object with the settings used for calls to getInstanceTemplate. */ + public UnaryCallSettings + getInstanceTemplateSettings() { + return ((InstanceTemplateStubSettings) getStubSettings()).getInstanceTemplateSettings(); + } + + /** Returns the object with the settings used for calls to insertInstanceTemplate. */ + public UnaryCallSettings + insertInstanceTemplateSettings() { + return ((InstanceTemplateStubSettings) getStubSettings()).insertInstanceTemplateSettings(); + } + + /** Returns the object with the settings used for calls to listInstanceTemplates. */ + public PagedCallSettings< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, + ListInstanceTemplatesPagedResponse> + listInstanceTemplatesSettings() { + return ((InstanceTemplateStubSettings) getStubSettings()).listInstanceTemplatesSettings(); + } + + public static final InstanceTemplateSettings create(InstanceTemplateStubSettings stub) + throws IOException { + return new InstanceTemplateSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstanceTemplateStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return InstanceTemplateStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return InstanceTemplateStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return InstanceTemplateStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return InstanceTemplateStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstanceTemplateStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return InstanceTemplateStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return InstanceTemplateStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InstanceTemplateSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for InstanceTemplateSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(InstanceTemplateStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(InstanceTemplateStubSettings.newBuilder()); + } + + protected Builder(InstanceTemplateSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(InstanceTemplateStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public InstanceTemplateStubSettings.Builder getStubSettingsBuilder() { + return ((InstanceTemplateStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteInstanceTemplate. */ + public UnaryCallSettings.Builder + deleteInstanceTemplateSettings() { + return getStubSettingsBuilder().deleteInstanceTemplateSettings(); + } + + /** Returns the builder for the settings used for calls to getInstanceTemplate. */ + public UnaryCallSettings.Builder + getInstanceTemplateSettings() { + return getStubSettingsBuilder().getInstanceTemplateSettings(); + } + + /** Returns the builder for the settings used for calls to insertInstanceTemplate. */ + public UnaryCallSettings.Builder + insertInstanceTemplateSettings() { + return getStubSettingsBuilder().insertInstanceTemplateSettings(); + } + + /** Returns the builder for the settings used for calls to listInstanceTemplates. */ + public PagedCallSettings.Builder< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, + ListInstanceTemplatesPagedResponse> + listInstanceTemplatesSettings() { + return getStubSettingsBuilder().listInstanceTemplatesSettings(); + } + + @Override + public InstanceTemplateSettings build() throws IOException { + return new InstanceTemplateSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceWithNamedPorts.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceWithNamedPorts.java new file mode 100644 index 000000000000..76f81f42a5dd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceWithNamedPorts.java @@ -0,0 +1,213 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstanceWithNamedPorts implements ApiMessage { + private final String instance; + private final List namedPorts; + private final String status; + + private InstanceWithNamedPorts() { + this.instance = null; + this.namedPorts = null; + this.status = null; + } + + private InstanceWithNamedPorts(String instance, List namedPorts, String status) { + this.instance = instance; + this.namedPorts = namedPorts; + this.status = status; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("namedPorts")) { + return namedPorts; + } + if (fieldName.equals("status")) { + return status; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getInstance() { + return instance; + } + + public List getNamedPortsList() { + return namedPorts; + } + + public String getStatus() { + return status; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstanceWithNamedPorts prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstanceWithNamedPorts getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstanceWithNamedPorts DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstanceWithNamedPorts(); + } + + public static class Builder { + private String instance; + private List namedPorts; + private String status; + + Builder() {} + + public Builder mergeFrom(InstanceWithNamedPorts other) { + if (other == InstanceWithNamedPorts.getDefaultInstance()) return this; + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getNamedPortsList() != null) { + this.namedPorts = other.namedPorts; + } + if (other.getStatus() != null) { + this.status = other.status; + } + return this; + } + + Builder(InstanceWithNamedPorts source) { + this.instance = source.instance; + this.namedPorts = source.namedPorts; + this.status = source.status; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public List getNamedPortsList() { + return namedPorts; + } + + public Builder addAllNamedPorts(List namedPorts) { + if (this.namedPorts == null) { + this.namedPorts = new ArrayList<>(namedPorts.size()); + } + this.namedPorts.addAll(namedPorts); + return this; + } + + public Builder addNamedPorts(NamedPort namedPorts) { + this.namedPorts.add(namedPorts); + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public InstanceWithNamedPorts build() { + + return new InstanceWithNamedPorts(instance, namedPorts, status); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setInstance(this.instance); + newBuilder.addAllNamedPorts(this.namedPorts); + newBuilder.setStatus(this.status); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstanceWithNamedPorts{" + + "instance=" + + instance + + ", " + + "namedPorts=" + + namedPorts + + ", " + + "status=" + + status + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstanceWithNamedPorts) { + InstanceWithNamedPorts that = (InstanceWithNamedPorts) o; + return Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.namedPorts, that.getNamedPortsList()) + && Objects.equals(this.status, that.getStatus()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instance, namedPorts, status); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesScopedList.java new file mode 100644 index 000000000000..44cf666578cb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesScopedList.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstancesScopedList implements ApiMessage { + private final List instances; + private final Warning warning; + + private InstancesScopedList() { + this.instances = null; + this.warning = null; + } + + private InstancesScopedList(List instances, Warning warning) { + this.instances = instances; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instances")) { + return instances; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstancesList() { + return instances; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstancesScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstancesScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstancesScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstancesScopedList(); + } + + public static class Builder { + private List instances; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InstancesScopedList other) { + if (other == InstancesScopedList.getDefaultInstance()) return this; + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InstancesScopedList source) { + this.instances = source.instances; + this.warning = source.warning; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(Instance instances) { + this.instances.add(instances); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InstancesScopedList build() { + + return new InstancesScopedList(instances, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstances(this.instances); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstancesScopedList{" + "instances=" + instances + ", " + "warning=" + warning + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstancesScopedList) { + InstancesScopedList that = (InstancesScopedList) o; + return Objects.equals(this.instances, that.getInstancesList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instances, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetLabelsRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetLabelsRequest.java new file mode 100644 index 000000000000..2cc3bef69f5e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetLabelsRequest.java @@ -0,0 +1,176 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstancesSetLabelsRequest implements ApiMessage { + private final String labelFingerprint; + private final Map labels; + + private InstancesSetLabelsRequest() { + this.labelFingerprint = null; + this.labels = null; + } + + private InstancesSetLabelsRequest(String labelFingerprint, Map labels) { + this.labelFingerprint = labelFingerprint; + this.labels = labels; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("labelFingerprint")) { + return labelFingerprint; + } + if (fieldName.equals("labels")) { + return labels; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Map getLabelsMap() { + return labels; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstancesSetLabelsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstancesSetLabelsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstancesSetLabelsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstancesSetLabelsRequest(); + } + + public static class Builder { + private String labelFingerprint; + private Map labels; + + Builder() {} + + public Builder mergeFrom(InstancesSetLabelsRequest other) { + if (other == InstancesSetLabelsRequest.getDefaultInstance()) return this; + if (other.getLabelFingerprint() != null) { + this.labelFingerprint = other.labelFingerprint; + } + if (other.getLabelsMap() != null) { + this.labels = other.labels; + } + return this; + } + + Builder(InstancesSetLabelsRequest source) { + this.labelFingerprint = source.labelFingerprint; + this.labels = source.labels; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Builder setLabelFingerprint(String labelFingerprint) { + this.labelFingerprint = labelFingerprint; + return this; + } + + public Map getLabelsMap() { + return labels; + } + + public Builder putAllLabels(Map labels) { + this.labels = labels; + return this; + } + + public InstancesSetLabelsRequest build() { + + return new InstancesSetLabelsRequest(labelFingerprint, labels); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setLabelFingerprint(this.labelFingerprint); + newBuilder.putAllLabels(this.labels); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstancesSetLabelsRequest{" + + "labelFingerprint=" + + labelFingerprint + + ", " + + "labels=" + + labels + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstancesSetLabelsRequest) { + InstancesSetLabelsRequest that = (InstancesSetLabelsRequest) o; + return Objects.equals(this.labelFingerprint, that.getLabelFingerprint()) + && Objects.equals(this.labels, that.getLabelsMap()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(labelFingerprint, labels); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetMachineResourcesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetMachineResourcesRequest.java new file mode 100644 index 000000000000..c6310a43d417 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetMachineResourcesRequest.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstancesSetMachineResourcesRequest implements ApiMessage { + private final List guestAccelerators; + + private InstancesSetMachineResourcesRequest() { + this.guestAccelerators = null; + } + + private InstancesSetMachineResourcesRequest(List guestAccelerators) { + this.guestAccelerators = guestAccelerators; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("guestAccelerators")) { + return guestAccelerators; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getGuestAcceleratorsList() { + return guestAccelerators; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstancesSetMachineResourcesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstancesSetMachineResourcesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstancesSetMachineResourcesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstancesSetMachineResourcesRequest(); + } + + public static class Builder { + private List guestAccelerators; + + Builder() {} + + public Builder mergeFrom(InstancesSetMachineResourcesRequest other) { + if (other == InstancesSetMachineResourcesRequest.getDefaultInstance()) return this; + if (other.getGuestAcceleratorsList() != null) { + this.guestAccelerators = other.guestAccelerators; + } + return this; + } + + Builder(InstancesSetMachineResourcesRequest source) { + this.guestAccelerators = source.guestAccelerators; + } + + public List getGuestAcceleratorsList() { + return guestAccelerators; + } + + public Builder addAllGuestAccelerators(List guestAccelerators) { + if (this.guestAccelerators == null) { + this.guestAccelerators = new ArrayList<>(guestAccelerators.size()); + } + this.guestAccelerators.addAll(guestAccelerators); + return this; + } + + public Builder addGuestAccelerators(AcceleratorConfig guestAccelerators) { + this.guestAccelerators.add(guestAccelerators); + return this; + } + + public InstancesSetMachineResourcesRequest build() { + return new InstancesSetMachineResourcesRequest(guestAccelerators); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllGuestAccelerators(this.guestAccelerators); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstancesSetMachineResourcesRequest{" + "guestAccelerators=" + guestAccelerators + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstancesSetMachineResourcesRequest) { + InstancesSetMachineResourcesRequest that = (InstancesSetMachineResourcesRequest) o; + return Objects.equals(this.guestAccelerators, that.getGuestAcceleratorsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(guestAccelerators); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetMachineTypeRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetMachineTypeRequest.java new file mode 100644 index 000000000000..a62184708523 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetMachineTypeRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstancesSetMachineTypeRequest implements ApiMessage { + private final String machineType; + + private InstancesSetMachineTypeRequest() { + this.machineType = null; + } + + private InstancesSetMachineTypeRequest(String machineType) { + this.machineType = machineType; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("machineType")) { + return machineType; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getMachineType() { + return machineType; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstancesSetMachineTypeRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstancesSetMachineTypeRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstancesSetMachineTypeRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstancesSetMachineTypeRequest(); + } + + public static class Builder { + private String machineType; + + Builder() {} + + public Builder mergeFrom(InstancesSetMachineTypeRequest other) { + if (other == InstancesSetMachineTypeRequest.getDefaultInstance()) return this; + if (other.getMachineType() != null) { + this.machineType = other.machineType; + } + return this; + } + + Builder(InstancesSetMachineTypeRequest source) { + this.machineType = source.machineType; + } + + public String getMachineType() { + return machineType; + } + + public Builder setMachineType(String machineType) { + this.machineType = machineType; + return this; + } + + public InstancesSetMachineTypeRequest build() { + return new InstancesSetMachineTypeRequest(machineType); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setMachineType(this.machineType); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstancesSetMachineTypeRequest{" + "machineType=" + machineType + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstancesSetMachineTypeRequest) { + InstancesSetMachineTypeRequest that = (InstancesSetMachineTypeRequest) o; + return Objects.equals(this.machineType, that.getMachineType()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(machineType); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetMinCpuPlatformRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetMinCpuPlatformRequest.java new file mode 100644 index 000000000000..dc4dc20ceb8e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetMinCpuPlatformRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstancesSetMinCpuPlatformRequest implements ApiMessage { + private final String minCpuPlatform; + + private InstancesSetMinCpuPlatformRequest() { + this.minCpuPlatform = null; + } + + private InstancesSetMinCpuPlatformRequest(String minCpuPlatform) { + this.minCpuPlatform = minCpuPlatform; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("minCpuPlatform")) { + return minCpuPlatform; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getMinCpuPlatform() { + return minCpuPlatform; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstancesSetMinCpuPlatformRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstancesSetMinCpuPlatformRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstancesSetMinCpuPlatformRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstancesSetMinCpuPlatformRequest(); + } + + public static class Builder { + private String minCpuPlatform; + + Builder() {} + + public Builder mergeFrom(InstancesSetMinCpuPlatformRequest other) { + if (other == InstancesSetMinCpuPlatformRequest.getDefaultInstance()) return this; + if (other.getMinCpuPlatform() != null) { + this.minCpuPlatform = other.minCpuPlatform; + } + return this; + } + + Builder(InstancesSetMinCpuPlatformRequest source) { + this.minCpuPlatform = source.minCpuPlatform; + } + + public String getMinCpuPlatform() { + return minCpuPlatform; + } + + public Builder setMinCpuPlatform(String minCpuPlatform) { + this.minCpuPlatform = minCpuPlatform; + return this; + } + + public InstancesSetMinCpuPlatformRequest build() { + return new InstancesSetMinCpuPlatformRequest(minCpuPlatform); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setMinCpuPlatform(this.minCpuPlatform); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstancesSetMinCpuPlatformRequest{" + "minCpuPlatform=" + minCpuPlatform + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstancesSetMinCpuPlatformRequest) { + InstancesSetMinCpuPlatformRequest that = (InstancesSetMinCpuPlatformRequest) o; + return Objects.equals(this.minCpuPlatform, that.getMinCpuPlatform()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(minCpuPlatform); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetServiceAccountRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetServiceAccountRequest.java new file mode 100644 index 000000000000..0df845b9967e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesSetServiceAccountRequest.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstancesSetServiceAccountRequest implements ApiMessage { + private final String email; + private final List scopes; + + private InstancesSetServiceAccountRequest() { + this.email = null; + this.scopes = null; + } + + private InstancesSetServiceAccountRequest(String email, List scopes) { + this.email = email; + this.scopes = scopes; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("email")) { + return email; + } + if (fieldName.equals("scopes")) { + return scopes; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getEmail() { + return email; + } + + public List getScopesList() { + return scopes; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstancesSetServiceAccountRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstancesSetServiceAccountRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstancesSetServiceAccountRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstancesSetServiceAccountRequest(); + } + + public static class Builder { + private String email; + private List scopes; + + Builder() {} + + public Builder mergeFrom(InstancesSetServiceAccountRequest other) { + if (other == InstancesSetServiceAccountRequest.getDefaultInstance()) return this; + if (other.getEmail() != null) { + this.email = other.email; + } + if (other.getScopesList() != null) { + this.scopes = other.scopes; + } + return this; + } + + Builder(InstancesSetServiceAccountRequest source) { + this.email = source.email; + this.scopes = source.scopes; + } + + public String getEmail() { + return email; + } + + public Builder setEmail(String email) { + this.email = email; + return this; + } + + public List getScopesList() { + return scopes; + } + + public Builder addAllScopes(List scopes) { + if (this.scopes == null) { + this.scopes = new ArrayList<>(scopes.size()); + } + this.scopes.addAll(scopes); + return this; + } + + public Builder addScopes(String scopes) { + this.scopes.add(scopes); + return this; + } + + public InstancesSetServiceAccountRequest build() { + + return new InstancesSetServiceAccountRequest(email, scopes); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setEmail(this.email); + newBuilder.addAllScopes(this.scopes); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstancesSetServiceAccountRequest{" + + "email=" + + email + + ", " + + "scopes=" + + scopes + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstancesSetServiceAccountRequest) { + InstancesSetServiceAccountRequest that = (InstancesSetServiceAccountRequest) o; + return Objects.equals(this.email, that.getEmail()) + && Objects.equals(this.scopes, that.getScopesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(email, scopes); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesStartWithEncryptionKeyRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesStartWithEncryptionKeyRequest.java new file mode 100644 index 000000000000..c11e404ccae7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstancesStartWithEncryptionKeyRequest.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InstancesStartWithEncryptionKeyRequest implements ApiMessage { + private final List disks; + + private InstancesStartWithEncryptionKeyRequest() { + this.disks = null; + } + + private InstancesStartWithEncryptionKeyRequest(List disks) { + this.disks = disks; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("disks")) { + return disks; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getDisksList() { + return disks; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InstancesStartWithEncryptionKeyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InstancesStartWithEncryptionKeyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InstancesStartWithEncryptionKeyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InstancesStartWithEncryptionKeyRequest(); + } + + public static class Builder { + private List disks; + + Builder() {} + + public Builder mergeFrom(InstancesStartWithEncryptionKeyRequest other) { + if (other == InstancesStartWithEncryptionKeyRequest.getDefaultInstance()) return this; + if (other.getDisksList() != null) { + this.disks = other.disks; + } + return this; + } + + Builder(InstancesStartWithEncryptionKeyRequest source) { + this.disks = source.disks; + } + + public List getDisksList() { + return disks; + } + + public Builder addAllDisks(List disks) { + if (this.disks == null) { + this.disks = new ArrayList<>(disks.size()); + } + this.disks.addAll(disks); + return this; + } + + public Builder addDisks(CustomerEncryptionKeyProtectedDisk disks) { + this.disks.add(disks); + return this; + } + + public InstancesStartWithEncryptionKeyRequest build() { + return new InstancesStartWithEncryptionKeyRequest(disks); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllDisks(this.disks); + return newBuilder; + } + } + + @Override + public String toString() { + return "InstancesStartWithEncryptionKeyRequest{" + "disks=" + disks + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InstancesStartWithEncryptionKeyRequest) { + InstancesStartWithEncryptionKeyRequest that = (InstancesStartWithEncryptionKeyRequest) o; + return Objects.equals(this.disks, that.getDisksList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(disks); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Interconnect.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Interconnect.java new file mode 100644 index 000000000000..089b0939531e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Interconnect.java @@ -0,0 +1,814 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Interconnect implements ApiMessage { + private final Boolean adminEnabled; + private final List circuitInfos; + private final String creationTimestamp; + private final String customerName; + private final String description; + private final List expectedOutages; + private final String googleIpAddress; + private final String googleReferenceId; + private final String id; + private final List interconnectAttachments; + private final String interconnectType; + private final String kind; + private final String linkType; + private final String location; + private final String name; + private final String nocContactEmail; + private final String operationalStatus; + private final String peerIpAddress; + private final Integer provisionedLinkCount; + private final Integer requestedLinkCount; + private final String selfLink; + + private Interconnect() { + this.adminEnabled = null; + this.circuitInfos = null; + this.creationTimestamp = null; + this.customerName = null; + this.description = null; + this.expectedOutages = null; + this.googleIpAddress = null; + this.googleReferenceId = null; + this.id = null; + this.interconnectAttachments = null; + this.interconnectType = null; + this.kind = null; + this.linkType = null; + this.location = null; + this.name = null; + this.nocContactEmail = null; + this.operationalStatus = null; + this.peerIpAddress = null; + this.provisionedLinkCount = null; + this.requestedLinkCount = null; + this.selfLink = null; + } + + private Interconnect( + Boolean adminEnabled, + List circuitInfos, + String creationTimestamp, + String customerName, + String description, + List expectedOutages, + String googleIpAddress, + String googleReferenceId, + String id, + List interconnectAttachments, + String interconnectType, + String kind, + String linkType, + String location, + String name, + String nocContactEmail, + String operationalStatus, + String peerIpAddress, + Integer provisionedLinkCount, + Integer requestedLinkCount, + String selfLink) { + this.adminEnabled = adminEnabled; + this.circuitInfos = circuitInfos; + this.creationTimestamp = creationTimestamp; + this.customerName = customerName; + this.description = description; + this.expectedOutages = expectedOutages; + this.googleIpAddress = googleIpAddress; + this.googleReferenceId = googleReferenceId; + this.id = id; + this.interconnectAttachments = interconnectAttachments; + this.interconnectType = interconnectType; + this.kind = kind; + this.linkType = linkType; + this.location = location; + this.name = name; + this.nocContactEmail = nocContactEmail; + this.operationalStatus = operationalStatus; + this.peerIpAddress = peerIpAddress; + this.provisionedLinkCount = provisionedLinkCount; + this.requestedLinkCount = requestedLinkCount; + this.selfLink = selfLink; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("adminEnabled")) { + return adminEnabled; + } + if (fieldName.equals("circuitInfos")) { + return circuitInfos; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("customerName")) { + return customerName; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("expectedOutages")) { + return expectedOutages; + } + if (fieldName.equals("googleIpAddress")) { + return googleIpAddress; + } + if (fieldName.equals("googleReferenceId")) { + return googleReferenceId; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("interconnectAttachments")) { + return interconnectAttachments; + } + if (fieldName.equals("interconnectType")) { + return interconnectType; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("linkType")) { + return linkType; + } + if (fieldName.equals("location")) { + return location; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("nocContactEmail")) { + return nocContactEmail; + } + if (fieldName.equals("operationalStatus")) { + return operationalStatus; + } + if (fieldName.equals("peerIpAddress")) { + return peerIpAddress; + } + if (fieldName.equals("provisionedLinkCount")) { + return provisionedLinkCount; + } + if (fieldName.equals("requestedLinkCount")) { + return requestedLinkCount; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getAdminEnabled() { + return adminEnabled; + } + + public List getCircuitInfosList() { + return circuitInfos; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getCustomerName() { + return customerName; + } + + public String getDescription() { + return description; + } + + public List getExpectedOutagesList() { + return expectedOutages; + } + + public String getGoogleIpAddress() { + return googleIpAddress; + } + + public String getGoogleReferenceId() { + return googleReferenceId; + } + + public String getId() { + return id; + } + + public List getInterconnectAttachmentsList() { + return interconnectAttachments; + } + + public String getInterconnectType() { + return interconnectType; + } + + public String getKind() { + return kind; + } + + public String getLinkType() { + return linkType; + } + + public String getLocation() { + return location; + } + + public String getName() { + return name; + } + + public String getNocContactEmail() { + return nocContactEmail; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public String getPeerIpAddress() { + return peerIpAddress; + } + + public Integer getProvisionedLinkCount() { + return provisionedLinkCount; + } + + public Integer getRequestedLinkCount() { + return requestedLinkCount; + } + + public String getSelfLink() { + return selfLink; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Interconnect prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Interconnect getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Interconnect DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Interconnect(); + } + + public static class Builder { + private Boolean adminEnabled; + private List circuitInfos; + private String creationTimestamp; + private String customerName; + private String description; + private List expectedOutages; + private String googleIpAddress; + private String googleReferenceId; + private String id; + private List interconnectAttachments; + private String interconnectType; + private String kind; + private String linkType; + private String location; + private String name; + private String nocContactEmail; + private String operationalStatus; + private String peerIpAddress; + private Integer provisionedLinkCount; + private Integer requestedLinkCount; + private String selfLink; + + Builder() {} + + public Builder mergeFrom(Interconnect other) { + if (other == Interconnect.getDefaultInstance()) return this; + if (other.getAdminEnabled() != null) { + this.adminEnabled = other.adminEnabled; + } + if (other.getCircuitInfosList() != null) { + this.circuitInfos = other.circuitInfos; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getCustomerName() != null) { + this.customerName = other.customerName; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getExpectedOutagesList() != null) { + this.expectedOutages = other.expectedOutages; + } + if (other.getGoogleIpAddress() != null) { + this.googleIpAddress = other.googleIpAddress; + } + if (other.getGoogleReferenceId() != null) { + this.googleReferenceId = other.googleReferenceId; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getInterconnectAttachmentsList() != null) { + this.interconnectAttachments = other.interconnectAttachments; + } + if (other.getInterconnectType() != null) { + this.interconnectType = other.interconnectType; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getLinkType() != null) { + this.linkType = other.linkType; + } + if (other.getLocation() != null) { + this.location = other.location; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNocContactEmail() != null) { + this.nocContactEmail = other.nocContactEmail; + } + if (other.getOperationalStatus() != null) { + this.operationalStatus = other.operationalStatus; + } + if (other.getPeerIpAddress() != null) { + this.peerIpAddress = other.peerIpAddress; + } + if (other.getProvisionedLinkCount() != null) { + this.provisionedLinkCount = other.provisionedLinkCount; + } + if (other.getRequestedLinkCount() != null) { + this.requestedLinkCount = other.requestedLinkCount; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + return this; + } + + Builder(Interconnect source) { + this.adminEnabled = source.adminEnabled; + this.circuitInfos = source.circuitInfos; + this.creationTimestamp = source.creationTimestamp; + this.customerName = source.customerName; + this.description = source.description; + this.expectedOutages = source.expectedOutages; + this.googleIpAddress = source.googleIpAddress; + this.googleReferenceId = source.googleReferenceId; + this.id = source.id; + this.interconnectAttachments = source.interconnectAttachments; + this.interconnectType = source.interconnectType; + this.kind = source.kind; + this.linkType = source.linkType; + this.location = source.location; + this.name = source.name; + this.nocContactEmail = source.nocContactEmail; + this.operationalStatus = source.operationalStatus; + this.peerIpAddress = source.peerIpAddress; + this.provisionedLinkCount = source.provisionedLinkCount; + this.requestedLinkCount = source.requestedLinkCount; + this.selfLink = source.selfLink; + } + + public Boolean getAdminEnabled() { + return adminEnabled; + } + + public Builder setAdminEnabled(Boolean adminEnabled) { + this.adminEnabled = adminEnabled; + return this; + } + + public List getCircuitInfosList() { + return circuitInfos; + } + + public Builder addAllCircuitInfos(List circuitInfos) { + if (this.circuitInfos == null) { + this.circuitInfos = new ArrayList<>(circuitInfos.size()); + } + this.circuitInfos.addAll(circuitInfos); + return this; + } + + public Builder addCircuitInfos(InterconnectCircuitInfo circuitInfos) { + this.circuitInfos.add(circuitInfos); + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getCustomerName() { + return customerName; + } + + public Builder setCustomerName(String customerName) { + this.customerName = customerName; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public List getExpectedOutagesList() { + return expectedOutages; + } + + public Builder addAllExpectedOutages(List expectedOutages) { + if (this.expectedOutages == null) { + this.expectedOutages = new ArrayList<>(expectedOutages.size()); + } + this.expectedOutages.addAll(expectedOutages); + return this; + } + + public Builder addExpectedOutages(InterconnectOutageNotification expectedOutages) { + this.expectedOutages.add(expectedOutages); + return this; + } + + public String getGoogleIpAddress() { + return googleIpAddress; + } + + public Builder setGoogleIpAddress(String googleIpAddress) { + this.googleIpAddress = googleIpAddress; + return this; + } + + public String getGoogleReferenceId() { + return googleReferenceId; + } + + public Builder setGoogleReferenceId(String googleReferenceId) { + this.googleReferenceId = googleReferenceId; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getInterconnectAttachmentsList() { + return interconnectAttachments; + } + + public Builder addAllInterconnectAttachments(List interconnectAttachments) { + if (this.interconnectAttachments == null) { + this.interconnectAttachments = new ArrayList<>(interconnectAttachments.size()); + } + this.interconnectAttachments.addAll(interconnectAttachments); + return this; + } + + public Builder addInterconnectAttachments(String interconnectAttachments) { + this.interconnectAttachments.add(interconnectAttachments); + return this; + } + + public String getInterconnectType() { + return interconnectType; + } + + public Builder setInterconnectType(String interconnectType) { + this.interconnectType = interconnectType; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getLinkType() { + return linkType; + } + + public Builder setLinkType(String linkType) { + this.linkType = linkType; + return this; + } + + public String getLocation() { + return location; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getNocContactEmail() { + return nocContactEmail; + } + + public Builder setNocContactEmail(String nocContactEmail) { + this.nocContactEmail = nocContactEmail; + return this; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public Builder setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + return this; + } + + public String getPeerIpAddress() { + return peerIpAddress; + } + + public Builder setPeerIpAddress(String peerIpAddress) { + this.peerIpAddress = peerIpAddress; + return this; + } + + public Integer getProvisionedLinkCount() { + return provisionedLinkCount; + } + + public Builder setProvisionedLinkCount(Integer provisionedLinkCount) { + this.provisionedLinkCount = provisionedLinkCount; + return this; + } + + public Integer getRequestedLinkCount() { + return requestedLinkCount; + } + + public Builder setRequestedLinkCount(Integer requestedLinkCount) { + this.requestedLinkCount = requestedLinkCount; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Interconnect build() { + + return new Interconnect( + adminEnabled, + circuitInfos, + creationTimestamp, + customerName, + description, + expectedOutages, + googleIpAddress, + googleReferenceId, + id, + interconnectAttachments, + interconnectType, + kind, + linkType, + location, + name, + nocContactEmail, + operationalStatus, + peerIpAddress, + provisionedLinkCount, + requestedLinkCount, + selfLink); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAdminEnabled(this.adminEnabled); + newBuilder.addAllCircuitInfos(this.circuitInfos); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setCustomerName(this.customerName); + newBuilder.setDescription(this.description); + newBuilder.addAllExpectedOutages(this.expectedOutages); + newBuilder.setGoogleIpAddress(this.googleIpAddress); + newBuilder.setGoogleReferenceId(this.googleReferenceId); + newBuilder.setId(this.id); + newBuilder.addAllInterconnectAttachments(this.interconnectAttachments); + newBuilder.setInterconnectType(this.interconnectType); + newBuilder.setKind(this.kind); + newBuilder.setLinkType(this.linkType); + newBuilder.setLocation(this.location); + newBuilder.setName(this.name); + newBuilder.setNocContactEmail(this.nocContactEmail); + newBuilder.setOperationalStatus(this.operationalStatus); + newBuilder.setPeerIpAddress(this.peerIpAddress); + newBuilder.setProvisionedLinkCount(this.provisionedLinkCount); + newBuilder.setRequestedLinkCount(this.requestedLinkCount); + newBuilder.setSelfLink(this.selfLink); + return newBuilder; + } + } + + @Override + public String toString() { + return "Interconnect{" + + "adminEnabled=" + + adminEnabled + + ", " + + "circuitInfos=" + + circuitInfos + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "customerName=" + + customerName + + ", " + + "description=" + + description + + ", " + + "expectedOutages=" + + expectedOutages + + ", " + + "googleIpAddress=" + + googleIpAddress + + ", " + + "googleReferenceId=" + + googleReferenceId + + ", " + + "id=" + + id + + ", " + + "interconnectAttachments=" + + interconnectAttachments + + ", " + + "interconnectType=" + + interconnectType + + ", " + + "kind=" + + kind + + ", " + + "linkType=" + + linkType + + ", " + + "location=" + + location + + ", " + + "name=" + + name + + ", " + + "nocContactEmail=" + + nocContactEmail + + ", " + + "operationalStatus=" + + operationalStatus + + ", " + + "peerIpAddress=" + + peerIpAddress + + ", " + + "provisionedLinkCount=" + + provisionedLinkCount + + ", " + + "requestedLinkCount=" + + requestedLinkCount + + ", " + + "selfLink=" + + selfLink + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Interconnect) { + Interconnect that = (Interconnect) o; + return Objects.equals(this.adminEnabled, that.getAdminEnabled()) + && Objects.equals(this.circuitInfos, that.getCircuitInfosList()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.customerName, that.getCustomerName()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.expectedOutages, that.getExpectedOutagesList()) + && Objects.equals(this.googleIpAddress, that.getGoogleIpAddress()) + && Objects.equals(this.googleReferenceId, that.getGoogleReferenceId()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.interconnectAttachments, that.getInterconnectAttachmentsList()) + && Objects.equals(this.interconnectType, that.getInterconnectType()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.linkType, that.getLinkType()) + && Objects.equals(this.location, that.getLocation()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.nocContactEmail, that.getNocContactEmail()) + && Objects.equals(this.operationalStatus, that.getOperationalStatus()) + && Objects.equals(this.peerIpAddress, that.getPeerIpAddress()) + && Objects.equals(this.provisionedLinkCount, that.getProvisionedLinkCount()) + && Objects.equals(this.requestedLinkCount, that.getRequestedLinkCount()) + && Objects.equals(this.selfLink, that.getSelfLink()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + adminEnabled, + circuitInfos, + creationTimestamp, + customerName, + description, + expectedOutages, + googleIpAddress, + googleReferenceId, + id, + interconnectAttachments, + interconnectType, + kind, + linkType, + location, + name, + nocContactEmail, + operationalStatus, + peerIpAddress, + provisionedLinkCount, + requestedLinkCount, + selfLink); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachment.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachment.java new file mode 100644 index 000000000000..ad6378241434 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachment.java @@ -0,0 +1,566 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectAttachment implements ApiMessage { + private final String cloudRouterIpAddress; + private final String creationTimestamp; + private final String customerRouterIpAddress; + private final String description; + private final String googleReferenceId; + private final String id; + private final String interconnect; + private final String kind; + private final String name; + private final String operationalStatus; + private final InterconnectAttachmentPrivateInfo privateInterconnectInfo; + private final String region; + private final String router; + private final String selfLink; + + private InterconnectAttachment() { + this.cloudRouterIpAddress = null; + this.creationTimestamp = null; + this.customerRouterIpAddress = null; + this.description = null; + this.googleReferenceId = null; + this.id = null; + this.interconnect = null; + this.kind = null; + this.name = null; + this.operationalStatus = null; + this.privateInterconnectInfo = null; + this.region = null; + this.router = null; + this.selfLink = null; + } + + private InterconnectAttachment( + String cloudRouterIpAddress, + String creationTimestamp, + String customerRouterIpAddress, + String description, + String googleReferenceId, + String id, + String interconnect, + String kind, + String name, + String operationalStatus, + InterconnectAttachmentPrivateInfo privateInterconnectInfo, + String region, + String router, + String selfLink) { + this.cloudRouterIpAddress = cloudRouterIpAddress; + this.creationTimestamp = creationTimestamp; + this.customerRouterIpAddress = customerRouterIpAddress; + this.description = description; + this.googleReferenceId = googleReferenceId; + this.id = id; + this.interconnect = interconnect; + this.kind = kind; + this.name = name; + this.operationalStatus = operationalStatus; + this.privateInterconnectInfo = privateInterconnectInfo; + this.region = region; + this.router = router; + this.selfLink = selfLink; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("cloudRouterIpAddress")) { + return cloudRouterIpAddress; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("customerRouterIpAddress")) { + return customerRouterIpAddress; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("googleReferenceId")) { + return googleReferenceId; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("interconnect")) { + return interconnect; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("operationalStatus")) { + return operationalStatus; + } + if (fieldName.equals("privateInterconnectInfo")) { + return privateInterconnectInfo; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("router")) { + return router; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCloudRouterIpAddress() { + return cloudRouterIpAddress; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getCustomerRouterIpAddress() { + return customerRouterIpAddress; + } + + public String getDescription() { + return description; + } + + public String getGoogleReferenceId() { + return googleReferenceId; + } + + public String getId() { + return id; + } + + public String getInterconnect() { + return interconnect; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public InterconnectAttachmentPrivateInfo getPrivateInterconnectInfo() { + return privateInterconnectInfo; + } + + public String getRegion() { + return region; + } + + public String getRouter() { + return router; + } + + public String getSelfLink() { + return selfLink; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectAttachment prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectAttachment getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectAttachment DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectAttachment(); + } + + public static class Builder { + private String cloudRouterIpAddress; + private String creationTimestamp; + private String customerRouterIpAddress; + private String description; + private String googleReferenceId; + private String id; + private String interconnect; + private String kind; + private String name; + private String operationalStatus; + private InterconnectAttachmentPrivateInfo privateInterconnectInfo; + private String region; + private String router; + private String selfLink; + + Builder() {} + + public Builder mergeFrom(InterconnectAttachment other) { + if (other == InterconnectAttachment.getDefaultInstance()) return this; + if (other.getCloudRouterIpAddress() != null) { + this.cloudRouterIpAddress = other.cloudRouterIpAddress; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getCustomerRouterIpAddress() != null) { + this.customerRouterIpAddress = other.customerRouterIpAddress; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getGoogleReferenceId() != null) { + this.googleReferenceId = other.googleReferenceId; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getInterconnect() != null) { + this.interconnect = other.interconnect; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getOperationalStatus() != null) { + this.operationalStatus = other.operationalStatus; + } + if (other.getPrivateInterconnectInfo() != null) { + this.privateInterconnectInfo = other.privateInterconnectInfo; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRouter() != null) { + this.router = other.router; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + return this; + } + + Builder(InterconnectAttachment source) { + this.cloudRouterIpAddress = source.cloudRouterIpAddress; + this.creationTimestamp = source.creationTimestamp; + this.customerRouterIpAddress = source.customerRouterIpAddress; + this.description = source.description; + this.googleReferenceId = source.googleReferenceId; + this.id = source.id; + this.interconnect = source.interconnect; + this.kind = source.kind; + this.name = source.name; + this.operationalStatus = source.operationalStatus; + this.privateInterconnectInfo = source.privateInterconnectInfo; + this.region = source.region; + this.router = source.router; + this.selfLink = source.selfLink; + } + + public String getCloudRouterIpAddress() { + return cloudRouterIpAddress; + } + + public Builder setCloudRouterIpAddress(String cloudRouterIpAddress) { + this.cloudRouterIpAddress = cloudRouterIpAddress; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getCustomerRouterIpAddress() { + return customerRouterIpAddress; + } + + public Builder setCustomerRouterIpAddress(String customerRouterIpAddress) { + this.customerRouterIpAddress = customerRouterIpAddress; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getGoogleReferenceId() { + return googleReferenceId; + } + + public Builder setGoogleReferenceId(String googleReferenceId) { + this.googleReferenceId = googleReferenceId; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getInterconnect() { + return interconnect; + } + + public Builder setInterconnect(String interconnect) { + this.interconnect = interconnect; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public Builder setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + return this; + } + + public InterconnectAttachmentPrivateInfo getPrivateInterconnectInfo() { + return privateInterconnectInfo; + } + + public Builder setPrivateInterconnectInfo( + InterconnectAttachmentPrivateInfo privateInterconnectInfo) { + this.privateInterconnectInfo = privateInterconnectInfo; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRouter() { + return router; + } + + public Builder setRouter(String router) { + this.router = router; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public InterconnectAttachment build() { + + return new InterconnectAttachment( + cloudRouterIpAddress, + creationTimestamp, + customerRouterIpAddress, + description, + googleReferenceId, + id, + interconnect, + kind, + name, + operationalStatus, + privateInterconnectInfo, + region, + router, + selfLink); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCloudRouterIpAddress(this.cloudRouterIpAddress); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setCustomerRouterIpAddress(this.customerRouterIpAddress); + newBuilder.setDescription(this.description); + newBuilder.setGoogleReferenceId(this.googleReferenceId); + newBuilder.setId(this.id); + newBuilder.setInterconnect(this.interconnect); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setOperationalStatus(this.operationalStatus); + newBuilder.setPrivateInterconnectInfo(this.privateInterconnectInfo); + newBuilder.setRegion(this.region); + newBuilder.setRouter(this.router); + newBuilder.setSelfLink(this.selfLink); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectAttachment{" + + "cloudRouterIpAddress=" + + cloudRouterIpAddress + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "customerRouterIpAddress=" + + customerRouterIpAddress + + ", " + + "description=" + + description + + ", " + + "googleReferenceId=" + + googleReferenceId + + ", " + + "id=" + + id + + ", " + + "interconnect=" + + interconnect + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "operationalStatus=" + + operationalStatus + + ", " + + "privateInterconnectInfo=" + + privateInterconnectInfo + + ", " + + "region=" + + region + + ", " + + "router=" + + router + + ", " + + "selfLink=" + + selfLink + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectAttachment) { + InterconnectAttachment that = (InterconnectAttachment) o; + return Objects.equals(this.cloudRouterIpAddress, that.getCloudRouterIpAddress()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.customerRouterIpAddress, that.getCustomerRouterIpAddress()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.googleReferenceId, that.getGoogleReferenceId()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.interconnect, that.getInterconnect()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.operationalStatus, that.getOperationalStatus()) + && Objects.equals(this.privateInterconnectInfo, that.getPrivateInterconnectInfo()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.router, that.getRouter()) + && Objects.equals(this.selfLink, that.getSelfLink()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + cloudRouterIpAddress, + creationTimestamp, + customerRouterIpAddress, + description, + googleReferenceId, + id, + interconnect, + kind, + name, + operationalStatus, + privateInterconnectInfo, + region, + router, + selfLink); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentAggregatedList.java new file mode 100644 index 000000000000..3bcad79216bf --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentAggregatedList.java @@ -0,0 +1,299 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectAttachmentAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InterconnectAttachmentAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InterconnectAttachmentAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectAttachmentAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectAttachmentAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectAttachmentAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectAttachmentAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InterconnectAttachmentAggregatedList other) { + if (other == InterconnectAttachmentAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InterconnectAttachmentAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InterconnectAttachmentAggregatedList build() { + + return new InterconnectAttachmentAggregatedList( + id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectAttachmentAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectAttachmentAggregatedList) { + InterconnectAttachmentAggregatedList that = (InterconnectAttachmentAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentClient.java new file mode 100644 index 000000000000..2db9cbfaad1b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentClient.java @@ -0,0 +1,986 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.InterconnectAttachmentStub; +import com.google.cloud.compute.v1.stub.InterconnectAttachmentStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+ *   ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
+ *   Operation response = interconnectAttachmentClient.deleteInterconnectAttachment(interconnectAttachment);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the interconnectAttachmentClient object to clean up + * resources such as threads. In the example above, try-with-resources is used, which automatically + * calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of InterconnectAttachmentSettings + * to create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * InterconnectAttachmentSettings interconnectAttachmentSettings =
+ *     InterconnectAttachmentSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * InterconnectAttachmentClient interconnectAttachmentClient =
+ *     InterconnectAttachmentClient.create(interconnectAttachmentSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * InterconnectAttachmentSettings interconnectAttachmentSettings =
+ *     InterconnectAttachmentSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * InterconnectAttachmentClient interconnectAttachmentClient =
+ *     InterconnectAttachmentClient.create(interconnectAttachmentSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InterconnectAttachmentClient implements BackgroundResource { + private final InterconnectAttachmentSettings settings; + private final InterconnectAttachmentStub stub; + + /** Constructs an instance of InterconnectAttachmentClient with default settings. */ + public static final InterconnectAttachmentClient create() throws IOException { + return create(InterconnectAttachmentSettings.newBuilder().build()); + } + + /** + * Constructs an instance of InterconnectAttachmentClient, using the given settings. The channels + * are created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final InterconnectAttachmentClient create(InterconnectAttachmentSettings settings) + throws IOException { + return new InterconnectAttachmentClient(settings); + } + + /** + * Constructs an instance of InterconnectAttachmentClient, using the given stub for making calls. + * This is for advanced usage - prefer to use InterconnectAttachmentSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final InterconnectAttachmentClient create(InterconnectAttachmentStub stub) { + return new InterconnectAttachmentClient(stub); + } + + /** + * Constructs an instance of InterconnectAttachmentClient, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected InterconnectAttachmentClient(InterconnectAttachmentSettings settings) + throws IOException { + this.settings = settings; + this.stub = ((InterconnectAttachmentStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected InterconnectAttachmentClient(InterconnectAttachmentStub stub) { + this.settings = null; + this.stub = stub; + } + + public final InterconnectAttachmentSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InterconnectAttachmentStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of interconnect attachments. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InterconnectAttachmentsScopedList element : interconnectAttachmentClient.aggregatedListInterconnectAttachments(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInterconnectAttachmentsPagedResponse + aggregatedListInterconnectAttachments(ProjectName project) { + AggregatedListInterconnectAttachmentsHttpRequest request = + AggregatedListInterconnectAttachmentsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListInterconnectAttachments(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of interconnect attachments. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InterconnectAttachmentsScopedList element : interconnectAttachmentClient.aggregatedListInterconnectAttachments(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInterconnectAttachmentsPagedResponse + aggregatedListInterconnectAttachments(String project) { + AggregatedListInterconnectAttachmentsHttpRequest request = + AggregatedListInterconnectAttachmentsHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListInterconnectAttachments(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of interconnect attachments. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInterconnectAttachmentsHttpRequest request = AggregatedListInterconnectAttachmentsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (InterconnectAttachmentsScopedList element : interconnectAttachmentClient.aggregatedListInterconnectAttachments(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListInterconnectAttachmentsPagedResponse + aggregatedListInterconnectAttachments( + AggregatedListInterconnectAttachmentsHttpRequest request) { + return aggregatedListInterconnectAttachmentsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of interconnect attachments. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInterconnectAttachmentsHttpRequest request = AggregatedListInterconnectAttachmentsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListInterconnectAttachmentsPagedResponse> future = interconnectAttachmentClient.aggregatedListInterconnectAttachmentsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InterconnectAttachmentsScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListInterconnectAttachmentsHttpRequest, + AggregatedListInterconnectAttachmentsPagedResponse> + aggregatedListInterconnectAttachmentsPagedCallable() { + return stub.aggregatedListInterconnectAttachmentsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of interconnect attachments. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListInterconnectAttachmentsHttpRequest request = AggregatedListInterconnectAttachmentsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     InterconnectAttachmentAggregatedList response = interconnectAttachmentClient.aggregatedListInterconnectAttachmentsCallable().call(request);
+   *     for (InterconnectAttachmentsScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList> + aggregatedListInterconnectAttachmentsCallable() { + return stub.aggregatedListInterconnectAttachmentsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified interconnect attachment. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
+   *   Operation response = interconnectAttachmentClient.deleteInterconnectAttachment(interconnectAttachment);
+   * }
+   * 
+ * + * @param interconnectAttachment Name of the interconnect attachment to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInterconnectAttachment( + ProjectRegionInterconnectAttachmentName interconnectAttachment) { + + DeleteInterconnectAttachmentHttpRequest request = + DeleteInterconnectAttachmentHttpRequest.newBuilder() + .setInterconnectAttachment( + interconnectAttachment == null ? null : interconnectAttachment.toString()) + .build(); + return deleteInterconnectAttachment(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified interconnect attachment. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
+   *   Operation response = interconnectAttachmentClient.deleteInterconnectAttachment(interconnectAttachment.toString());
+   * }
+   * 
+ * + * @param interconnectAttachment Name of the interconnect attachment to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInterconnectAttachment(String interconnectAttachment) { + + DeleteInterconnectAttachmentHttpRequest request = + DeleteInterconnectAttachmentHttpRequest.newBuilder() + .setInterconnectAttachment(interconnectAttachment) + .build(); + return deleteInterconnectAttachment(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified interconnect attachment. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
+   *   DeleteInterconnectAttachmentHttpRequest request = DeleteInterconnectAttachmentHttpRequest.newBuilder()
+   *     .setInterconnectAttachment(interconnectAttachment.toString())
+   *     .build();
+   *   Operation response = interconnectAttachmentClient.deleteInterconnectAttachment(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInterconnectAttachment( + DeleteInterconnectAttachmentHttpRequest request) { + return deleteInterconnectAttachmentCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified interconnect attachment. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
+   *   DeleteInterconnectAttachmentHttpRequest request = DeleteInterconnectAttachmentHttpRequest.newBuilder()
+   *     .setInterconnectAttachment(interconnectAttachment.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = interconnectAttachmentClient.deleteInterconnectAttachmentCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteInterconnectAttachmentCallable() { + return stub.deleteInterconnectAttachmentCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified interconnect attachment. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
+   *   InterconnectAttachment response = interconnectAttachmentClient.getInterconnectAttachment(interconnectAttachment);
+   * }
+   * 
+ * + * @param interconnectAttachment Name of the interconnect attachment to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InterconnectAttachment getInterconnectAttachment( + ProjectRegionInterconnectAttachmentName interconnectAttachment) { + + GetInterconnectAttachmentHttpRequest request = + GetInterconnectAttachmentHttpRequest.newBuilder() + .setInterconnectAttachment( + interconnectAttachment == null ? null : interconnectAttachment.toString()) + .build(); + return getInterconnectAttachment(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified interconnect attachment. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
+   *   InterconnectAttachment response = interconnectAttachmentClient.getInterconnectAttachment(interconnectAttachment.toString());
+   * }
+   * 
+ * + * @param interconnectAttachment Name of the interconnect attachment to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InterconnectAttachment getInterconnectAttachment(String interconnectAttachment) { + + GetInterconnectAttachmentHttpRequest request = + GetInterconnectAttachmentHttpRequest.newBuilder() + .setInterconnectAttachment(interconnectAttachment) + .build(); + return getInterconnectAttachment(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified interconnect attachment. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
+   *   GetInterconnectAttachmentHttpRequest request = GetInterconnectAttachmentHttpRequest.newBuilder()
+   *     .setInterconnectAttachment(interconnectAttachment.toString())
+   *     .build();
+   *   InterconnectAttachment response = interconnectAttachmentClient.getInterconnectAttachment(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InterconnectAttachment getInterconnectAttachment( + GetInterconnectAttachmentHttpRequest request) { + return getInterconnectAttachmentCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified interconnect attachment. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
+   *   GetInterconnectAttachmentHttpRequest request = GetInterconnectAttachmentHttpRequest.newBuilder()
+   *     .setInterconnectAttachment(interconnectAttachment.toString())
+   *     .build();
+   *   ApiFuture<InterconnectAttachment> future = interconnectAttachmentClient.getInterconnectAttachmentCallable().futureCall(request);
+   *   // Do something
+   *   InterconnectAttachment response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getInterconnectAttachmentCallable() { + return stub.getInterconnectAttachmentCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an InterconnectAttachment in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   InterconnectAttachment interconnectAttachmentResource = InterconnectAttachment.newBuilder().build();
+   *   Operation response = interconnectAttachmentClient.insertInterconnectAttachment(region, interconnectAttachmentResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param interconnectAttachmentResource Represents an InterconnectAttachment (VLAN attachment) + * resource. For more information, see Creating VLAN Attachments. (== resource_for + * beta.interconnectAttachments ==) (== resource_for v1.interconnectAttachments ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInterconnectAttachment( + ProjectRegionName region, InterconnectAttachment interconnectAttachmentResource) { + + InsertInterconnectAttachmentHttpRequest request = + InsertInterconnectAttachmentHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setInterconnectAttachmentResource(interconnectAttachmentResource) + .build(); + return insertInterconnectAttachment(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an InterconnectAttachment in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   InterconnectAttachment interconnectAttachmentResource = InterconnectAttachment.newBuilder().build();
+   *   Operation response = interconnectAttachmentClient.insertInterconnectAttachment(region.toString(), interconnectAttachmentResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param interconnectAttachmentResource Represents an InterconnectAttachment (VLAN attachment) + * resource. For more information, see Creating VLAN Attachments. (== resource_for + * beta.interconnectAttachments ==) (== resource_for v1.interconnectAttachments ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInterconnectAttachment( + String region, InterconnectAttachment interconnectAttachmentResource) { + + InsertInterconnectAttachmentHttpRequest request = + InsertInterconnectAttachmentHttpRequest.newBuilder() + .setRegion(region) + .setInterconnectAttachmentResource(interconnectAttachmentResource) + .build(); + return insertInterconnectAttachment(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an InterconnectAttachment in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   InterconnectAttachment interconnectAttachmentResource = InterconnectAttachment.newBuilder().build();
+   *   InsertInterconnectAttachmentHttpRequest request = InsertInterconnectAttachmentHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setInterconnectAttachmentResource(interconnectAttachmentResource)
+   *     .build();
+   *   Operation response = interconnectAttachmentClient.insertInterconnectAttachment(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInterconnectAttachment( + InsertInterconnectAttachmentHttpRequest request) { + return insertInterconnectAttachmentCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an InterconnectAttachment in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   InterconnectAttachment interconnectAttachmentResource = InterconnectAttachment.newBuilder().build();
+   *   InsertInterconnectAttachmentHttpRequest request = InsertInterconnectAttachmentHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setInterconnectAttachmentResource(interconnectAttachmentResource)
+   *     .build();
+   *   ApiFuture<Operation> future = interconnectAttachmentClient.insertInterconnectAttachmentCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertInterconnectAttachmentCallable() { + return stub.insertInterconnectAttachmentCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect attachments contained within the specified region. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (InterconnectAttachment element : interconnectAttachmentClient.listInterconnectAttachments(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInterconnectAttachmentsPagedResponse listInterconnectAttachments( + ProjectRegionName region) { + ListInterconnectAttachmentsHttpRequest request = + ListInterconnectAttachmentsHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listInterconnectAttachments(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect attachments contained within the specified region. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (InterconnectAttachment element : interconnectAttachmentClient.listInterconnectAttachments(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInterconnectAttachmentsPagedResponse listInterconnectAttachments(String region) { + ListInterconnectAttachmentsHttpRequest request = + ListInterconnectAttachmentsHttpRequest.newBuilder().setRegion(region).build(); + return listInterconnectAttachments(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect attachments contained within the specified region. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListInterconnectAttachmentsHttpRequest request = ListInterconnectAttachmentsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (InterconnectAttachment element : interconnectAttachmentClient.listInterconnectAttachments(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInterconnectAttachmentsPagedResponse listInterconnectAttachments( + ListInterconnectAttachmentsHttpRequest request) { + return listInterconnectAttachmentsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect attachments contained within the specified region. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListInterconnectAttachmentsHttpRequest request = ListInterconnectAttachmentsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListInterconnectAttachmentsPagedResponse> future = interconnectAttachmentClient.listInterconnectAttachmentsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InterconnectAttachment element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListInterconnectAttachmentsHttpRequest, ListInterconnectAttachmentsPagedResponse> + listInterconnectAttachmentsPagedCallable() { + return stub.listInterconnectAttachmentsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect attachments contained within the specified region. + * + *

Sample code: + * + *


+   * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListInterconnectAttachmentsHttpRequest request = ListInterconnectAttachmentsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     InterconnectAttachmentList response = interconnectAttachmentClient.listInterconnectAttachmentsCallable().call(request);
+   *     for (InterconnectAttachment element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listInterconnectAttachmentsCallable() { + return stub.listInterconnectAttachmentsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListInterconnectAttachmentsPagedResponse + extends AbstractPagedListResponse< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList, + InterconnectAttachmentsScopedList, AggregatedListInterconnectAttachmentsPage, + AggregatedListInterconnectAttachmentsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListInterconnectAttachmentsHttpRequest, + InterconnectAttachmentAggregatedList, InterconnectAttachmentsScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListInterconnectAttachmentsPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + AggregatedListInterconnectAttachmentsPage, + AggregatedListInterconnectAttachmentsPagedResponse>() { + @Override + public AggregatedListInterconnectAttachmentsPagedResponse apply( + AggregatedListInterconnectAttachmentsPage input) { + return new AggregatedListInterconnectAttachmentsPagedResponse(input); + } + }); + } + + private AggregatedListInterconnectAttachmentsPagedResponse( + AggregatedListInterconnectAttachmentsPage page) { + super(page, AggregatedListInterconnectAttachmentsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListInterconnectAttachmentsPage + extends AbstractPage< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList, + InterconnectAttachmentsScopedList, AggregatedListInterconnectAttachmentsPage> { + + private AggregatedListInterconnectAttachmentsPage( + PageContext< + AggregatedListInterconnectAttachmentsHttpRequest, + InterconnectAttachmentAggregatedList, InterconnectAttachmentsScopedList> + context, + InterconnectAttachmentAggregatedList response) { + super(context, response); + } + + private static AggregatedListInterconnectAttachmentsPage createEmptyPage() { + return new AggregatedListInterconnectAttachmentsPage(null, null); + } + + @Override + protected AggregatedListInterconnectAttachmentsPage createPage( + PageContext< + AggregatedListInterconnectAttachmentsHttpRequest, + InterconnectAttachmentAggregatedList, InterconnectAttachmentsScopedList> + context, + InterconnectAttachmentAggregatedList response) { + return new AggregatedListInterconnectAttachmentsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListInterconnectAttachmentsHttpRequest, + InterconnectAttachmentAggregatedList, InterconnectAttachmentsScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListInterconnectAttachmentsFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList, + InterconnectAttachmentsScopedList, AggregatedListInterconnectAttachmentsPage, + AggregatedListInterconnectAttachmentsFixedSizeCollection> { + + private AggregatedListInterconnectAttachmentsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListInterconnectAttachmentsFixedSizeCollection + createEmptyCollection() { + return new AggregatedListInterconnectAttachmentsFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListInterconnectAttachmentsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListInterconnectAttachmentsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListInterconnectAttachmentsPagedResponse + extends AbstractPagedListResponse< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + InterconnectAttachment, ListInterconnectAttachmentsPage, + ListInterconnectAttachmentsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + InterconnectAttachment> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListInterconnectAttachmentsPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + ListInterconnectAttachmentsPage, ListInterconnectAttachmentsPagedResponse>() { + @Override + public ListInterconnectAttachmentsPagedResponse apply( + ListInterconnectAttachmentsPage input) { + return new ListInterconnectAttachmentsPagedResponse(input); + } + }); + } + + private ListInterconnectAttachmentsPagedResponse(ListInterconnectAttachmentsPage page) { + super(page, ListInterconnectAttachmentsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListInterconnectAttachmentsPage + extends AbstractPage< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + InterconnectAttachment, ListInterconnectAttachmentsPage> { + + private ListInterconnectAttachmentsPage( + PageContext< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + InterconnectAttachment> + context, + InterconnectAttachmentList response) { + super(context, response); + } + + private static ListInterconnectAttachmentsPage createEmptyPage() { + return new ListInterconnectAttachmentsPage(null, null); + } + + @Override + protected ListInterconnectAttachmentsPage createPage( + PageContext< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + InterconnectAttachment> + context, + InterconnectAttachmentList response) { + return new ListInterconnectAttachmentsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + InterconnectAttachment> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListInterconnectAttachmentsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + InterconnectAttachment, ListInterconnectAttachmentsPage, + ListInterconnectAttachmentsFixedSizeCollection> { + + private ListInterconnectAttachmentsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListInterconnectAttachmentsFixedSizeCollection createEmptyCollection() { + return new ListInterconnectAttachmentsFixedSizeCollection(null, 0); + } + + @Override + protected ListInterconnectAttachmentsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListInterconnectAttachmentsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentList.java new file mode 100644 index 000000000000..1191157b728f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectAttachmentList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InterconnectAttachmentList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InterconnectAttachmentList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectAttachmentList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectAttachmentList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectAttachmentList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectAttachmentList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InterconnectAttachmentList other) { + if (other == InterconnectAttachmentList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InterconnectAttachmentList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(InterconnectAttachment items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InterconnectAttachmentList build() { + + return new InterconnectAttachmentList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectAttachmentList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectAttachmentList) { + InterconnectAttachmentList that = (InterconnectAttachmentList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentPrivateInfo.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentPrivateInfo.java new file mode 100644 index 000000000000..25728173b18d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentPrivateInfo.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectAttachmentPrivateInfo implements ApiMessage { + private final Integer tag8021q; + + private InterconnectAttachmentPrivateInfo() { + this.tag8021q = null; + } + + private InterconnectAttachmentPrivateInfo(Integer tag8021q) { + this.tag8021q = tag8021q; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("tag8021q")) { + return tag8021q; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getTag8021q() { + return tag8021q; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectAttachmentPrivateInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectAttachmentPrivateInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectAttachmentPrivateInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectAttachmentPrivateInfo(); + } + + public static class Builder { + private Integer tag8021q; + + Builder() {} + + public Builder mergeFrom(InterconnectAttachmentPrivateInfo other) { + if (other == InterconnectAttachmentPrivateInfo.getDefaultInstance()) return this; + if (other.getTag8021q() != null) { + this.tag8021q = other.tag8021q; + } + return this; + } + + Builder(InterconnectAttachmentPrivateInfo source) { + this.tag8021q = source.tag8021q; + } + + public Integer getTag8021q() { + return tag8021q; + } + + public Builder setTag8021q(Integer tag8021q) { + this.tag8021q = tag8021q; + return this; + } + + public InterconnectAttachmentPrivateInfo build() { + return new InterconnectAttachmentPrivateInfo(tag8021q); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setTag8021q(this.tag8021q); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectAttachmentPrivateInfo{" + "tag8021q=" + tag8021q + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectAttachmentPrivateInfo) { + InterconnectAttachmentPrivateInfo that = (InterconnectAttachmentPrivateInfo) o; + return Objects.equals(this.tag8021q, that.getTag8021q()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(tag8021q); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentSettings.java new file mode 100644 index 000000000000..e0df5fb63acb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentSettings.java @@ -0,0 +1,252 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InterconnectAttachmentClient.AggregatedListInterconnectAttachmentsPagedResponse; +import static com.google.cloud.compute.v1.InterconnectAttachmentClient.ListInterconnectAttachmentsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.InterconnectAttachmentStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InterconnectAttachmentClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteInterconnectAttachment to 30 seconds: + * + *

+ * 
+ * InterconnectAttachmentSettings.Builder interconnectAttachmentSettingsBuilder =
+ *     InterconnectAttachmentSettings.newBuilder();
+ * interconnectAttachmentSettingsBuilder.deleteInterconnectAttachmentSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InterconnectAttachmentSettings interconnectAttachmentSettings = interconnectAttachmentSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InterconnectAttachmentSettings extends ClientSettings { + /** + * Returns the object with the settings used for calls to aggregatedListInterconnectAttachments. + */ + public PagedCallSettings< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList, + AggregatedListInterconnectAttachmentsPagedResponse> + aggregatedListInterconnectAttachmentsSettings() { + return ((InterconnectAttachmentStubSettings) getStubSettings()) + .aggregatedListInterconnectAttachmentsSettings(); + } + + /** Returns the object with the settings used for calls to deleteInterconnectAttachment. */ + public UnaryCallSettings + deleteInterconnectAttachmentSettings() { + return ((InterconnectAttachmentStubSettings) getStubSettings()) + .deleteInterconnectAttachmentSettings(); + } + + /** Returns the object with the settings used for calls to getInterconnectAttachment. */ + public UnaryCallSettings + getInterconnectAttachmentSettings() { + return ((InterconnectAttachmentStubSettings) getStubSettings()) + .getInterconnectAttachmentSettings(); + } + + /** Returns the object with the settings used for calls to insertInterconnectAttachment. */ + public UnaryCallSettings + insertInterconnectAttachmentSettings() { + return ((InterconnectAttachmentStubSettings) getStubSettings()) + .insertInterconnectAttachmentSettings(); + } + + /** Returns the object with the settings used for calls to listInterconnectAttachments. */ + public PagedCallSettings< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + ListInterconnectAttachmentsPagedResponse> + listInterconnectAttachmentsSettings() { + return ((InterconnectAttachmentStubSettings) getStubSettings()) + .listInterconnectAttachmentsSettings(); + } + + public static final InterconnectAttachmentSettings create(InterconnectAttachmentStubSettings stub) + throws IOException { + return new InterconnectAttachmentSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InterconnectAttachmentStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return InterconnectAttachmentStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return InterconnectAttachmentStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return InterconnectAttachmentStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return InterconnectAttachmentStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InterconnectAttachmentStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return InterconnectAttachmentStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return InterconnectAttachmentStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InterconnectAttachmentSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for InterconnectAttachmentSettings. */ + public static class Builder + extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(InterconnectAttachmentStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(InterconnectAttachmentStubSettings.newBuilder()); + } + + protected Builder(InterconnectAttachmentSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(InterconnectAttachmentStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public InterconnectAttachmentStubSettings.Builder getStubSettingsBuilder() { + return ((InterconnectAttachmentStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** + * Returns the builder for the settings used for calls to aggregatedListInterconnectAttachments. + */ + public PagedCallSettings.Builder< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList, + AggregatedListInterconnectAttachmentsPagedResponse> + aggregatedListInterconnectAttachmentsSettings() { + return getStubSettingsBuilder().aggregatedListInterconnectAttachmentsSettings(); + } + + /** Returns the builder for the settings used for calls to deleteInterconnectAttachment. */ + public UnaryCallSettings.Builder + deleteInterconnectAttachmentSettings() { + return getStubSettingsBuilder().deleteInterconnectAttachmentSettings(); + } + + /** Returns the builder for the settings used for calls to getInterconnectAttachment. */ + public UnaryCallSettings.Builder + getInterconnectAttachmentSettings() { + return getStubSettingsBuilder().getInterconnectAttachmentSettings(); + } + + /** Returns the builder for the settings used for calls to insertInterconnectAttachment. */ + public UnaryCallSettings.Builder + insertInterconnectAttachmentSettings() { + return getStubSettingsBuilder().insertInterconnectAttachmentSettings(); + } + + /** Returns the builder for the settings used for calls to listInterconnectAttachments. */ + public PagedCallSettings.Builder< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + ListInterconnectAttachmentsPagedResponse> + listInterconnectAttachmentsSettings() { + return getStubSettingsBuilder().listInterconnectAttachmentsSettings(); + } + + @Override + public InterconnectAttachmentSettings build() throws IOException { + return new InterconnectAttachmentSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentsScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentsScopedList.java new file mode 100644 index 000000000000..61be55216bf4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentsScopedList.java @@ -0,0 +1,186 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectAttachmentsScopedList implements ApiMessage { + private final List interconnectAttachments; + private final Warning warning; + + private InterconnectAttachmentsScopedList() { + this.interconnectAttachments = null; + this.warning = null; + } + + private InterconnectAttachmentsScopedList( + List interconnectAttachments, Warning warning) { + this.interconnectAttachments = interconnectAttachments; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("interconnectAttachments")) { + return interconnectAttachments; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInterconnectAttachmentsList() { + return interconnectAttachments; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectAttachmentsScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectAttachmentsScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectAttachmentsScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectAttachmentsScopedList(); + } + + public static class Builder { + private List interconnectAttachments; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InterconnectAttachmentsScopedList other) { + if (other == InterconnectAttachmentsScopedList.getDefaultInstance()) return this; + if (other.getInterconnectAttachmentsList() != null) { + this.interconnectAttachments = other.interconnectAttachments; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InterconnectAttachmentsScopedList source) { + this.interconnectAttachments = source.interconnectAttachments; + this.warning = source.warning; + } + + public List getInterconnectAttachmentsList() { + return interconnectAttachments; + } + + public Builder addAllInterconnectAttachments( + List interconnectAttachments) { + if (this.interconnectAttachments == null) { + this.interconnectAttachments = new ArrayList<>(interconnectAttachments.size()); + } + this.interconnectAttachments.addAll(interconnectAttachments); + return this; + } + + public Builder addInterconnectAttachments(InterconnectAttachment interconnectAttachments) { + this.interconnectAttachments.add(interconnectAttachments); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InterconnectAttachmentsScopedList build() { + + return new InterconnectAttachmentsScopedList(interconnectAttachments, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInterconnectAttachments(this.interconnectAttachments); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectAttachmentsScopedList{" + + "interconnectAttachments=" + + interconnectAttachments + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectAttachmentsScopedList) { + InterconnectAttachmentsScopedList that = (InterconnectAttachmentsScopedList) o; + return Objects.equals(this.interconnectAttachments, that.getInterconnectAttachmentsList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(interconnectAttachments, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectCircuitInfo.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectCircuitInfo.java new file mode 100644 index 000000000000..6f97b0aaf04b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectCircuitInfo.java @@ -0,0 +1,205 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectCircuitInfo implements ApiMessage { + private final String customerDemarcId; + private final String googleCircuitId; + private final String googleDemarcId; + + private InterconnectCircuitInfo() { + this.customerDemarcId = null; + this.googleCircuitId = null; + this.googleDemarcId = null; + } + + private InterconnectCircuitInfo( + String customerDemarcId, String googleCircuitId, String googleDemarcId) { + this.customerDemarcId = customerDemarcId; + this.googleCircuitId = googleCircuitId; + this.googleDemarcId = googleDemarcId; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("customerDemarcId")) { + return customerDemarcId; + } + if (fieldName.equals("googleCircuitId")) { + return googleCircuitId; + } + if (fieldName.equals("googleDemarcId")) { + return googleDemarcId; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCustomerDemarcId() { + return customerDemarcId; + } + + public String getGoogleCircuitId() { + return googleCircuitId; + } + + public String getGoogleDemarcId() { + return googleDemarcId; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectCircuitInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectCircuitInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectCircuitInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectCircuitInfo(); + } + + public static class Builder { + private String customerDemarcId; + private String googleCircuitId; + private String googleDemarcId; + + Builder() {} + + public Builder mergeFrom(InterconnectCircuitInfo other) { + if (other == InterconnectCircuitInfo.getDefaultInstance()) return this; + if (other.getCustomerDemarcId() != null) { + this.customerDemarcId = other.customerDemarcId; + } + if (other.getGoogleCircuitId() != null) { + this.googleCircuitId = other.googleCircuitId; + } + if (other.getGoogleDemarcId() != null) { + this.googleDemarcId = other.googleDemarcId; + } + return this; + } + + Builder(InterconnectCircuitInfo source) { + this.customerDemarcId = source.customerDemarcId; + this.googleCircuitId = source.googleCircuitId; + this.googleDemarcId = source.googleDemarcId; + } + + public String getCustomerDemarcId() { + return customerDemarcId; + } + + public Builder setCustomerDemarcId(String customerDemarcId) { + this.customerDemarcId = customerDemarcId; + return this; + } + + public String getGoogleCircuitId() { + return googleCircuitId; + } + + public Builder setGoogleCircuitId(String googleCircuitId) { + this.googleCircuitId = googleCircuitId; + return this; + } + + public String getGoogleDemarcId() { + return googleDemarcId; + } + + public Builder setGoogleDemarcId(String googleDemarcId) { + this.googleDemarcId = googleDemarcId; + return this; + } + + public InterconnectCircuitInfo build() { + + return new InterconnectCircuitInfo(customerDemarcId, googleCircuitId, googleDemarcId); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCustomerDemarcId(this.customerDemarcId); + newBuilder.setGoogleCircuitId(this.googleCircuitId); + newBuilder.setGoogleDemarcId(this.googleDemarcId); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectCircuitInfo{" + + "customerDemarcId=" + + customerDemarcId + + ", " + + "googleCircuitId=" + + googleCircuitId + + ", " + + "googleDemarcId=" + + googleDemarcId + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectCircuitInfo) { + InterconnectCircuitInfo that = (InterconnectCircuitInfo) o; + return Objects.equals(this.customerDemarcId, that.getCustomerDemarcId()) + && Objects.equals(this.googleCircuitId, that.getGoogleCircuitId()) + && Objects.equals(this.googleDemarcId, that.getGoogleDemarcId()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(customerDemarcId, googleCircuitId, googleDemarcId); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectClient.java new file mode 100644 index 000000000000..4116545da5b4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectClient.java @@ -0,0 +1,832 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.InterconnectStub; +import com.google.cloud.compute.v1.stub.InterconnectStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+ *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+ *   Operation response = interconnectClient.deleteInterconnect(interconnect);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the interconnectClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of InterconnectSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * InterconnectSettings interconnectSettings =
+ *     InterconnectSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * InterconnectClient interconnectClient =
+ *     InterconnectClient.create(interconnectSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * InterconnectSettings interconnectSettings =
+ *     InterconnectSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * InterconnectClient interconnectClient =
+ *     InterconnectClient.create(interconnectSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InterconnectClient implements BackgroundResource { + private final InterconnectSettings settings; + private final InterconnectStub stub; + + /** Constructs an instance of InterconnectClient with default settings. */ + public static final InterconnectClient create() throws IOException { + return create(InterconnectSettings.newBuilder().build()); + } + + /** + * Constructs an instance of InterconnectClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final InterconnectClient create(InterconnectSettings settings) throws IOException { + return new InterconnectClient(settings); + } + + /** + * Constructs an instance of InterconnectClient, using the given stub for making calls. This is + * for advanced usage - prefer to use InterconnectSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final InterconnectClient create(InterconnectStub stub) { + return new InterconnectClient(stub); + } + + /** + * Constructs an instance of InterconnectClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected InterconnectClient(InterconnectSettings settings) throws IOException { + this.settings = settings; + this.stub = ((InterconnectStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected InterconnectClient(InterconnectStub stub) { + this.settings = null; + this.stub = stub; + } + + public final InterconnectSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InterconnectStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified interconnect. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   Operation response = interconnectClient.deleteInterconnect(interconnect);
+   * }
+   * 
+ * + * @param interconnect Name of the interconnect to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInterconnect(ProjectGlobalInterconnectName interconnect) { + + DeleteInterconnectHttpRequest request = + DeleteInterconnectHttpRequest.newBuilder() + .setInterconnect(interconnect == null ? null : interconnect.toString()) + .build(); + return deleteInterconnect(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified interconnect. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   Operation response = interconnectClient.deleteInterconnect(interconnect.toString());
+   * }
+   * 
+ * + * @param interconnect Name of the interconnect to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInterconnect(String interconnect) { + + DeleteInterconnectHttpRequest request = + DeleteInterconnectHttpRequest.newBuilder().setInterconnect(interconnect).build(); + return deleteInterconnect(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified interconnect. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   DeleteInterconnectHttpRequest request = DeleteInterconnectHttpRequest.newBuilder()
+   *     .setInterconnect(interconnect.toString())
+   *     .build();
+   *   Operation response = interconnectClient.deleteInterconnect(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInterconnect(DeleteInterconnectHttpRequest request) { + return deleteInterconnectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified interconnect. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   DeleteInterconnectHttpRequest request = DeleteInterconnectHttpRequest.newBuilder()
+   *     .setInterconnect(interconnect.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = interconnectClient.deleteInterconnectCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteInterconnectCallable() { + return stub.deleteInterconnectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified interconnect. Get a list of available interconnects by making a list() + * request. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   Interconnect response = interconnectClient.getInterconnect(interconnect);
+   * }
+   * 
+ * + * @param interconnect Name of the interconnect to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Interconnect getInterconnect(ProjectGlobalInterconnectName interconnect) { + + GetInterconnectHttpRequest request = + GetInterconnectHttpRequest.newBuilder() + .setInterconnect(interconnect == null ? null : interconnect.toString()) + .build(); + return getInterconnect(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified interconnect. Get a list of available interconnects by making a list() + * request. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   Interconnect response = interconnectClient.getInterconnect(interconnect.toString());
+   * }
+   * 
+ * + * @param interconnect Name of the interconnect to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Interconnect getInterconnect(String interconnect) { + + GetInterconnectHttpRequest request = + GetInterconnectHttpRequest.newBuilder().setInterconnect(interconnect).build(); + return getInterconnect(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified interconnect. Get a list of available interconnects by making a list() + * request. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   GetInterconnectHttpRequest request = GetInterconnectHttpRequest.newBuilder()
+   *     .setInterconnect(interconnect.toString())
+   *     .build();
+   *   Interconnect response = interconnectClient.getInterconnect(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Interconnect getInterconnect(GetInterconnectHttpRequest request) { + return getInterconnectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified interconnect. Get a list of available interconnects by making a list() + * request. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   GetInterconnectHttpRequest request = GetInterconnectHttpRequest.newBuilder()
+   *     .setInterconnect(interconnect.toString())
+   *     .build();
+   *   ApiFuture<Interconnect> future = interconnectClient.getInterconnectCallable().futureCall(request);
+   *   // Do something
+   *   Interconnect response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getInterconnectCallable() { + return stub.getInterconnectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Interconnect in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Interconnect interconnectResource = Interconnect.newBuilder().build();
+   *   Operation response = interconnectClient.insertInterconnect(project, interconnectResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param interconnectResource Represents an Interconnects resource. The Interconnects resource is + * a dedicated connection between Google's network and your on-premises network. For more + * information, see the Dedicated overview page. (== resource_for v1.interconnects ==) (== + * resource_for beta.interconnects ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInterconnect( + ProjectName project, Interconnect interconnectResource) { + + InsertInterconnectHttpRequest request = + InsertInterconnectHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setInterconnectResource(interconnectResource) + .build(); + return insertInterconnect(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Interconnect in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Interconnect interconnectResource = Interconnect.newBuilder().build();
+   *   Operation response = interconnectClient.insertInterconnect(project.toString(), interconnectResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param interconnectResource Represents an Interconnects resource. The Interconnects resource is + * a dedicated connection between Google's network and your on-premises network. For more + * information, see the Dedicated overview page. (== resource_for v1.interconnects ==) (== + * resource_for beta.interconnects ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInterconnect(String project, Interconnect interconnectResource) { + + InsertInterconnectHttpRequest request = + InsertInterconnectHttpRequest.newBuilder() + .setProject(project) + .setInterconnectResource(interconnectResource) + .build(); + return insertInterconnect(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Interconnect in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Interconnect interconnectResource = Interconnect.newBuilder().build();
+   *   InsertInterconnectHttpRequest request = InsertInterconnectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setInterconnectResource(interconnectResource)
+   *     .build();
+   *   Operation response = interconnectClient.insertInterconnect(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertInterconnect(InsertInterconnectHttpRequest request) { + return insertInterconnectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Interconnect in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Interconnect interconnectResource = Interconnect.newBuilder().build();
+   *   InsertInterconnectHttpRequest request = InsertInterconnectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setInterconnectResource(interconnectResource)
+   *     .build();
+   *   ApiFuture<Operation> future = interconnectClient.insertInterconnectCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertInterconnectCallable() { + return stub.insertInterconnectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect available to the specified project. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Interconnect element : interconnectClient.listInterconnects(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInterconnectsPagedResponse listInterconnects(ProjectName project) { + ListInterconnectsHttpRequest request = + ListInterconnectsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listInterconnects(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect available to the specified project. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Interconnect element : interconnectClient.listInterconnects(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInterconnectsPagedResponse listInterconnects(String project) { + ListInterconnectsHttpRequest request = + ListInterconnectsHttpRequest.newBuilder().setProject(project).build(); + return listInterconnects(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect available to the specified project. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListInterconnectsHttpRequest request = ListInterconnectsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (Interconnect element : interconnectClient.listInterconnects(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInterconnectsPagedResponse listInterconnects( + ListInterconnectsHttpRequest request) { + return listInterconnectsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect available to the specified project. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListInterconnectsHttpRequest request = ListInterconnectsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListInterconnectsPagedResponse> future = interconnectClient.listInterconnectsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Interconnect element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listInterconnectsPagedCallable() { + return stub.listInterconnectsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect available to the specified project. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListInterconnectsHttpRequest request = ListInterconnectsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     InterconnectList response = interconnectClient.listInterconnectsCallable().call(request);
+   *     for (Interconnect element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listInterconnectsCallable() { + return stub.listInterconnectsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified interconnect with the data included in the request. This method supports + * PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   Interconnect interconnectResource = Interconnect.newBuilder().build();
+   *   Operation response = interconnectClient.patchInterconnect(interconnect, interconnectResource);
+   * }
+   * 
+ * + * @param interconnect Name of the interconnect to update. + * @param interconnectResource Represents an Interconnects resource. The Interconnects resource is + * a dedicated connection between Google's network and your on-premises network. For more + * information, see the Dedicated overview page. (== resource_for v1.interconnects ==) (== + * resource_for beta.interconnects ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchInterconnect( + ProjectGlobalInterconnectName interconnect, Interconnect interconnectResource) { + + PatchInterconnectHttpRequest request = + PatchInterconnectHttpRequest.newBuilder() + .setInterconnect(interconnect == null ? null : interconnect.toString()) + .setInterconnectResource(interconnectResource) + .build(); + return patchInterconnect(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified interconnect with the data included in the request. This method supports + * PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   Interconnect interconnectResource = Interconnect.newBuilder().build();
+   *   Operation response = interconnectClient.patchInterconnect(interconnect.toString(), interconnectResource);
+   * }
+   * 
+ * + * @param interconnect Name of the interconnect to update. + * @param interconnectResource Represents an Interconnects resource. The Interconnects resource is + * a dedicated connection between Google's network and your on-premises network. For more + * information, see the Dedicated overview page. (== resource_for v1.interconnects ==) (== + * resource_for beta.interconnects ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchInterconnect(String interconnect, Interconnect interconnectResource) { + + PatchInterconnectHttpRequest request = + PatchInterconnectHttpRequest.newBuilder() + .setInterconnect(interconnect) + .setInterconnectResource(interconnectResource) + .build(); + return patchInterconnect(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified interconnect with the data included in the request. This method supports + * PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   Interconnect interconnectResource = Interconnect.newBuilder().build();
+   *   PatchInterconnectHttpRequest request = PatchInterconnectHttpRequest.newBuilder()
+   *     .setInterconnect(interconnect.toString())
+   *     .setInterconnectResource(interconnectResource)
+   *     .build();
+   *   Operation response = interconnectClient.patchInterconnect(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchInterconnect(PatchInterconnectHttpRequest request) { + return patchInterconnectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified interconnect with the data included in the request. This method supports + * PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+   *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+   *   Interconnect interconnectResource = Interconnect.newBuilder().build();
+   *   PatchInterconnectHttpRequest request = PatchInterconnectHttpRequest.newBuilder()
+   *     .setInterconnect(interconnect.toString())
+   *     .setInterconnectResource(interconnectResource)
+   *     .build();
+   *   ApiFuture<Operation> future = interconnectClient.patchInterconnectCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable patchInterconnectCallable() { + return stub.patchInterconnectCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListInterconnectsPagedResponse + extends AbstractPagedListResponse< + ListInterconnectsHttpRequest, InterconnectList, Interconnect, ListInterconnectsPage, + ListInterconnectsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListInterconnectsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListInterconnectsPagedResponse apply(ListInterconnectsPage input) { + return new ListInterconnectsPagedResponse(input); + } + }); + } + + private ListInterconnectsPagedResponse(ListInterconnectsPage page) { + super(page, ListInterconnectsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListInterconnectsPage + extends AbstractPage< + ListInterconnectsHttpRequest, InterconnectList, Interconnect, ListInterconnectsPage> { + + private ListInterconnectsPage( + PageContext context, + InterconnectList response) { + super(context, response); + } + + private static ListInterconnectsPage createEmptyPage() { + return new ListInterconnectsPage(null, null); + } + + @Override + protected ListInterconnectsPage createPage( + PageContext context, + InterconnectList response) { + return new ListInterconnectsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListInterconnectsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListInterconnectsHttpRequest, InterconnectList, Interconnect, ListInterconnectsPage, + ListInterconnectsFixedSizeCollection> { + + private ListInterconnectsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListInterconnectsFixedSizeCollection createEmptyCollection() { + return new ListInterconnectsFixedSizeCollection(null, 0); + } + + @Override + protected ListInterconnectsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListInterconnectsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectList.java new file mode 100644 index 000000000000..5c472c3a5863 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InterconnectList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InterconnectList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InterconnectList other) { + if (other == InterconnectList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InterconnectList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Interconnect items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InterconnectList build() { + + return new InterconnectList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectList) { + InterconnectList that = (InterconnectList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocation.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocation.java new file mode 100644 index 000000000000..3a5257017b1e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocation.java @@ -0,0 +1,574 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectLocation implements ApiMessage { + private final String address; + private final String availabilityZone; + private final String city; + private final String continent; + private final String creationTimestamp; + private final String description; + private final String facilityProvider; + private final String facilityProviderFacilityId; + private final String id; + private final String kind; + private final String name; + private final String peeringdbFacilityId; + private final List regionInfos; + private final String selfLink; + + private InterconnectLocation() { + this.address = null; + this.availabilityZone = null; + this.city = null; + this.continent = null; + this.creationTimestamp = null; + this.description = null; + this.facilityProvider = null; + this.facilityProviderFacilityId = null; + this.id = null; + this.kind = null; + this.name = null; + this.peeringdbFacilityId = null; + this.regionInfos = null; + this.selfLink = null; + } + + private InterconnectLocation( + String address, + String availabilityZone, + String city, + String continent, + String creationTimestamp, + String description, + String facilityProvider, + String facilityProviderFacilityId, + String id, + String kind, + String name, + String peeringdbFacilityId, + List regionInfos, + String selfLink) { + this.address = address; + this.availabilityZone = availabilityZone; + this.city = city; + this.continent = continent; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.facilityProvider = facilityProvider; + this.facilityProviderFacilityId = facilityProviderFacilityId; + this.id = id; + this.kind = kind; + this.name = name; + this.peeringdbFacilityId = peeringdbFacilityId; + this.regionInfos = regionInfos; + this.selfLink = selfLink; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("address")) { + return address; + } + if (fieldName.equals("availabilityZone")) { + return availabilityZone; + } + if (fieldName.equals("city")) { + return city; + } + if (fieldName.equals("continent")) { + return continent; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("facilityProvider")) { + return facilityProvider; + } + if (fieldName.equals("facilityProviderFacilityId")) { + return facilityProviderFacilityId; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("peeringdbFacilityId")) { + return peeringdbFacilityId; + } + if (fieldName.equals("regionInfos")) { + return regionInfos; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAddress() { + return address; + } + + public String getAvailabilityZone() { + return availabilityZone; + } + + public String getCity() { + return city; + } + + public String getContinent() { + return continent; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getFacilityProvider() { + return facilityProvider; + } + + public String getFacilityProviderFacilityId() { + return facilityProviderFacilityId; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getPeeringdbFacilityId() { + return peeringdbFacilityId; + } + + public List getRegionInfosList() { + return regionInfos; + } + + public String getSelfLink() { + return selfLink; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectLocation prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectLocation getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectLocation DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectLocation(); + } + + public static class Builder { + private String address; + private String availabilityZone; + private String city; + private String continent; + private String creationTimestamp; + private String description; + private String facilityProvider; + private String facilityProviderFacilityId; + private String id; + private String kind; + private String name; + private String peeringdbFacilityId; + private List regionInfos; + private String selfLink; + + Builder() {} + + public Builder mergeFrom(InterconnectLocation other) { + if (other == InterconnectLocation.getDefaultInstance()) return this; + if (other.getAddress() != null) { + this.address = other.address; + } + if (other.getAvailabilityZone() != null) { + this.availabilityZone = other.availabilityZone; + } + if (other.getCity() != null) { + this.city = other.city; + } + if (other.getContinent() != null) { + this.continent = other.continent; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getFacilityProvider() != null) { + this.facilityProvider = other.facilityProvider; + } + if (other.getFacilityProviderFacilityId() != null) { + this.facilityProviderFacilityId = other.facilityProviderFacilityId; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPeeringdbFacilityId() != null) { + this.peeringdbFacilityId = other.peeringdbFacilityId; + } + if (other.getRegionInfosList() != null) { + this.regionInfos = other.regionInfos; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + return this; + } + + Builder(InterconnectLocation source) { + this.address = source.address; + this.availabilityZone = source.availabilityZone; + this.city = source.city; + this.continent = source.continent; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.facilityProvider = source.facilityProvider; + this.facilityProviderFacilityId = source.facilityProviderFacilityId; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.peeringdbFacilityId = source.peeringdbFacilityId; + this.regionInfos = source.regionInfos; + this.selfLink = source.selfLink; + } + + public String getAddress() { + return address; + } + + public Builder setAddress(String address) { + this.address = address; + return this; + } + + public String getAvailabilityZone() { + return availabilityZone; + } + + public Builder setAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + public String getCity() { + return city; + } + + public Builder setCity(String city) { + this.city = city; + return this; + } + + public String getContinent() { + return continent; + } + + public Builder setContinent(String continent) { + this.continent = continent; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getFacilityProvider() { + return facilityProvider; + } + + public Builder setFacilityProvider(String facilityProvider) { + this.facilityProvider = facilityProvider; + return this; + } + + public String getFacilityProviderFacilityId() { + return facilityProviderFacilityId; + } + + public Builder setFacilityProviderFacilityId(String facilityProviderFacilityId) { + this.facilityProviderFacilityId = facilityProviderFacilityId; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getPeeringdbFacilityId() { + return peeringdbFacilityId; + } + + public Builder setPeeringdbFacilityId(String peeringdbFacilityId) { + this.peeringdbFacilityId = peeringdbFacilityId; + return this; + } + + public List getRegionInfosList() { + return regionInfos; + } + + public Builder addAllRegionInfos(List regionInfos) { + if (this.regionInfos == null) { + this.regionInfos = new ArrayList<>(regionInfos.size()); + } + this.regionInfos.addAll(regionInfos); + return this; + } + + public Builder addRegionInfos(InterconnectLocationRegionInfo regionInfos) { + this.regionInfos.add(regionInfos); + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public InterconnectLocation build() { + + return new InterconnectLocation( + address, + availabilityZone, + city, + continent, + creationTimestamp, + description, + facilityProvider, + facilityProviderFacilityId, + id, + kind, + name, + peeringdbFacilityId, + regionInfos, + selfLink); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAddress(this.address); + newBuilder.setAvailabilityZone(this.availabilityZone); + newBuilder.setCity(this.city); + newBuilder.setContinent(this.continent); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setFacilityProvider(this.facilityProvider); + newBuilder.setFacilityProviderFacilityId(this.facilityProviderFacilityId); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setPeeringdbFacilityId(this.peeringdbFacilityId); + newBuilder.addAllRegionInfos(this.regionInfos); + newBuilder.setSelfLink(this.selfLink); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectLocation{" + + "address=" + + address + + ", " + + "availabilityZone=" + + availabilityZone + + ", " + + "city=" + + city + + ", " + + "continent=" + + continent + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "facilityProvider=" + + facilityProvider + + ", " + + "facilityProviderFacilityId=" + + facilityProviderFacilityId + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "peeringdbFacilityId=" + + peeringdbFacilityId + + ", " + + "regionInfos=" + + regionInfos + + ", " + + "selfLink=" + + selfLink + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectLocation) { + InterconnectLocation that = (InterconnectLocation) o; + return Objects.equals(this.address, that.getAddress()) + && Objects.equals(this.availabilityZone, that.getAvailabilityZone()) + && Objects.equals(this.city, that.getCity()) + && Objects.equals(this.continent, that.getContinent()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.facilityProvider, that.getFacilityProvider()) + && Objects.equals(this.facilityProviderFacilityId, that.getFacilityProviderFacilityId()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.peeringdbFacilityId, that.getPeeringdbFacilityId()) + && Objects.equals(this.regionInfos, that.getRegionInfosList()) + && Objects.equals(this.selfLink, that.getSelfLink()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + address, + availabilityZone, + city, + continent, + creationTimestamp, + description, + facilityProvider, + facilityProviderFacilityId, + id, + kind, + name, + peeringdbFacilityId, + regionInfos, + selfLink); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationClient.java new file mode 100644 index 000000000000..b4407f6ed1a0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationClient.java @@ -0,0 +1,521 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.InterconnectLocationStub; +import com.google.cloud.compute.v1.stub.InterconnectLocationStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
+ *   ProjectGlobalInterconnectLocationName interconnectLocation = ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]");
+ *   InterconnectLocation response = interconnectLocationClient.getInterconnectLocation(interconnectLocation);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the interconnectLocationClient object to clean up + * resources such as threads. In the example above, try-with-resources is used, which automatically + * calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of InterconnectLocationSettings + * to create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * InterconnectLocationSettings interconnectLocationSettings =
+ *     InterconnectLocationSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * InterconnectLocationClient interconnectLocationClient =
+ *     InterconnectLocationClient.create(interconnectLocationSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * InterconnectLocationSettings interconnectLocationSettings =
+ *     InterconnectLocationSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * InterconnectLocationClient interconnectLocationClient =
+ *     InterconnectLocationClient.create(interconnectLocationSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InterconnectLocationClient implements BackgroundResource { + private final InterconnectLocationSettings settings; + private final InterconnectLocationStub stub; + + /** Constructs an instance of InterconnectLocationClient with default settings. */ + public static final InterconnectLocationClient create() throws IOException { + return create(InterconnectLocationSettings.newBuilder().build()); + } + + /** + * Constructs an instance of InterconnectLocationClient, using the given settings. The channels + * are created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final InterconnectLocationClient create(InterconnectLocationSettings settings) + throws IOException { + return new InterconnectLocationClient(settings); + } + + /** + * Constructs an instance of InterconnectLocationClient, using the given stub for making calls. + * This is for advanced usage - prefer to use InterconnectLocationSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final InterconnectLocationClient create(InterconnectLocationStub stub) { + return new InterconnectLocationClient(stub); + } + + /** + * Constructs an instance of InterconnectLocationClient, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected InterconnectLocationClient(InterconnectLocationSettings settings) throws IOException { + this.settings = settings; + this.stub = ((InterconnectLocationStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected InterconnectLocationClient(InterconnectLocationStub stub) { + this.settings = null; + this.stub = stub; + } + + public final InterconnectLocationSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InterconnectLocationStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the details for the specified interconnect location. Gets a list of available + * interconnect locations by making a list() request. + * + *

Sample code: + * + *


+   * try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
+   *   ProjectGlobalInterconnectLocationName interconnectLocation = ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]");
+   *   InterconnectLocation response = interconnectLocationClient.getInterconnectLocation(interconnectLocation);
+   * }
+   * 
+ * + * @param interconnectLocation Name of the interconnect location to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InterconnectLocation getInterconnectLocation( + ProjectGlobalInterconnectLocationName interconnectLocation) { + + GetInterconnectLocationHttpRequest request = + GetInterconnectLocationHttpRequest.newBuilder() + .setInterconnectLocation( + interconnectLocation == null ? null : interconnectLocation.toString()) + .build(); + return getInterconnectLocation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the details for the specified interconnect location. Gets a list of available + * interconnect locations by making a list() request. + * + *

Sample code: + * + *


+   * try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
+   *   ProjectGlobalInterconnectLocationName interconnectLocation = ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]");
+   *   InterconnectLocation response = interconnectLocationClient.getInterconnectLocation(interconnectLocation.toString());
+   * }
+   * 
+ * + * @param interconnectLocation Name of the interconnect location to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InterconnectLocation getInterconnectLocation(String interconnectLocation) { + + GetInterconnectLocationHttpRequest request = + GetInterconnectLocationHttpRequest.newBuilder() + .setInterconnectLocation(interconnectLocation) + .build(); + return getInterconnectLocation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the details for the specified interconnect location. Gets a list of available + * interconnect locations by making a list() request. + * + *

Sample code: + * + *


+   * try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
+   *   ProjectGlobalInterconnectLocationName interconnectLocation = ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]");
+   *   GetInterconnectLocationHttpRequest request = GetInterconnectLocationHttpRequest.newBuilder()
+   *     .setInterconnectLocation(interconnectLocation.toString())
+   *     .build();
+   *   InterconnectLocation response = interconnectLocationClient.getInterconnectLocation(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InterconnectLocation getInterconnectLocation( + GetInterconnectLocationHttpRequest request) { + return getInterconnectLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the details for the specified interconnect location. Gets a list of available + * interconnect locations by making a list() request. + * + *

Sample code: + * + *


+   * try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
+   *   ProjectGlobalInterconnectLocationName interconnectLocation = ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]");
+   *   GetInterconnectLocationHttpRequest request = GetInterconnectLocationHttpRequest.newBuilder()
+   *     .setInterconnectLocation(interconnectLocation.toString())
+   *     .build();
+   *   ApiFuture<InterconnectLocation> future = interconnectLocationClient.getInterconnectLocationCallable().futureCall(request);
+   *   // Do something
+   *   InterconnectLocation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getInterconnectLocationCallable() { + return stub.getInterconnectLocationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect locations available to the specified project. + * + *

Sample code: + * + *


+   * try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InterconnectLocation element : interconnectLocationClient.listInterconnectLocations(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInterconnectLocationsPagedResponse listInterconnectLocations( + ProjectName project) { + ListInterconnectLocationsHttpRequest request = + ListInterconnectLocationsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listInterconnectLocations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect locations available to the specified project. + * + *

Sample code: + * + *


+   * try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (InterconnectLocation element : interconnectLocationClient.listInterconnectLocations(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInterconnectLocationsPagedResponse listInterconnectLocations(String project) { + ListInterconnectLocationsHttpRequest request = + ListInterconnectLocationsHttpRequest.newBuilder().setProject(project).build(); + return listInterconnectLocations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect locations available to the specified project. + * + *

Sample code: + * + *


+   * try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListInterconnectLocationsHttpRequest request = ListInterconnectLocationsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (InterconnectLocation element : interconnectLocationClient.listInterconnectLocations(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInterconnectLocationsPagedResponse listInterconnectLocations( + ListInterconnectLocationsHttpRequest request) { + return listInterconnectLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect locations available to the specified project. + * + *

Sample code: + * + *


+   * try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListInterconnectLocationsHttpRequest request = ListInterconnectLocationsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListInterconnectLocationsPagedResponse> future = interconnectLocationClient.listInterconnectLocationsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InterconnectLocation element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListInterconnectLocationsHttpRequest, ListInterconnectLocationsPagedResponse> + listInterconnectLocationsPagedCallable() { + return stub.listInterconnectLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of interconnect locations available to the specified project. + * + *

Sample code: + * + *


+   * try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListInterconnectLocationsHttpRequest request = ListInterconnectLocationsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     InterconnectLocationList response = interconnectLocationClient.listInterconnectLocationsCallable().call(request);
+   *     for (InterconnectLocation element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listInterconnectLocationsCallable() { + return stub.listInterconnectLocationsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListInterconnectLocationsPagedResponse + extends AbstractPagedListResponse< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, InterconnectLocation, + ListInterconnectLocationsPage, ListInterconnectLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + InterconnectLocation> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListInterconnectLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListInterconnectLocationsPagedResponse apply( + ListInterconnectLocationsPage input) { + return new ListInterconnectLocationsPagedResponse(input); + } + }); + } + + private ListInterconnectLocationsPagedResponse(ListInterconnectLocationsPage page) { + super(page, ListInterconnectLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListInterconnectLocationsPage + extends AbstractPage< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, InterconnectLocation, + ListInterconnectLocationsPage> { + + private ListInterconnectLocationsPage( + PageContext< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + InterconnectLocation> + context, + InterconnectLocationList response) { + super(context, response); + } + + private static ListInterconnectLocationsPage createEmptyPage() { + return new ListInterconnectLocationsPage(null, null); + } + + @Override + protected ListInterconnectLocationsPage createPage( + PageContext< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + InterconnectLocation> + context, + InterconnectLocationList response) { + return new ListInterconnectLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + InterconnectLocation> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListInterconnectLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, InterconnectLocation, + ListInterconnectLocationsPage, ListInterconnectLocationsFixedSizeCollection> { + + private ListInterconnectLocationsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListInterconnectLocationsFixedSizeCollection createEmptyCollection() { + return new ListInterconnectLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListInterconnectLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListInterconnectLocationsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationList.java new file mode 100644 index 000000000000..bc9871314b16 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectLocationList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private InterconnectLocationList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private InterconnectLocationList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectLocationList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectLocationList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectLocationList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectLocationList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(InterconnectLocationList other) { + if (other == InterconnectLocationList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(InterconnectLocationList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(InterconnectLocation items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public InterconnectLocationList build() { + + return new InterconnectLocationList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectLocationList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectLocationList) { + InterconnectLocationList that = (InterconnectLocationList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationRegionInfo.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationRegionInfo.java new file mode 100644 index 000000000000..42a3f98eee06 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationRegionInfo.java @@ -0,0 +1,205 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectLocationRegionInfo implements ApiMessage { + private final String expectedRttMs; + private final String locationPresence; + private final String region; + + private InterconnectLocationRegionInfo() { + this.expectedRttMs = null; + this.locationPresence = null; + this.region = null; + } + + private InterconnectLocationRegionInfo( + String expectedRttMs, String locationPresence, String region) { + this.expectedRttMs = expectedRttMs; + this.locationPresence = locationPresence; + this.region = region; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("expectedRttMs")) { + return expectedRttMs; + } + if (fieldName.equals("locationPresence")) { + return locationPresence; + } + if (fieldName.equals("region")) { + return region; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getExpectedRttMs() { + return expectedRttMs; + } + + public String getLocationPresence() { + return locationPresence; + } + + public String getRegion() { + return region; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectLocationRegionInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectLocationRegionInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectLocationRegionInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectLocationRegionInfo(); + } + + public static class Builder { + private String expectedRttMs; + private String locationPresence; + private String region; + + Builder() {} + + public Builder mergeFrom(InterconnectLocationRegionInfo other) { + if (other == InterconnectLocationRegionInfo.getDefaultInstance()) return this; + if (other.getExpectedRttMs() != null) { + this.expectedRttMs = other.expectedRttMs; + } + if (other.getLocationPresence() != null) { + this.locationPresence = other.locationPresence; + } + if (other.getRegion() != null) { + this.region = other.region; + } + return this; + } + + Builder(InterconnectLocationRegionInfo source) { + this.expectedRttMs = source.expectedRttMs; + this.locationPresence = source.locationPresence; + this.region = source.region; + } + + public String getExpectedRttMs() { + return expectedRttMs; + } + + public Builder setExpectedRttMs(String expectedRttMs) { + this.expectedRttMs = expectedRttMs; + return this; + } + + public String getLocationPresence() { + return locationPresence; + } + + public Builder setLocationPresence(String locationPresence) { + this.locationPresence = locationPresence; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public InterconnectLocationRegionInfo build() { + + return new InterconnectLocationRegionInfo(expectedRttMs, locationPresence, region); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setExpectedRttMs(this.expectedRttMs); + newBuilder.setLocationPresence(this.locationPresence); + newBuilder.setRegion(this.region); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectLocationRegionInfo{" + + "expectedRttMs=" + + expectedRttMs + + ", " + + "locationPresence=" + + locationPresence + + ", " + + "region=" + + region + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectLocationRegionInfo) { + InterconnectLocationRegionInfo that = (InterconnectLocationRegionInfo) o; + return Objects.equals(this.expectedRttMs, that.getExpectedRttMs()) + && Objects.equals(this.locationPresence, that.getLocationPresence()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(expectedRttMs, locationPresence, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationSettings.java new file mode 100644 index 000000000000..788b2695a236 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectLocationSettings.java @@ -0,0 +1,203 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InterconnectLocationClient.ListInterconnectLocationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.InterconnectLocationStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InterconnectLocationClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getInterconnectLocation to 30 seconds: + * + *

+ * 
+ * InterconnectLocationSettings.Builder interconnectLocationSettingsBuilder =
+ *     InterconnectLocationSettings.newBuilder();
+ * interconnectLocationSettingsBuilder.getInterconnectLocationSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InterconnectLocationSettings interconnectLocationSettings = interconnectLocationSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InterconnectLocationSettings extends ClientSettings { + /** Returns the object with the settings used for calls to getInterconnectLocation. */ + public UnaryCallSettings + getInterconnectLocationSettings() { + return ((InterconnectLocationStubSettings) getStubSettings()).getInterconnectLocationSettings(); + } + + /** Returns the object with the settings used for calls to listInterconnectLocations. */ + public PagedCallSettings< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + ListInterconnectLocationsPagedResponse> + listInterconnectLocationsSettings() { + return ((InterconnectLocationStubSettings) getStubSettings()) + .listInterconnectLocationsSettings(); + } + + public static final InterconnectLocationSettings create(InterconnectLocationStubSettings stub) + throws IOException { + return new InterconnectLocationSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InterconnectLocationStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return InterconnectLocationStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return InterconnectLocationStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return InterconnectLocationStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return InterconnectLocationStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InterconnectLocationStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return InterconnectLocationStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return InterconnectLocationStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InterconnectLocationSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for InterconnectLocationSettings. */ + public static class Builder + extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(InterconnectLocationStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(InterconnectLocationStubSettings.newBuilder()); + } + + protected Builder(InterconnectLocationSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(InterconnectLocationStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public InterconnectLocationStubSettings.Builder getStubSettingsBuilder() { + return ((InterconnectLocationStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to getInterconnectLocation. */ + public UnaryCallSettings.Builder + getInterconnectLocationSettings() { + return getStubSettingsBuilder().getInterconnectLocationSettings(); + } + + /** Returns the builder for the settings used for calls to listInterconnectLocations. */ + public PagedCallSettings.Builder< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + ListInterconnectLocationsPagedResponse> + listInterconnectLocationsSettings() { + return getStubSettingsBuilder().listInterconnectLocationsSettings(); + } + + @Override + public InterconnectLocationSettings build() throws IOException { + return new InterconnectLocationSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectOutageNotification.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectOutageNotification.java new file mode 100644 index 000000000000..8be3ef264b6a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectOutageNotification.java @@ -0,0 +1,368 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectOutageNotification implements ApiMessage { + private final List affectedCircuits; + private final String description; + private final String endTime; + private final String issueType; + private final String name; + private final String source; + private final String startTime; + private final String state; + + private InterconnectOutageNotification() { + this.affectedCircuits = null; + this.description = null; + this.endTime = null; + this.issueType = null; + this.name = null; + this.source = null; + this.startTime = null; + this.state = null; + } + + private InterconnectOutageNotification( + List affectedCircuits, + String description, + String endTime, + String issueType, + String name, + String source, + String startTime, + String state) { + this.affectedCircuits = affectedCircuits; + this.description = description; + this.endTime = endTime; + this.issueType = issueType; + this.name = name; + this.source = source; + this.startTime = startTime; + this.state = state; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("affectedCircuits")) { + return affectedCircuits; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("endTime")) { + return endTime; + } + if (fieldName.equals("issueType")) { + return issueType; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("source")) { + return source; + } + if (fieldName.equals("startTime")) { + return startTime; + } + if (fieldName.equals("state")) { + return state; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getAffectedCircuitsList() { + return affectedCircuits; + } + + public String getDescription() { + return description; + } + + public String getEndTime() { + return endTime; + } + + public String getIssueType() { + return issueType; + } + + public String getName() { + return name; + } + + public String getSource() { + return source; + } + + public String getStartTime() { + return startTime; + } + + public String getState() { + return state; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectOutageNotification prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectOutageNotification getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectOutageNotification DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectOutageNotification(); + } + + public static class Builder { + private List affectedCircuits; + private String description; + private String endTime; + private String issueType; + private String name; + private String source; + private String startTime; + private String state; + + Builder() {} + + public Builder mergeFrom(InterconnectOutageNotification other) { + if (other == InterconnectOutageNotification.getDefaultInstance()) return this; + if (other.getAffectedCircuitsList() != null) { + this.affectedCircuits = other.affectedCircuits; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getEndTime() != null) { + this.endTime = other.endTime; + } + if (other.getIssueType() != null) { + this.issueType = other.issueType; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getSource() != null) { + this.source = other.source; + } + if (other.getStartTime() != null) { + this.startTime = other.startTime; + } + if (other.getState() != null) { + this.state = other.state; + } + return this; + } + + Builder(InterconnectOutageNotification source) { + this.affectedCircuits = source.affectedCircuits; + this.description = source.description; + this.endTime = source.endTime; + this.issueType = source.issueType; + this.name = source.name; + this.source = source.source; + this.startTime = source.startTime; + this.state = source.state; + } + + public List getAffectedCircuitsList() { + return affectedCircuits; + } + + public Builder addAllAffectedCircuits(List affectedCircuits) { + if (this.affectedCircuits == null) { + this.affectedCircuits = new ArrayList<>(affectedCircuits.size()); + } + this.affectedCircuits.addAll(affectedCircuits); + return this; + } + + public Builder addAffectedCircuits(String affectedCircuits) { + this.affectedCircuits.add(affectedCircuits); + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getEndTime() { + return endTime; + } + + public Builder setEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + public String getIssueType() { + return issueType; + } + + public Builder setIssueType(String issueType) { + this.issueType = issueType; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getSource() { + return source; + } + + public Builder setSource(String source) { + this.source = source; + return this; + } + + public String getStartTime() { + return startTime; + } + + public Builder setStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + public String getState() { + return state; + } + + public Builder setState(String state) { + this.state = state; + return this; + } + + public InterconnectOutageNotification build() { + + return new InterconnectOutageNotification( + affectedCircuits, description, endTime, issueType, name, source, startTime, state); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllAffectedCircuits(this.affectedCircuits); + newBuilder.setDescription(this.description); + newBuilder.setEndTime(this.endTime); + newBuilder.setIssueType(this.issueType); + newBuilder.setName(this.name); + newBuilder.setSource(this.source); + newBuilder.setStartTime(this.startTime); + newBuilder.setState(this.state); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectOutageNotification{" + + "affectedCircuits=" + + affectedCircuits + + ", " + + "description=" + + description + + ", " + + "endTime=" + + endTime + + ", " + + "issueType=" + + issueType + + ", " + + "name=" + + name + + ", " + + "source=" + + source + + ", " + + "startTime=" + + startTime + + ", " + + "state=" + + state + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectOutageNotification) { + InterconnectOutageNotification that = (InterconnectOutageNotification) o; + return Objects.equals(this.affectedCircuits, that.getAffectedCircuitsList()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.endTime, that.getEndTime()) + && Objects.equals(this.issueType, that.getIssueType()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.source, that.getSource()) + && Objects.equals(this.startTime, that.getStartTime()) + && Objects.equals(this.state, that.getState()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + affectedCircuits, description, endTime, issueType, name, source, startTime, state); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectSettings.java new file mode 100644 index 000000000000..b7c6e6ed7291 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectSettings.java @@ -0,0 +1,231 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InterconnectClient.ListInterconnectsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.InterconnectStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InterconnectClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteInterconnect to 30 seconds: + * + *

+ * 
+ * InterconnectSettings.Builder interconnectSettingsBuilder =
+ *     InterconnectSettings.newBuilder();
+ * interconnectSettingsBuilder.deleteInterconnectSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InterconnectSettings interconnectSettings = interconnectSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InterconnectSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteInterconnect. */ + public UnaryCallSettings deleteInterconnectSettings() { + return ((InterconnectStubSettings) getStubSettings()).deleteInterconnectSettings(); + } + + /** Returns the object with the settings used for calls to getInterconnect. */ + public UnaryCallSettings getInterconnectSettings() { + return ((InterconnectStubSettings) getStubSettings()).getInterconnectSettings(); + } + + /** Returns the object with the settings used for calls to insertInterconnect. */ + public UnaryCallSettings insertInterconnectSettings() { + return ((InterconnectStubSettings) getStubSettings()).insertInterconnectSettings(); + } + + /** Returns the object with the settings used for calls to listInterconnects. */ + public PagedCallSettings< + ListInterconnectsHttpRequest, InterconnectList, ListInterconnectsPagedResponse> + listInterconnectsSettings() { + return ((InterconnectStubSettings) getStubSettings()).listInterconnectsSettings(); + } + + /** Returns the object with the settings used for calls to patchInterconnect. */ + public UnaryCallSettings patchInterconnectSettings() { + return ((InterconnectStubSettings) getStubSettings()).patchInterconnectSettings(); + } + + public static final InterconnectSettings create(InterconnectStubSettings stub) + throws IOException { + return new InterconnectSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InterconnectStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return InterconnectStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return InterconnectStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return InterconnectStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return InterconnectStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InterconnectStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return InterconnectStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return InterconnectStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InterconnectSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for InterconnectSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(InterconnectStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(InterconnectStubSettings.newBuilder()); + } + + protected Builder(InterconnectSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(InterconnectStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public InterconnectStubSettings.Builder getStubSettingsBuilder() { + return ((InterconnectStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteInterconnect. */ + public UnaryCallSettings.Builder + deleteInterconnectSettings() { + return getStubSettingsBuilder().deleteInterconnectSettings(); + } + + /** Returns the builder for the settings used for calls to getInterconnect. */ + public UnaryCallSettings.Builder + getInterconnectSettings() { + return getStubSettingsBuilder().getInterconnectSettings(); + } + + /** Returns the builder for the settings used for calls to insertInterconnect. */ + public UnaryCallSettings.Builder + insertInterconnectSettings() { + return getStubSettingsBuilder().insertInterconnectSettings(); + } + + /** Returns the builder for the settings used for calls to listInterconnects. */ + public PagedCallSettings.Builder< + ListInterconnectsHttpRequest, InterconnectList, ListInterconnectsPagedResponse> + listInterconnectsSettings() { + return getStubSettingsBuilder().listInterconnectsSettings(); + } + + /** Returns the builder for the settings used for calls to patchInterconnect. */ + public UnaryCallSettings.Builder + patchInterconnectSettings() { + return getStubSettingsBuilder().patchInterconnectSettings(); + } + + @Override + public InterconnectSettings build() throws IOException { + return new InterconnectSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InvalidateCacheUrlMapHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InvalidateCacheUrlMapHttpRequest.java new file mode 100644 index 000000000000..28e219f33b54 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InvalidateCacheUrlMapHttpRequest.java @@ -0,0 +1,447 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InvalidateCacheUrlMapHttpRequest implements ApiMessage { + private final String access_token; + private final CacheInvalidationRule cacheInvalidationRuleResource; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String urlMap; + private final String userIp; + + private InvalidateCacheUrlMapHttpRequest() { + this.access_token = null; + this.cacheInvalidationRuleResource = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.urlMap = null; + this.userIp = null; + } + + private InvalidateCacheUrlMapHttpRequest( + String access_token, + CacheInvalidationRule cacheInvalidationRuleResource, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String urlMap, + String userIp) { + this.access_token = access_token; + this.cacheInvalidationRuleResource = cacheInvalidationRuleResource; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.urlMap = urlMap; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("cacheInvalidationRuleResource")) { + return cacheInvalidationRuleResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("urlMap")) { + return urlMap; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public CacheInvalidationRule getApiMessageRequestBody() { + return cacheInvalidationRuleResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public CacheInvalidationRule getCacheInvalidationRuleResource() { + return cacheInvalidationRuleResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUrlMap() { + return urlMap; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InvalidateCacheUrlMapHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InvalidateCacheUrlMapHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InvalidateCacheUrlMapHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InvalidateCacheUrlMapHttpRequest(); + } + + public static class Builder { + private String access_token; + private CacheInvalidationRule cacheInvalidationRuleResource; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String urlMap; + private String userIp; + + Builder() {} + + public Builder mergeFrom(InvalidateCacheUrlMapHttpRequest other) { + if (other == InvalidateCacheUrlMapHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCacheInvalidationRuleResource() != null) { + this.cacheInvalidationRuleResource = other.cacheInvalidationRuleResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUrlMap() != null) { + this.urlMap = other.urlMap; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(InvalidateCacheUrlMapHttpRequest source) { + this.access_token = source.access_token; + this.cacheInvalidationRuleResource = source.cacheInvalidationRuleResource; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.urlMap = source.urlMap; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public CacheInvalidationRule getCacheInvalidationRuleResource() { + return cacheInvalidationRuleResource; + } + + public Builder setCacheInvalidationRuleResource( + CacheInvalidationRule cacheInvalidationRuleResource) { + this.cacheInvalidationRuleResource = cacheInvalidationRuleResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUrlMap() { + return urlMap; + } + + public Builder setUrlMap(String urlMap) { + this.urlMap = urlMap; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public InvalidateCacheUrlMapHttpRequest build() { + String missing = ""; + + if (urlMap == null) { + missing += " urlMap"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new InvalidateCacheUrlMapHttpRequest( + access_token, + cacheInvalidationRuleResource, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + urlMap, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCacheInvalidationRuleResource(this.cacheInvalidationRuleResource); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUrlMap(this.urlMap); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "InvalidateCacheUrlMapHttpRequest{" + + "access_token=" + + access_token + + ", " + + "cacheInvalidationRuleResource=" + + cacheInvalidationRuleResource + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "urlMap=" + + urlMap + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InvalidateCacheUrlMapHttpRequest) { + InvalidateCacheUrlMapHttpRequest that = (InvalidateCacheUrlMapHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals( + this.cacheInvalidationRuleResource, that.getCacheInvalidationRuleResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.urlMap, that.getUrlMap()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + cacheInvalidationRuleResource, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + urlMap, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Items.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Items.java new file mode 100644 index 000000000000..17ebac93eda3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Items.java @@ -0,0 +1,168 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Items implements ApiMessage { + private final String key; + private final String value; + + private Items() { + this.key = null; + this.value = null; + } + + private Items(String key, String value) { + this.key = key; + this.value = value; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("value")) { + return value; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getKey() { + return key; + } + + public String getValue() { + return value; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Items prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Items getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Items DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Items(); + } + + public static class Builder { + private String key; + private String value; + + Builder() {} + + public Builder mergeFrom(Items other) { + if (other == Items.getDefaultInstance()) return this; + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getValue() != null) { + this.value = other.value; + } + return this; + } + + Builder(Items source) { + this.key = source.key; + this.value = source.value; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getValue() { + return value; + } + + public Builder setValue(String value) { + this.value = value; + return this; + } + + public Items build() { + + return new Items(key, value); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setKey(this.key); + newBuilder.setValue(this.value); + return newBuilder; + } + } + + @Override + public String toString() { + return "Items{" + "key=" + key + ", " + "value=" + value + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Items) { + Items that = (Items) o; + return Objects.equals(this.key, that.getKey()) && Objects.equals(this.value, that.getValue()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(key, value); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/License.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/License.java new file mode 100644 index 000000000000..e25f2f6337ee --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/License.java @@ -0,0 +1,437 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class License implements ApiMessage { + private final Boolean chargesUseFee; + private final String creationTimestamp; + private final String description; + private final String id; + private final String kind; + private final String licenseCode; + private final String name; + private final LicenseResourceRequirements resourceRequirements; + private final String selfLink; + private final Boolean transferable; + + private License() { + this.chargesUseFee = null; + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.kind = null; + this.licenseCode = null; + this.name = null; + this.resourceRequirements = null; + this.selfLink = null; + this.transferable = null; + } + + private License( + Boolean chargesUseFee, + String creationTimestamp, + String description, + String id, + String kind, + String licenseCode, + String name, + LicenseResourceRequirements resourceRequirements, + String selfLink, + Boolean transferable) { + this.chargesUseFee = chargesUseFee; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.kind = kind; + this.licenseCode = licenseCode; + this.name = name; + this.resourceRequirements = resourceRequirements; + this.selfLink = selfLink; + this.transferable = transferable; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("chargesUseFee")) { + return chargesUseFee; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("licenseCode")) { + return licenseCode; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("resourceRequirements")) { + return resourceRequirements; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("transferable")) { + return transferable; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getChargesUseFee() { + return chargesUseFee; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getLicenseCode() { + return licenseCode; + } + + public String getName() { + return name; + } + + public LicenseResourceRequirements getResourceRequirements() { + return resourceRequirements; + } + + public String getSelfLink() { + return selfLink; + } + + public Boolean getTransferable() { + return transferable; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(License prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static License getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final License DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new License(); + } + + public static class Builder { + private Boolean chargesUseFee; + private String creationTimestamp; + private String description; + private String id; + private String kind; + private String licenseCode; + private String name; + private LicenseResourceRequirements resourceRequirements; + private String selfLink; + private Boolean transferable; + + Builder() {} + + public Builder mergeFrom(License other) { + if (other == License.getDefaultInstance()) return this; + if (other.getChargesUseFee() != null) { + this.chargesUseFee = other.chargesUseFee; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getLicenseCode() != null) { + this.licenseCode = other.licenseCode; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getResourceRequirements() != null) { + this.resourceRequirements = other.resourceRequirements; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getTransferable() != null) { + this.transferable = other.transferable; + } + return this; + } + + Builder(License source) { + this.chargesUseFee = source.chargesUseFee; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.licenseCode = source.licenseCode; + this.name = source.name; + this.resourceRequirements = source.resourceRequirements; + this.selfLink = source.selfLink; + this.transferable = source.transferable; + } + + public Boolean getChargesUseFee() { + return chargesUseFee; + } + + public Builder setChargesUseFee(Boolean chargesUseFee) { + this.chargesUseFee = chargesUseFee; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getLicenseCode() { + return licenseCode; + } + + public Builder setLicenseCode(String licenseCode) { + this.licenseCode = licenseCode; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public LicenseResourceRequirements getResourceRequirements() { + return resourceRequirements; + } + + public Builder setResourceRequirements(LicenseResourceRequirements resourceRequirements) { + this.resourceRequirements = resourceRequirements; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Boolean getTransferable() { + return transferable; + } + + public Builder setTransferable(Boolean transferable) { + this.transferable = transferable; + return this; + } + + public License build() { + + return new License( + chargesUseFee, + creationTimestamp, + description, + id, + kind, + licenseCode, + name, + resourceRequirements, + selfLink, + transferable); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setChargesUseFee(this.chargesUseFee); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setLicenseCode(this.licenseCode); + newBuilder.setName(this.name); + newBuilder.setResourceRequirements(this.resourceRequirements); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setTransferable(this.transferable); + return newBuilder; + } + } + + @Override + public String toString() { + return "License{" + + "chargesUseFee=" + + chargesUseFee + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "licenseCode=" + + licenseCode + + ", " + + "name=" + + name + + ", " + + "resourceRequirements=" + + resourceRequirements + + ", " + + "selfLink=" + + selfLink + + ", " + + "transferable=" + + transferable + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof License) { + License that = (License) o; + return Objects.equals(this.chargesUseFee, that.getChargesUseFee()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.licenseCode, that.getLicenseCode()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.resourceRequirements, that.getResourceRequirements()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.transferable, that.getTransferable()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + chargesUseFee, + creationTimestamp, + description, + id, + kind, + licenseCode, + name, + resourceRequirements, + selfLink, + transferable); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseClient.java new file mode 100644 index 000000000000..b23b8319adb5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseClient.java @@ -0,0 +1,828 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.LicenseStub; +import com.google.cloud.compute.v1.stub.LicenseStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (LicenseClient licenseClient = LicenseClient.create()) {
+ *   ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]");
+ *   Operation response = licenseClient.deleteLicense(license);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the licenseClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of LicenseSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * LicenseSettings licenseSettings =
+ *     LicenseSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * LicenseClient licenseClient =
+ *     LicenseClient.create(licenseSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * LicenseSettings licenseSettings =
+ *     LicenseSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * LicenseClient licenseClient =
+ *     LicenseClient.create(licenseSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class LicenseClient implements BackgroundResource { + private final LicenseSettings settings; + private final LicenseStub stub; + + /** Constructs an instance of LicenseClient with default settings. */ + public static final LicenseClient create() throws IOException { + return create(LicenseSettings.newBuilder().build()); + } + + /** + * Constructs an instance of LicenseClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final LicenseClient create(LicenseSettings settings) throws IOException { + return new LicenseClient(settings); + } + + /** + * Constructs an instance of LicenseClient, using the given stub for making calls. This is for + * advanced usage - prefer to use LicenseSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final LicenseClient create(LicenseStub stub) { + return new LicenseClient(stub); + } + + /** + * Constructs an instance of LicenseClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected LicenseClient(LicenseSettings settings) throws IOException { + this.settings = settings; + this.stub = ((LicenseStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected LicenseClient(LicenseStub stub) { + this.settings = null; + this.stub = stub; + } + + public final LicenseSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public LicenseStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified license. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]");
+   *   Operation response = licenseClient.deleteLicense(license);
+   * }
+   * 
+ * + * @param license Name of the license resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteLicense(ProjectGlobalLicenseName license) { + + DeleteLicenseHttpRequest request = + DeleteLicenseHttpRequest.newBuilder() + .setLicense(license == null ? null : license.toString()) + .build(); + return deleteLicense(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified license. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]");
+   *   Operation response = licenseClient.deleteLicense(license.toString());
+   * }
+   * 
+ * + * @param license Name of the license resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteLicense(String license) { + + DeleteLicenseHttpRequest request = + DeleteLicenseHttpRequest.newBuilder().setLicense(license).build(); + return deleteLicense(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified license. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]");
+   *   DeleteLicenseHttpRequest request = DeleteLicenseHttpRequest.newBuilder()
+   *     .setLicense(license.toString())
+   *     .build();
+   *   Operation response = licenseClient.deleteLicense(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteLicense(DeleteLicenseHttpRequest request) { + return deleteLicenseCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified license. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]");
+   *   DeleteLicenseHttpRequest request = DeleteLicenseHttpRequest.newBuilder()
+   *     .setLicense(license.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = licenseClient.deleteLicenseCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteLicenseCallable() { + return stub.deleteLicenseCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified License resource. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]");
+   *   License response = licenseClient.getLicense(license);
+   * }
+   * 
+ * + * @param license Name of the License resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final License getLicense(ProjectGlobalLicenseName license) { + + GetLicenseHttpRequest request = + GetLicenseHttpRequest.newBuilder() + .setLicense(license == null ? null : license.toString()) + .build(); + return getLicense(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified License resource. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]");
+   *   License response = licenseClient.getLicense(license.toString());
+   * }
+   * 
+ * + * @param license Name of the License resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final License getLicense(String license) { + + GetLicenseHttpRequest request = GetLicenseHttpRequest.newBuilder().setLicense(license).build(); + return getLicense(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified License resource. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]");
+   *   GetLicenseHttpRequest request = GetLicenseHttpRequest.newBuilder()
+   *     .setLicense(license.toString())
+   *     .build();
+   *   License response = licenseClient.getLicense(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final License getLicense(GetLicenseHttpRequest request) { + return getLicenseCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified License resource. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]");
+   *   GetLicenseHttpRequest request = GetLicenseHttpRequest.newBuilder()
+   *     .setLicense(license.toString())
+   *     .build();
+   *   ApiFuture<License> future = licenseClient.getLicenseCallable().futureCall(request);
+   *   // Do something
+   *   License response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getLicenseCallable() { + return stub.getLicenseCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a License resource in the specified project. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   License licenseResource = License.newBuilder().build();
+   *   Operation response = licenseClient.insertLicense(project, licenseResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param licenseResource A license resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertLicense(ProjectName project, License licenseResource) { + + InsertLicenseHttpRequest request = + InsertLicenseHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setLicenseResource(licenseResource) + .build(); + return insertLicense(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a License resource in the specified project. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   License licenseResource = License.newBuilder().build();
+   *   Operation response = licenseClient.insertLicense(project.toString(), licenseResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param licenseResource A license resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertLicense(String project, License licenseResource) { + + InsertLicenseHttpRequest request = + InsertLicenseHttpRequest.newBuilder() + .setProject(project) + .setLicenseResource(licenseResource) + .build(); + return insertLicense(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a License resource in the specified project. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   License licenseResource = License.newBuilder().build();
+   *   InsertLicenseHttpRequest request = InsertLicenseHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setLicenseResource(licenseResource)
+   *     .build();
+   *   Operation response = licenseClient.insertLicense(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertLicense(InsertLicenseHttpRequest request) { + return insertLicenseCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a License resource in the specified project. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   License licenseResource = License.newBuilder().build();
+   *   InsertLicenseHttpRequest request = InsertLicenseHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setLicenseResource(licenseResource)
+   *     .build();
+   *   ApiFuture<Operation> future = licenseClient.insertLicenseCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertLicenseCallable() { + return stub.insertLicenseCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of licenses available in the specified project. This method does not get any + * licenses that belong to other projects, including licenses attached to publicly-available + * images, like Debian 9. If you want to get a list of publicly-available licenses, use this + * method to make a request to the respective image project, such as debian-cloud or + * windows-cloud. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (License element : licenseClient.listLicenses(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListLicensesPagedResponse listLicenses(ProjectName project) { + ListLicensesHttpRequest request = + ListLicensesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listLicenses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of licenses available in the specified project. This method does not get any + * licenses that belong to other projects, including licenses attached to publicly-available + * images, like Debian 9. If you want to get a list of publicly-available licenses, use this + * method to make a request to the respective image project, such as debian-cloud or + * windows-cloud. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (License element : licenseClient.listLicenses(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListLicensesPagedResponse listLicenses(String project) { + ListLicensesHttpRequest request = + ListLicensesHttpRequest.newBuilder().setProject(project).build(); + return listLicenses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of licenses available in the specified project. This method does not get any + * licenses that belong to other projects, including licenses attached to publicly-available + * images, like Debian 9. If you want to get a list of publicly-available licenses, use this + * method to make a request to the respective image project, such as debian-cloud or + * windows-cloud. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListLicensesHttpRequest request = ListLicensesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (License element : licenseClient.listLicenses(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListLicensesPagedResponse listLicenses(ListLicensesHttpRequest request) { + return listLicensesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of licenses available in the specified project. This method does not get any + * licenses that belong to other projects, including licenses attached to publicly-available + * images, like Debian 9. If you want to get a list of publicly-available licenses, use this + * method to make a request to the respective image project, such as debian-cloud or + * windows-cloud. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListLicensesHttpRequest request = ListLicensesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListLicensesPagedResponse> future = licenseClient.listLicensesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (License element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listLicensesPagedCallable() { + return stub.listLicensesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of licenses available in the specified project. This method does not get any + * licenses that belong to other projects, including licenses attached to publicly-available + * images, like Debian 9. If you want to get a list of publicly-available licenses, use this + * method to make a request to the respective image project, such as debian-cloud or + * windows-cloud. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListLicensesHttpRequest request = ListLicensesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     LicensesListResponse response = licenseClient.listLicensesCallable().call(request);
+   *     for (License element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listLicensesCallable() { + return stub.listLicensesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseResourceName resource = ProjectGlobalLicenseResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestPermissionsResponse response = licenseClient.testIamPermissionsLicense(resource, testPermissionsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param testPermissionsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TestPermissionsResponse testIamPermissionsLicense( + ProjectGlobalLicenseResourceName resource, + TestPermissionsRequest testPermissionsRequestResource) { + + TestIamPermissionsLicenseHttpRequest request = + TestIamPermissionsLicenseHttpRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setTestPermissionsRequestResource(testPermissionsRequestResource) + .build(); + return testIamPermissionsLicense(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseResourceName resource = ProjectGlobalLicenseResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestPermissionsResponse response = licenseClient.testIamPermissionsLicense(resource.toString(), testPermissionsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param testPermissionsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TestPermissionsResponse testIamPermissionsLicense( + String resource, TestPermissionsRequest testPermissionsRequestResource) { + + TestIamPermissionsLicenseHttpRequest request = + TestIamPermissionsLicenseHttpRequest.newBuilder() + .setResource(resource) + .setTestPermissionsRequestResource(testPermissionsRequestResource) + .build(); + return testIamPermissionsLicense(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseResourceName resource = ProjectGlobalLicenseResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestIamPermissionsLicenseHttpRequest request = TestIamPermissionsLicenseHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setTestPermissionsRequestResource(testPermissionsRequestResource)
+   *     .build();
+   *   TestPermissionsResponse response = licenseClient.testIamPermissionsLicense(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TestPermissionsResponse testIamPermissionsLicense( + TestIamPermissionsLicenseHttpRequest request) { + return testIamPermissionsLicenseCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (LicenseClient licenseClient = LicenseClient.create()) {
+   *   ProjectGlobalLicenseResourceName resource = ProjectGlobalLicenseResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestIamPermissionsLicenseHttpRequest request = TestIamPermissionsLicenseHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setTestPermissionsRequestResource(testPermissionsRequestResource)
+   *     .build();
+   *   ApiFuture<TestPermissionsResponse> future = licenseClient.testIamPermissionsLicenseCallable().futureCall(request);
+   *   // Do something
+   *   TestPermissionsResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + testIamPermissionsLicenseCallable() { + return stub.testIamPermissionsLicenseCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListLicensesPagedResponse + extends AbstractPagedListResponse< + ListLicensesHttpRequest, LicensesListResponse, License, ListLicensesPage, + ListLicensesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLicensesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListLicensesPagedResponse apply(ListLicensesPage input) { + return new ListLicensesPagedResponse(input); + } + }); + } + + private ListLicensesPagedResponse(ListLicensesPage page) { + super(page, ListLicensesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLicensesPage + extends AbstractPage< + ListLicensesHttpRequest, LicensesListResponse, License, ListLicensesPage> { + + private ListLicensesPage( + PageContext context, + LicensesListResponse response) { + super(context, response); + } + + private static ListLicensesPage createEmptyPage() { + return new ListLicensesPage(null, null); + } + + @Override + protected ListLicensesPage createPage( + PageContext context, + LicensesListResponse response) { + return new ListLicensesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLicensesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLicensesHttpRequest, LicensesListResponse, License, ListLicensesPage, + ListLicensesFixedSizeCollection> { + + private ListLicensesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLicensesFixedSizeCollection createEmptyCollection() { + return new ListLicensesFixedSizeCollection(null, 0); + } + + @Override + protected ListLicensesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLicensesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCode.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCode.java new file mode 100644 index 000000000000..6829da3cd60a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCode.java @@ -0,0 +1,414 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class LicenseCode implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String id; + private final String kind; + private final List licenseAlias; + private final String name; + private final String selfLink; + private final String state; + private final Boolean transferable; + + private LicenseCode() { + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.kind = null; + this.licenseAlias = null; + this.name = null; + this.selfLink = null; + this.state = null; + this.transferable = null; + } + + private LicenseCode( + String creationTimestamp, + String description, + String id, + String kind, + List licenseAlias, + String name, + String selfLink, + String state, + Boolean transferable) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.kind = kind; + this.licenseAlias = licenseAlias; + this.name = name; + this.selfLink = selfLink; + this.state = state; + this.transferable = transferable; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("licenseAlias")) { + return licenseAlias; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("state")) { + return state; + } + if (fieldName.equals("transferable")) { + return transferable; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public List getLicenseAliasList() { + return licenseAlias; + } + + public String getName() { + return name; + } + + public String getSelfLink() { + return selfLink; + } + + public String getState() { + return state; + } + + public Boolean getTransferable() { + return transferable; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(LicenseCode prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static LicenseCode getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final LicenseCode DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new LicenseCode(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String id; + private String kind; + private List licenseAlias; + private String name; + private String selfLink; + private String state; + private Boolean transferable; + + Builder() {} + + public Builder mergeFrom(LicenseCode other) { + if (other == LicenseCode.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getLicenseAliasList() != null) { + this.licenseAlias = other.licenseAlias; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getState() != null) { + this.state = other.state; + } + if (other.getTransferable() != null) { + this.transferable = other.transferable; + } + return this; + } + + Builder(LicenseCode source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.licenseAlias = source.licenseAlias; + this.name = source.name; + this.selfLink = source.selfLink; + this.state = source.state; + this.transferable = source.transferable; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public List getLicenseAliasList() { + return licenseAlias; + } + + public Builder addAllLicenseAlias(List licenseAlias) { + if (this.licenseAlias == null) { + this.licenseAlias = new ArrayList<>(licenseAlias.size()); + } + this.licenseAlias.addAll(licenseAlias); + return this; + } + + public Builder addLicenseAlias(LicenseCodeLicenseAlias licenseAlias) { + this.licenseAlias.add(licenseAlias); + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getState() { + return state; + } + + public Builder setState(String state) { + this.state = state; + return this; + } + + public Boolean getTransferable() { + return transferable; + } + + public Builder setTransferable(Boolean transferable) { + this.transferable = transferable; + return this; + } + + public LicenseCode build() { + + return new LicenseCode( + creationTimestamp, + description, + id, + kind, + licenseAlias, + name, + selfLink, + state, + transferable); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.addAllLicenseAlias(this.licenseAlias); + newBuilder.setName(this.name); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setState(this.state); + newBuilder.setTransferable(this.transferable); + return newBuilder; + } + } + + @Override + public String toString() { + return "LicenseCode{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "licenseAlias=" + + licenseAlias + + ", " + + "name=" + + name + + ", " + + "selfLink=" + + selfLink + + ", " + + "state=" + + state + + ", " + + "transferable=" + + transferable + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof LicenseCode) { + LicenseCode that = (LicenseCode) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.licenseAlias, that.getLicenseAliasList()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.state, that.getState()) + && Objects.equals(this.transferable, that.getTransferable()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + description, + id, + kind, + licenseAlias, + name, + selfLink, + state, + transferable); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCodeClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCodeClient.java new file mode 100644 index 000000000000..902a70b047ce --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCodeClient.java @@ -0,0 +1,390 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.LicenseCodeStub; +import com.google.cloud.compute.v1.stub.LicenseCodeStubSettings; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (LicenseCodeClient licenseCodeClient = LicenseCodeClient.create()) {
+ *   ProjectGlobalLicenseCodeName licenseCode = ProjectGlobalLicenseCodeName.of("[PROJECT]", "[LICENSE_CODE]");
+ *   LicenseCode response = licenseCodeClient.getLicenseCode(licenseCode);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the licenseCodeClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of LicenseCodeSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * LicenseCodeSettings licenseCodeSettings =
+ *     LicenseCodeSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * LicenseCodeClient licenseCodeClient =
+ *     LicenseCodeClient.create(licenseCodeSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * LicenseCodeSettings licenseCodeSettings =
+ *     LicenseCodeSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * LicenseCodeClient licenseCodeClient =
+ *     LicenseCodeClient.create(licenseCodeSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class LicenseCodeClient implements BackgroundResource { + private final LicenseCodeSettings settings; + private final LicenseCodeStub stub; + + /** Constructs an instance of LicenseCodeClient with default settings. */ + public static final LicenseCodeClient create() throws IOException { + return create(LicenseCodeSettings.newBuilder().build()); + } + + /** + * Constructs an instance of LicenseCodeClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final LicenseCodeClient create(LicenseCodeSettings settings) throws IOException { + return new LicenseCodeClient(settings); + } + + /** + * Constructs an instance of LicenseCodeClient, using the given stub for making calls. This is for + * advanced usage - prefer to use LicenseCodeSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final LicenseCodeClient create(LicenseCodeStub stub) { + return new LicenseCodeClient(stub); + } + + /** + * Constructs an instance of LicenseCodeClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected LicenseCodeClient(LicenseCodeSettings settings) throws IOException { + this.settings = settings; + this.stub = ((LicenseCodeStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected LicenseCodeClient(LicenseCodeStub stub) { + this.settings = null; + this.stub = stub; + } + + public final LicenseCodeSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public LicenseCodeStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Return a specified license code. License codes are mirrored across all projects that have + * permissions to read the License Code. + * + *

Sample code: + * + *


+   * try (LicenseCodeClient licenseCodeClient = LicenseCodeClient.create()) {
+   *   ProjectGlobalLicenseCodeName licenseCode = ProjectGlobalLicenseCodeName.of("[PROJECT]", "[LICENSE_CODE]");
+   *   LicenseCode response = licenseCodeClient.getLicenseCode(licenseCode);
+   * }
+   * 
+ * + * @param licenseCode Number corresponding to the License code resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final LicenseCode getLicenseCode(ProjectGlobalLicenseCodeName licenseCode) { + + GetLicenseCodeHttpRequest request = + GetLicenseCodeHttpRequest.newBuilder() + .setLicenseCode(licenseCode == null ? null : licenseCode.toString()) + .build(); + return getLicenseCode(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Return a specified license code. License codes are mirrored across all projects that have + * permissions to read the License Code. + * + *

Sample code: + * + *


+   * try (LicenseCodeClient licenseCodeClient = LicenseCodeClient.create()) {
+   *   ProjectGlobalLicenseCodeName licenseCode = ProjectGlobalLicenseCodeName.of("[PROJECT]", "[LICENSE_CODE]");
+   *   LicenseCode response = licenseCodeClient.getLicenseCode(licenseCode.toString());
+   * }
+   * 
+ * + * @param licenseCode Number corresponding to the License code resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final LicenseCode getLicenseCode(String licenseCode) { + + GetLicenseCodeHttpRequest request = + GetLicenseCodeHttpRequest.newBuilder().setLicenseCode(licenseCode).build(); + return getLicenseCode(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Return a specified license code. License codes are mirrored across all projects that have + * permissions to read the License Code. + * + *

Sample code: + * + *


+   * try (LicenseCodeClient licenseCodeClient = LicenseCodeClient.create()) {
+   *   ProjectGlobalLicenseCodeName licenseCode = ProjectGlobalLicenseCodeName.of("[PROJECT]", "[LICENSE_CODE]");
+   *   GetLicenseCodeHttpRequest request = GetLicenseCodeHttpRequest.newBuilder()
+   *     .setLicenseCode(licenseCode.toString())
+   *     .build();
+   *   LicenseCode response = licenseCodeClient.getLicenseCode(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final LicenseCode getLicenseCode(GetLicenseCodeHttpRequest request) { + return getLicenseCodeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Return a specified license code. License codes are mirrored across all projects that have + * permissions to read the License Code. + * + *

Sample code: + * + *


+   * try (LicenseCodeClient licenseCodeClient = LicenseCodeClient.create()) {
+   *   ProjectGlobalLicenseCodeName licenseCode = ProjectGlobalLicenseCodeName.of("[PROJECT]", "[LICENSE_CODE]");
+   *   GetLicenseCodeHttpRequest request = GetLicenseCodeHttpRequest.newBuilder()
+   *     .setLicenseCode(licenseCode.toString())
+   *     .build();
+   *   ApiFuture<LicenseCode> future = licenseCodeClient.getLicenseCodeCallable().futureCall(request);
+   *   // Do something
+   *   LicenseCode response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getLicenseCodeCallable() { + return stub.getLicenseCodeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (LicenseCodeClient licenseCodeClient = LicenseCodeClient.create()) {
+   *   ProjectGlobalLicenseCodeResourceName resource = ProjectGlobalLicenseCodeResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestPermissionsResponse response = licenseCodeClient.testIamPermissionsLicenseCode(resource, testPermissionsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param testPermissionsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TestPermissionsResponse testIamPermissionsLicenseCode( + ProjectGlobalLicenseCodeResourceName resource, + TestPermissionsRequest testPermissionsRequestResource) { + + TestIamPermissionsLicenseCodeHttpRequest request = + TestIamPermissionsLicenseCodeHttpRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setTestPermissionsRequestResource(testPermissionsRequestResource) + .build(); + return testIamPermissionsLicenseCode(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (LicenseCodeClient licenseCodeClient = LicenseCodeClient.create()) {
+   *   ProjectGlobalLicenseCodeResourceName resource = ProjectGlobalLicenseCodeResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestPermissionsResponse response = licenseCodeClient.testIamPermissionsLicenseCode(resource.toString(), testPermissionsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param testPermissionsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TestPermissionsResponse testIamPermissionsLicenseCode( + String resource, TestPermissionsRequest testPermissionsRequestResource) { + + TestIamPermissionsLicenseCodeHttpRequest request = + TestIamPermissionsLicenseCodeHttpRequest.newBuilder() + .setResource(resource) + .setTestPermissionsRequestResource(testPermissionsRequestResource) + .build(); + return testIamPermissionsLicenseCode(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (LicenseCodeClient licenseCodeClient = LicenseCodeClient.create()) {
+   *   ProjectGlobalLicenseCodeResourceName resource = ProjectGlobalLicenseCodeResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestIamPermissionsLicenseCodeHttpRequest request = TestIamPermissionsLicenseCodeHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setTestPermissionsRequestResource(testPermissionsRequestResource)
+   *     .build();
+   *   TestPermissionsResponse response = licenseCodeClient.testIamPermissionsLicenseCode(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TestPermissionsResponse testIamPermissionsLicenseCode( + TestIamPermissionsLicenseCodeHttpRequest request) { + return testIamPermissionsLicenseCodeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (LicenseCodeClient licenseCodeClient = LicenseCodeClient.create()) {
+   *   ProjectGlobalLicenseCodeResourceName resource = ProjectGlobalLicenseCodeResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestIamPermissionsLicenseCodeHttpRequest request = TestIamPermissionsLicenseCodeHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setTestPermissionsRequestResource(testPermissionsRequestResource)
+   *     .build();
+   *   ApiFuture<TestPermissionsResponse> future = licenseCodeClient.testIamPermissionsLicenseCodeCallable().futureCall(request);
+   *   // Do something
+   *   TestPermissionsResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + testIamPermissionsLicenseCodeCallable() { + return stub.testIamPermissionsLicenseCodeCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCodeLicenseAlias.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCodeLicenseAlias.java new file mode 100644 index 000000000000..96b3ef8ec210 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCodeLicenseAlias.java @@ -0,0 +1,175 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class LicenseCodeLicenseAlias implements ApiMessage { + private final String description; + private final String selfLink; + + private LicenseCodeLicenseAlias() { + this.description = null; + this.selfLink = null; + } + + private LicenseCodeLicenseAlias(String description, String selfLink) { + this.description = description; + this.selfLink = selfLink; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getDescription() { + return description; + } + + public String getSelfLink() { + return selfLink; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(LicenseCodeLicenseAlias prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static LicenseCodeLicenseAlias getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final LicenseCodeLicenseAlias DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new LicenseCodeLicenseAlias(); + } + + public static class Builder { + private String description; + private String selfLink; + + Builder() {} + + public Builder mergeFrom(LicenseCodeLicenseAlias other) { + if (other == LicenseCodeLicenseAlias.getDefaultInstance()) return this; + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + return this; + } + + Builder(LicenseCodeLicenseAlias source) { + this.description = source.description; + this.selfLink = source.selfLink; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public LicenseCodeLicenseAlias build() { + + return new LicenseCodeLicenseAlias(description, selfLink); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDescription(this.description); + newBuilder.setSelfLink(this.selfLink); + return newBuilder; + } + } + + @Override + public String toString() { + return "LicenseCodeLicenseAlias{" + + "description=" + + description + + ", " + + "selfLink=" + + selfLink + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof LicenseCodeLicenseAlias) { + LicenseCodeLicenseAlias that = (LicenseCodeLicenseAlias) o; + return Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.selfLink, that.getSelfLink()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(description, selfLink); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCodeSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCodeSettings.java new file mode 100644 index 000000000000..7ab4870940d9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseCodeSettings.java @@ -0,0 +1,193 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.LicenseCodeStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link LicenseCodeClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getLicenseCode to 30 seconds: + * + *

+ * 
+ * LicenseCodeSettings.Builder licenseCodeSettingsBuilder =
+ *     LicenseCodeSettings.newBuilder();
+ * licenseCodeSettingsBuilder.getLicenseCodeSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * LicenseCodeSettings licenseCodeSettings = licenseCodeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class LicenseCodeSettings extends ClientSettings { + /** Returns the object with the settings used for calls to getLicenseCode. */ + public UnaryCallSettings getLicenseCodeSettings() { + return ((LicenseCodeStubSettings) getStubSettings()).getLicenseCodeSettings(); + } + + /** Returns the object with the settings used for calls to testIamPermissionsLicenseCode. */ + public UnaryCallSettings + testIamPermissionsLicenseCodeSettings() { + return ((LicenseCodeStubSettings) getStubSettings()).testIamPermissionsLicenseCodeSettings(); + } + + public static final LicenseCodeSettings create(LicenseCodeStubSettings stub) throws IOException { + return new LicenseCodeSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return LicenseCodeStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return LicenseCodeStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return LicenseCodeStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return LicenseCodeStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return LicenseCodeStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return LicenseCodeStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return LicenseCodeStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return LicenseCodeStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected LicenseCodeSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for LicenseCodeSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(LicenseCodeStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(LicenseCodeStubSettings.newBuilder()); + } + + protected Builder(LicenseCodeSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(LicenseCodeStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public LicenseCodeStubSettings.Builder getStubSettingsBuilder() { + return ((LicenseCodeStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to getLicenseCode. */ + public UnaryCallSettings.Builder + getLicenseCodeSettings() { + return getStubSettingsBuilder().getLicenseCodeSettings(); + } + + /** Returns the builder for the settings used for calls to testIamPermissionsLicenseCode. */ + public UnaryCallSettings.Builder< + TestIamPermissionsLicenseCodeHttpRequest, TestPermissionsResponse> + testIamPermissionsLicenseCodeSettings() { + return getStubSettingsBuilder().testIamPermissionsLicenseCodeSettings(); + } + + @Override + public LicenseCodeSettings build() throws IOException { + return new LicenseCodeSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseResourceRequirements.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseResourceRequirements.java new file mode 100644 index 000000000000..a71e1505a4fe --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseResourceRequirements.java @@ -0,0 +1,175 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class LicenseResourceRequirements implements ApiMessage { + private final Integer minGuestCpuCount; + private final Integer minMemoryMb; + + private LicenseResourceRequirements() { + this.minGuestCpuCount = null; + this.minMemoryMb = null; + } + + private LicenseResourceRequirements(Integer minGuestCpuCount, Integer minMemoryMb) { + this.minGuestCpuCount = minGuestCpuCount; + this.minMemoryMb = minMemoryMb; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("minGuestCpuCount")) { + return minGuestCpuCount; + } + if (fieldName.equals("minMemoryMb")) { + return minMemoryMb; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getMinGuestCpuCount() { + return minGuestCpuCount; + } + + public Integer getMinMemoryMb() { + return minMemoryMb; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(LicenseResourceRequirements prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static LicenseResourceRequirements getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final LicenseResourceRequirements DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new LicenseResourceRequirements(); + } + + public static class Builder { + private Integer minGuestCpuCount; + private Integer minMemoryMb; + + Builder() {} + + public Builder mergeFrom(LicenseResourceRequirements other) { + if (other == LicenseResourceRequirements.getDefaultInstance()) return this; + if (other.getMinGuestCpuCount() != null) { + this.minGuestCpuCount = other.minGuestCpuCount; + } + if (other.getMinMemoryMb() != null) { + this.minMemoryMb = other.minMemoryMb; + } + return this; + } + + Builder(LicenseResourceRequirements source) { + this.minGuestCpuCount = source.minGuestCpuCount; + this.minMemoryMb = source.minMemoryMb; + } + + public Integer getMinGuestCpuCount() { + return minGuestCpuCount; + } + + public Builder setMinGuestCpuCount(Integer minGuestCpuCount) { + this.minGuestCpuCount = minGuestCpuCount; + return this; + } + + public Integer getMinMemoryMb() { + return minMemoryMb; + } + + public Builder setMinMemoryMb(Integer minMemoryMb) { + this.minMemoryMb = minMemoryMb; + return this; + } + + public LicenseResourceRequirements build() { + + return new LicenseResourceRequirements(minGuestCpuCount, minMemoryMb); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setMinGuestCpuCount(this.minGuestCpuCount); + newBuilder.setMinMemoryMb(this.minMemoryMb); + return newBuilder; + } + } + + @Override + public String toString() { + return "LicenseResourceRequirements{" + + "minGuestCpuCount=" + + minGuestCpuCount + + ", " + + "minMemoryMb=" + + minMemoryMb + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof LicenseResourceRequirements) { + LicenseResourceRequirements that = (LicenseResourceRequirements) o; + return Objects.equals(this.minGuestCpuCount, that.getMinGuestCpuCount()) + && Objects.equals(this.minMemoryMb, that.getMinMemoryMb()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(minGuestCpuCount, minMemoryMb); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseSettings.java new file mode 100644 index 000000000000..532b4a4e2024 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicenseSettings.java @@ -0,0 +1,227 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.LicenseClient.ListLicensesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.LicenseStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link LicenseClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteLicense to 30 seconds: + * + *

+ * 
+ * LicenseSettings.Builder licenseSettingsBuilder =
+ *     LicenseSettings.newBuilder();
+ * licenseSettingsBuilder.deleteLicenseSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * LicenseSettings licenseSettings = licenseSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class LicenseSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteLicense. */ + public UnaryCallSettings deleteLicenseSettings() { + return ((LicenseStubSettings) getStubSettings()).deleteLicenseSettings(); + } + + /** Returns the object with the settings used for calls to getLicense. */ + public UnaryCallSettings getLicenseSettings() { + return ((LicenseStubSettings) getStubSettings()).getLicenseSettings(); + } + + /** Returns the object with the settings used for calls to insertLicense. */ + public UnaryCallSettings insertLicenseSettings() { + return ((LicenseStubSettings) getStubSettings()).insertLicenseSettings(); + } + + /** Returns the object with the settings used for calls to listLicenses. */ + public PagedCallSettings + listLicensesSettings() { + return ((LicenseStubSettings) getStubSettings()).listLicensesSettings(); + } + + /** Returns the object with the settings used for calls to testIamPermissionsLicense. */ + public UnaryCallSettings + testIamPermissionsLicenseSettings() { + return ((LicenseStubSettings) getStubSettings()).testIamPermissionsLicenseSettings(); + } + + public static final LicenseSettings create(LicenseStubSettings stub) throws IOException { + return new LicenseSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return LicenseStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return LicenseStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return LicenseStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return LicenseStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return LicenseStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return LicenseStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return LicenseStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return LicenseStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected LicenseSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for LicenseSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(LicenseStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(LicenseStubSettings.newBuilder()); + } + + protected Builder(LicenseSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(LicenseStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public LicenseStubSettings.Builder getStubSettingsBuilder() { + return ((LicenseStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteLicense. */ + public UnaryCallSettings.Builder deleteLicenseSettings() { + return getStubSettingsBuilder().deleteLicenseSettings(); + } + + /** Returns the builder for the settings used for calls to getLicense. */ + public UnaryCallSettings.Builder getLicenseSettings() { + return getStubSettingsBuilder().getLicenseSettings(); + } + + /** Returns the builder for the settings used for calls to insertLicense. */ + public UnaryCallSettings.Builder insertLicenseSettings() { + return getStubSettingsBuilder().insertLicenseSettings(); + } + + /** Returns the builder for the settings used for calls to listLicenses. */ + public PagedCallSettings.Builder< + ListLicensesHttpRequest, LicensesListResponse, ListLicensesPagedResponse> + listLicensesSettings() { + return getStubSettingsBuilder().listLicensesSettings(); + } + + /** Returns the builder for the settings used for calls to testIamPermissionsLicense. */ + public UnaryCallSettings.Builder + testIamPermissionsLicenseSettings() { + return getStubSettingsBuilder().testIamPermissionsLicenseSettings(); + } + + @Override + public LicenseSettings build() throws IOException { + return new LicenseSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicensesListResponse.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicensesListResponse.java new file mode 100644 index 000000000000..5af927bb3672 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/LicensesListResponse.java @@ -0,0 +1,272 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class LicensesListResponse implements ApiMessage { + private final String id; + private final List items; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private LicensesListResponse() { + this.id = null; + this.items = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private LicensesListResponse( + String id, List items, String nextPageToken, String selfLink, Warning warning) { + this.id = id; + this.items = items; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(LicensesListResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static LicensesListResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final LicensesListResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new LicensesListResponse(); + } + + public static class Builder { + private String id; + private List items; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(LicensesListResponse other) { + if (other == LicensesListResponse.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(LicensesListResponse source) { + this.id = source.id; + this.items = source.items; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(License items) { + this.items.add(items); + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public LicensesListResponse build() { + + return new LicensesListResponse(id, items, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "LicensesListResponse{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof LicensesListResponse) { + LicensesListResponse that = (LicensesListResponse) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAcceleratorTypesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAcceleratorTypesHttpRequest.java new file mode 100644 index 000000000000..24f88896d771 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAcceleratorTypesHttpRequest.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListAcceleratorTypesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String zone; + + private ListAcceleratorTypesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.zone = null; + } + + private ListAcceleratorTypesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListAcceleratorTypesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListAcceleratorTypesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListAcceleratorTypesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListAcceleratorTypesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(ListAcceleratorTypesHttpRequest other) { + if (other == ListAcceleratorTypesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(ListAcceleratorTypesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public ListAcceleratorTypesHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListAcceleratorTypesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListAcceleratorTypesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListAcceleratorTypesHttpRequest) { + ListAcceleratorTypesHttpRequest that = (ListAcceleratorTypesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAddressesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAddressesHttpRequest.java new file mode 100644 index 000000000000..5198a60931af --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAddressesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListAddressesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListAddressesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListAddressesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListAddressesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListAddressesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListAddressesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListAddressesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListAddressesHttpRequest other) { + if (other == ListAddressesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListAddressesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListAddressesHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListAddressesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListAddressesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListAddressesHttpRequest) { + ListAddressesHttpRequest that = (ListAddressesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAutoscalersHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAutoscalersHttpRequest.java new file mode 100644 index 000000000000..05568ecd5361 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAutoscalersHttpRequest.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListAutoscalersHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String zone; + + private ListAutoscalersHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.zone = null; + } + + private ListAutoscalersHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListAutoscalersHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListAutoscalersHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListAutoscalersHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListAutoscalersHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(ListAutoscalersHttpRequest other) { + if (other == ListAutoscalersHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(ListAutoscalersHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public ListAutoscalersHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListAutoscalersHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListAutoscalersHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListAutoscalersHttpRequest) { + ListAutoscalersHttpRequest that = (ListAutoscalersHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAvailableFeaturesSslPoliciesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAvailableFeaturesSslPoliciesHttpRequest.java new file mode 100644 index 000000000000..fc751f1a6f53 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListAvailableFeaturesSslPoliciesHttpRequest.java @@ -0,0 +1,510 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListAvailableFeaturesSslPoliciesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListAvailableFeaturesSslPoliciesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListAvailableFeaturesSslPoliciesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListAvailableFeaturesSslPoliciesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListAvailableFeaturesSslPoliciesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListAvailableFeaturesSslPoliciesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListAvailableFeaturesSslPoliciesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListAvailableFeaturesSslPoliciesHttpRequest other) { + if (other == ListAvailableFeaturesSslPoliciesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListAvailableFeaturesSslPoliciesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListAvailableFeaturesSslPoliciesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListAvailableFeaturesSslPoliciesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListAvailableFeaturesSslPoliciesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListAvailableFeaturesSslPoliciesHttpRequest) { + ListAvailableFeaturesSslPoliciesHttpRequest that = + (ListAvailableFeaturesSslPoliciesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListBackendBucketsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListBackendBucketsHttpRequest.java new file mode 100644 index 000000000000..b84e53222541 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListBackendBucketsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListBackendBucketsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListBackendBucketsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListBackendBucketsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListBackendBucketsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListBackendBucketsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListBackendBucketsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListBackendBucketsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListBackendBucketsHttpRequest other) { + if (other == ListBackendBucketsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListBackendBucketsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListBackendBucketsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListBackendBucketsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListBackendBucketsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListBackendBucketsHttpRequest) { + ListBackendBucketsHttpRequest that = (ListBackendBucketsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListBackendServicesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListBackendServicesHttpRequest.java new file mode 100644 index 000000000000..7e49314be6fe --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListBackendServicesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListBackendServicesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListBackendServicesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListBackendServicesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListBackendServicesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListBackendServicesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListBackendServicesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListBackendServicesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListBackendServicesHttpRequest other) { + if (other == ListBackendServicesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListBackendServicesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListBackendServicesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListBackendServicesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListBackendServicesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListBackendServicesHttpRequest) { + ListBackendServicesHttpRequest that = (ListBackendServicesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListDiskTypesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListDiskTypesHttpRequest.java new file mode 100644 index 000000000000..bb16c2b40bd0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListDiskTypesHttpRequest.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListDiskTypesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String zone; + + private ListDiskTypesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.zone = null; + } + + private ListDiskTypesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListDiskTypesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListDiskTypesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListDiskTypesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListDiskTypesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(ListDiskTypesHttpRequest other) { + if (other == ListDiskTypesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(ListDiskTypesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public ListDiskTypesHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListDiskTypesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListDiskTypesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListDiskTypesHttpRequest) { + ListDiskTypesHttpRequest that = (ListDiskTypesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListDisksHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListDisksHttpRequest.java new file mode 100644 index 000000000000..b19f5c74f988 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListDisksHttpRequest.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListDisksHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String zone; + + private ListDisksHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.zone = null; + } + + private ListDisksHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListDisksHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListDisksHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListDisksHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListDisksHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(ListDisksHttpRequest other) { + if (other == ListDisksHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(ListDisksHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public ListDisksHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListDisksHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListDisksHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListDisksHttpRequest) { + ListDisksHttpRequest that = (ListDisksHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListFirewallsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListFirewallsHttpRequest.java new file mode 100644 index 000000000000..b3ba0d38e97a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListFirewallsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListFirewallsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListFirewallsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListFirewallsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListFirewallsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListFirewallsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListFirewallsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListFirewallsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListFirewallsHttpRequest other) { + if (other == ListFirewallsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListFirewallsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListFirewallsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListFirewallsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListFirewallsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListFirewallsHttpRequest) { + ListFirewallsHttpRequest that = (ListFirewallsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListForwardingRulesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListForwardingRulesHttpRequest.java new file mode 100644 index 000000000000..52b8e7afc873 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListForwardingRulesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListForwardingRulesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListForwardingRulesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListForwardingRulesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListForwardingRulesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListForwardingRulesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListForwardingRulesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListForwardingRulesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListForwardingRulesHttpRequest other) { + if (other == ListForwardingRulesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListForwardingRulesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListForwardingRulesHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListForwardingRulesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListForwardingRulesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListForwardingRulesHttpRequest) { + ListForwardingRulesHttpRequest that = (ListForwardingRulesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListGlobalAddressesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListGlobalAddressesHttpRequest.java new file mode 100644 index 000000000000..777d19f94c6a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListGlobalAddressesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListGlobalAddressesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListGlobalAddressesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListGlobalAddressesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListGlobalAddressesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListGlobalAddressesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListGlobalAddressesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListGlobalAddressesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListGlobalAddressesHttpRequest other) { + if (other == ListGlobalAddressesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListGlobalAddressesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListGlobalAddressesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListGlobalAddressesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListGlobalAddressesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListGlobalAddressesHttpRequest) { + ListGlobalAddressesHttpRequest that = (ListGlobalAddressesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListGlobalForwardingRulesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListGlobalForwardingRulesHttpRequest.java new file mode 100644 index 000000000000..77462c526914 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListGlobalForwardingRulesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListGlobalForwardingRulesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListGlobalForwardingRulesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListGlobalForwardingRulesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListGlobalForwardingRulesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListGlobalForwardingRulesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListGlobalForwardingRulesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListGlobalForwardingRulesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListGlobalForwardingRulesHttpRequest other) { + if (other == ListGlobalForwardingRulesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListGlobalForwardingRulesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListGlobalForwardingRulesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListGlobalForwardingRulesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListGlobalForwardingRulesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListGlobalForwardingRulesHttpRequest) { + ListGlobalForwardingRulesHttpRequest that = (ListGlobalForwardingRulesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListGlobalOperationsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListGlobalOperationsHttpRequest.java new file mode 100644 index 000000000000..07c6f18f4f6f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListGlobalOperationsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListGlobalOperationsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListGlobalOperationsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListGlobalOperationsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListGlobalOperationsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListGlobalOperationsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListGlobalOperationsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListGlobalOperationsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListGlobalOperationsHttpRequest other) { + if (other == ListGlobalOperationsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListGlobalOperationsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListGlobalOperationsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListGlobalOperationsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListGlobalOperationsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListGlobalOperationsHttpRequest) { + ListGlobalOperationsHttpRequest that = (ListGlobalOperationsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListHealthChecksHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListHealthChecksHttpRequest.java new file mode 100644 index 000000000000..42de29469cc8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListHealthChecksHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListHealthChecksHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListHealthChecksHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListHealthChecksHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListHealthChecksHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListHealthChecksHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListHealthChecksHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListHealthChecksHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListHealthChecksHttpRequest other) { + if (other == ListHealthChecksHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListHealthChecksHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListHealthChecksHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListHealthChecksHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListHealthChecksHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListHealthChecksHttpRequest) { + ListHealthChecksHttpRequest that = (ListHealthChecksHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListHttpHealthChecksHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListHttpHealthChecksHttpRequest.java new file mode 100644 index 000000000000..34a50eb3eb7c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListHttpHealthChecksHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListHttpHealthChecksHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListHttpHealthChecksHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListHttpHealthChecksHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListHttpHealthChecksHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListHttpHealthChecksHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListHttpHealthChecksHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListHttpHealthChecksHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListHttpHealthChecksHttpRequest other) { + if (other == ListHttpHealthChecksHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListHttpHealthChecksHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListHttpHealthChecksHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListHttpHealthChecksHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListHttpHealthChecksHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListHttpHealthChecksHttpRequest) { + ListHttpHealthChecksHttpRequest that = (ListHttpHealthChecksHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListHttpsHealthChecksHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListHttpsHealthChecksHttpRequest.java new file mode 100644 index 000000000000..f56ff8f78216 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListHttpsHealthChecksHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListHttpsHealthChecksHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListHttpsHealthChecksHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListHttpsHealthChecksHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListHttpsHealthChecksHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListHttpsHealthChecksHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListHttpsHealthChecksHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListHttpsHealthChecksHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListHttpsHealthChecksHttpRequest other) { + if (other == ListHttpsHealthChecksHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListHttpsHealthChecksHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListHttpsHealthChecksHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListHttpsHealthChecksHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListHttpsHealthChecksHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListHttpsHealthChecksHttpRequest) { + ListHttpsHealthChecksHttpRequest that = (ListHttpsHealthChecksHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListImagesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListImagesHttpRequest.java new file mode 100644 index 000000000000..faf12f63e32b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListImagesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListImagesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListImagesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListImagesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListImagesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListImagesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListImagesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListImagesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListImagesHttpRequest other) { + if (other == ListImagesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListImagesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListImagesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListImagesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListImagesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListImagesHttpRequest) { + ListImagesHttpRequest that = (ListImagesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstanceGroupManagersHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstanceGroupManagersHttpRequest.java new file mode 100644 index 000000000000..bed894d85107 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstanceGroupManagersHttpRequest.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListInstanceGroupManagersHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String zone; + + private ListInstanceGroupManagersHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.zone = null; + } + + private ListInstanceGroupManagersHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListInstanceGroupManagersHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListInstanceGroupManagersHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListInstanceGroupManagersHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListInstanceGroupManagersHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(ListInstanceGroupManagersHttpRequest other) { + if (other == ListInstanceGroupManagersHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(ListInstanceGroupManagersHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public ListInstanceGroupManagersHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListInstanceGroupManagersHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListInstanceGroupManagersHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListInstanceGroupManagersHttpRequest) { + ListInstanceGroupManagersHttpRequest that = (ListInstanceGroupManagersHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstanceGroupsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstanceGroupsHttpRequest.java new file mode 100644 index 000000000000..30d061945370 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstanceGroupsHttpRequest.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListInstanceGroupsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String zone; + + private ListInstanceGroupsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.zone = null; + } + + private ListInstanceGroupsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListInstanceGroupsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListInstanceGroupsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListInstanceGroupsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListInstanceGroupsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(ListInstanceGroupsHttpRequest other) { + if (other == ListInstanceGroupsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(ListInstanceGroupsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public ListInstanceGroupsHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListInstanceGroupsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListInstanceGroupsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListInstanceGroupsHttpRequest) { + ListInstanceGroupsHttpRequest that = (ListInstanceGroupsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstanceTemplatesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstanceTemplatesHttpRequest.java new file mode 100644 index 000000000000..66421b27a04e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstanceTemplatesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListInstanceTemplatesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListInstanceTemplatesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListInstanceTemplatesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListInstanceTemplatesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListInstanceTemplatesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListInstanceTemplatesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListInstanceTemplatesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListInstanceTemplatesHttpRequest other) { + if (other == ListInstanceTemplatesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListInstanceTemplatesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListInstanceTemplatesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListInstanceTemplatesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListInstanceTemplatesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListInstanceTemplatesHttpRequest) { + ListInstanceTemplatesHttpRequest that = (ListInstanceTemplatesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstancesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstancesHttpRequest.java new file mode 100644 index 000000000000..1067060d2659 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstancesHttpRequest.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListInstancesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String zone; + + private ListInstancesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.zone = null; + } + + private ListInstancesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListInstancesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListInstancesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListInstancesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListInstancesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(ListInstancesHttpRequest other) { + if (other == ListInstancesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(ListInstancesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public ListInstancesHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListInstancesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListInstancesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListInstancesHttpRequest) { + ListInstancesHttpRequest that = (ListInstancesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstancesInstanceGroupsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstancesInstanceGroupsHttpRequest.java new file mode 100644 index 000000000000..b9c536de1722 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstancesInstanceGroupsHttpRequest.java @@ -0,0 +1,547 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListInstancesInstanceGroupsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String instanceGroup; + private final InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private ListInstancesInstanceGroupsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.instanceGroup = null; + this.instanceGroupsListInstancesRequestResource = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListInstancesInstanceGroupsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String instanceGroup, + InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.instanceGroup = instanceGroup; + this.instanceGroupsListInstancesRequestResource = instanceGroupsListInstancesRequestResource; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("instanceGroup")) { + return instanceGroup; + } + if (fieldName.equals("instanceGroupsListInstancesRequestResource")) { + return instanceGroupsListInstancesRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceGroupsListInstancesRequest getApiMessageRequestBody() { + return instanceGroupsListInstancesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public InstanceGroupsListInstancesRequest getInstanceGroupsListInstancesRequestResource() { + return instanceGroupsListInstancesRequestResource; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListInstancesInstanceGroupsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListInstancesInstanceGroupsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListInstancesInstanceGroupsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListInstancesInstanceGroupsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String instanceGroup; + private InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListInstancesInstanceGroupsHttpRequest other) { + if (other == ListInstancesInstanceGroupsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getInstanceGroup() != null) { + this.instanceGroup = other.instanceGroup; + } + if (other.getInstanceGroupsListInstancesRequestResource() != null) { + this.instanceGroupsListInstancesRequestResource = + other.instanceGroupsListInstancesRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListInstancesInstanceGroupsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.instanceGroup = source.instanceGroup; + this.instanceGroupsListInstancesRequestResource = + source.instanceGroupsListInstancesRequestResource; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public InstanceGroupsListInstancesRequest getInstanceGroupsListInstancesRequestResource() { + return instanceGroupsListInstancesRequestResource; + } + + public Builder setInstanceGroupsListInstancesRequestResource( + InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource) { + this.instanceGroupsListInstancesRequestResource = instanceGroupsListInstancesRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListInstancesInstanceGroupsHttpRequest build() { + String missing = ""; + + if (instanceGroup == null) { + missing += " instanceGroup"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListInstancesInstanceGroupsHttpRequest( + access_token, + callback, + fields, + filter, + instanceGroup, + instanceGroupsListInstancesRequestResource, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setInstanceGroup(this.instanceGroup); + newBuilder.setInstanceGroupsListInstancesRequestResource( + this.instanceGroupsListInstancesRequestResource); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListInstancesInstanceGroupsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "instanceGroup=" + + instanceGroup + + ", " + + "instanceGroupsListInstancesRequestResource=" + + instanceGroupsListInstancesRequestResource + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListInstancesInstanceGroupsHttpRequest) { + ListInstancesInstanceGroupsHttpRequest that = (ListInstancesInstanceGroupsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals( + this.instanceGroupsListInstancesRequestResource, + that.getInstanceGroupsListInstancesRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + instanceGroup, + instanceGroupsListInstancesRequestResource, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstancesRegionInstanceGroupsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstancesRegionInstanceGroupsHttpRequest.java new file mode 100644 index 000000000000..b349cdf74f05 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInstancesRegionInstanceGroupsHttpRequest.java @@ -0,0 +1,554 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListInstancesRegionInstanceGroupsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String instanceGroup; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final RegionInstanceGroupsListInstancesRequest + regionInstanceGroupsListInstancesRequestResource; + private final String userIp; + + private ListInstancesRegionInstanceGroupsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.instanceGroup = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.regionInstanceGroupsListInstancesRequestResource = null; + this.userIp = null; + } + + private ListInstancesRegionInstanceGroupsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String instanceGroup, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.instanceGroup = instanceGroup; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.regionInstanceGroupsListInstancesRequestResource = + regionInstanceGroupsListInstancesRequestResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("instanceGroup")) { + return instanceGroup; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("regionInstanceGroupsListInstancesRequestResource")) { + return regionInstanceGroupsListInstancesRequestResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public RegionInstanceGroupsListInstancesRequest getApiMessageRequestBody() { + return regionInstanceGroupsListInstancesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public RegionInstanceGroupsListInstancesRequest + getRegionInstanceGroupsListInstancesRequestResource() { + return regionInstanceGroupsListInstancesRequestResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListInstancesRegionInstanceGroupsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListInstancesRegionInstanceGroupsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListInstancesRegionInstanceGroupsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListInstancesRegionInstanceGroupsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String instanceGroup; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private RegionInstanceGroupsListInstancesRequest + regionInstanceGroupsListInstancesRequestResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListInstancesRegionInstanceGroupsHttpRequest other) { + if (other == ListInstancesRegionInstanceGroupsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getInstanceGroup() != null) { + this.instanceGroup = other.instanceGroup; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegionInstanceGroupsListInstancesRequestResource() != null) { + this.regionInstanceGroupsListInstancesRequestResource = + other.regionInstanceGroupsListInstancesRequestResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListInstancesRegionInstanceGroupsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.instanceGroup = source.instanceGroup; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.regionInstanceGroupsListInstancesRequestResource = + source.regionInstanceGroupsListInstancesRequestResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public RegionInstanceGroupsListInstancesRequest + getRegionInstanceGroupsListInstancesRequestResource() { + return regionInstanceGroupsListInstancesRequestResource; + } + + public Builder setRegionInstanceGroupsListInstancesRequestResource( + RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource) { + this.regionInstanceGroupsListInstancesRequestResource = + regionInstanceGroupsListInstancesRequestResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListInstancesRegionInstanceGroupsHttpRequest build() { + String missing = ""; + + if (instanceGroup == null) { + missing += " instanceGroup"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListInstancesRegionInstanceGroupsHttpRequest( + access_token, + callback, + fields, + filter, + instanceGroup, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + regionInstanceGroupsListInstancesRequestResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setInstanceGroup(this.instanceGroup); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegionInstanceGroupsListInstancesRequestResource( + this.regionInstanceGroupsListInstancesRequestResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListInstancesRegionInstanceGroupsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "instanceGroup=" + + instanceGroup + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "regionInstanceGroupsListInstancesRequestResource=" + + regionInstanceGroupsListInstancesRequestResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListInstancesRegionInstanceGroupsHttpRequest) { + ListInstancesRegionInstanceGroupsHttpRequest that = + (ListInstancesRegionInstanceGroupsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals( + this.regionInstanceGroupsListInstancesRequestResource, + that.getRegionInstanceGroupsListInstancesRequestResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + instanceGroup, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + regionInstanceGroupsListInstancesRequestResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInterconnectAttachmentsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInterconnectAttachmentsHttpRequest.java new file mode 100644 index 000000000000..ea3f0319af05 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInterconnectAttachmentsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListInterconnectAttachmentsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListInterconnectAttachmentsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListInterconnectAttachmentsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListInterconnectAttachmentsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListInterconnectAttachmentsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListInterconnectAttachmentsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListInterconnectAttachmentsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListInterconnectAttachmentsHttpRequest other) { + if (other == ListInterconnectAttachmentsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListInterconnectAttachmentsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListInterconnectAttachmentsHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListInterconnectAttachmentsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListInterconnectAttachmentsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListInterconnectAttachmentsHttpRequest) { + ListInterconnectAttachmentsHttpRequest that = (ListInterconnectAttachmentsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInterconnectLocationsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInterconnectLocationsHttpRequest.java new file mode 100644 index 000000000000..6765ca3f254b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInterconnectLocationsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListInterconnectLocationsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListInterconnectLocationsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListInterconnectLocationsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListInterconnectLocationsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListInterconnectLocationsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListInterconnectLocationsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListInterconnectLocationsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListInterconnectLocationsHttpRequest other) { + if (other == ListInterconnectLocationsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListInterconnectLocationsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListInterconnectLocationsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListInterconnectLocationsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListInterconnectLocationsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListInterconnectLocationsHttpRequest) { + ListInterconnectLocationsHttpRequest that = (ListInterconnectLocationsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInterconnectsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInterconnectsHttpRequest.java new file mode 100644 index 000000000000..cef9d8e5fd1d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListInterconnectsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListInterconnectsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListInterconnectsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListInterconnectsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListInterconnectsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListInterconnectsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListInterconnectsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListInterconnectsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListInterconnectsHttpRequest other) { + if (other == ListInterconnectsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListInterconnectsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListInterconnectsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListInterconnectsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListInterconnectsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListInterconnectsHttpRequest) { + ListInterconnectsHttpRequest that = (ListInterconnectsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListLicensesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListLicensesHttpRequest.java new file mode 100644 index 000000000000..5a8550d8c53e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListLicensesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListLicensesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListLicensesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListLicensesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListLicensesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListLicensesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListLicensesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListLicensesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListLicensesHttpRequest other) { + if (other == ListLicensesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListLicensesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListLicensesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListLicensesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListLicensesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListLicensesHttpRequest) { + ListLicensesHttpRequest that = (ListLicensesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListMachineTypesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListMachineTypesHttpRequest.java new file mode 100644 index 000000000000..b93f7892d350 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListMachineTypesHttpRequest.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListMachineTypesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String zone; + + private ListMachineTypesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.zone = null; + } + + private ListMachineTypesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListMachineTypesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListMachineTypesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListMachineTypesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListMachineTypesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(ListMachineTypesHttpRequest other) { + if (other == ListMachineTypesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(ListMachineTypesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public ListMachineTypesHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListMachineTypesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListMachineTypesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListMachineTypesHttpRequest) { + ListMachineTypesHttpRequest that = (ListMachineTypesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListManagedInstancesInstanceGroupManagersHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListManagedInstancesInstanceGroupManagersHttpRequest.java new file mode 100644 index 000000000000..4a6b155aa537 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListManagedInstancesInstanceGroupManagersHttpRequest.java @@ -0,0 +1,511 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListManagedInstancesInstanceGroupManagersHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String instanceGroupManager; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private ListManagedInstancesInstanceGroupManagersHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.instanceGroupManager = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListManagedInstancesInstanceGroupManagersHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String instanceGroupManager, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListManagedInstancesInstanceGroupManagersHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListManagedInstancesInstanceGroupManagersHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListManagedInstancesInstanceGroupManagersHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListManagedInstancesInstanceGroupManagersHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String instanceGroupManager; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListManagedInstancesInstanceGroupManagersHttpRequest other) { + if (other == ListManagedInstancesInstanceGroupManagersHttpRequest.getDefaultInstance()) + return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListManagedInstancesInstanceGroupManagersHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListManagedInstancesInstanceGroupManagersHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListManagedInstancesInstanceGroupManagersHttpRequest( + access_token, + callback, + fields, + filter, + instanceGroupManager, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListManagedInstancesInstanceGroupManagersHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListManagedInstancesInstanceGroupManagersHttpRequest) { + ListManagedInstancesInstanceGroupManagersHttpRequest that = + (ListManagedInstancesInstanceGroupManagersHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + instanceGroupManager, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListManagedInstancesRegionInstanceGroupManagersHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListManagedInstancesRegionInstanceGroupManagersHttpRequest.java new file mode 100644 index 000000000000..c54915618126 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListManagedInstancesRegionInstanceGroupManagersHttpRequest.java @@ -0,0 +1,513 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListManagedInstancesRegionInstanceGroupManagersHttpRequest + implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String instanceGroupManager; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private ListManagedInstancesRegionInstanceGroupManagersHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.instanceGroupManager = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListManagedInstancesRegionInstanceGroupManagersHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String instanceGroupManager, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + ListManagedInstancesRegionInstanceGroupManagersHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListManagedInstancesRegionInstanceGroupManagersHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListManagedInstancesRegionInstanceGroupManagersHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListManagedInstancesRegionInstanceGroupManagersHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String instanceGroupManager; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListManagedInstancesRegionInstanceGroupManagersHttpRequest other) { + if (other == ListManagedInstancesRegionInstanceGroupManagersHttpRequest.getDefaultInstance()) + return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListManagedInstancesRegionInstanceGroupManagersHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListManagedInstancesRegionInstanceGroupManagersHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListManagedInstancesRegionInstanceGroupManagersHttpRequest( + access_token, + callback, + fields, + filter, + instanceGroupManager, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListManagedInstancesRegionInstanceGroupManagersHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListManagedInstancesRegionInstanceGroupManagersHttpRequest) { + ListManagedInstancesRegionInstanceGroupManagersHttpRequest that = + (ListManagedInstancesRegionInstanceGroupManagersHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + instanceGroupManager, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListNetworksHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListNetworksHttpRequest.java new file mode 100644 index 000000000000..db9d798b5793 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListNetworksHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListNetworksHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListNetworksHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListNetworksHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListNetworksHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListNetworksHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListNetworksHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListNetworksHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListNetworksHttpRequest other) { + if (other == ListNetworksHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListNetworksHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListNetworksHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListNetworksHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListNetworksHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListNetworksHttpRequest) { + ListNetworksHttpRequest that = (ListNetworksHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListReferrersInstancesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListReferrersInstancesHttpRequest.java new file mode 100644 index 000000000000..0864085f101e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListReferrersInstancesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListReferrersInstancesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String instance; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + + private ListReferrersInstancesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.instance = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListReferrersInstancesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String instance, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.instance = instance; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListReferrersInstancesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListReferrersInstancesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListReferrersInstancesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListReferrersInstancesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String instance; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListReferrersInstancesHttpRequest other) { + if (other == ListReferrersInstancesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListReferrersInstancesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.instance = source.instance; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListReferrersInstancesHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListReferrersInstancesHttpRequest( + access_token, + callback, + fields, + filter, + instance, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListReferrersInstancesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListReferrersInstancesHttpRequest) { + ListReferrersInstancesHttpRequest that = (ListReferrersInstancesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + instance, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionAutoscalersHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionAutoscalersHttpRequest.java new file mode 100644 index 000000000000..9acb39fccbaf --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionAutoscalersHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListRegionAutoscalersHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListRegionAutoscalersHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListRegionAutoscalersHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListRegionAutoscalersHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListRegionAutoscalersHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListRegionAutoscalersHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListRegionAutoscalersHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListRegionAutoscalersHttpRequest other) { + if (other == ListRegionAutoscalersHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListRegionAutoscalersHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListRegionAutoscalersHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListRegionAutoscalersHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListRegionAutoscalersHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListRegionAutoscalersHttpRequest) { + ListRegionAutoscalersHttpRequest that = (ListRegionAutoscalersHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionBackendServicesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionBackendServicesHttpRequest.java new file mode 100644 index 000000000000..39c3159dbb73 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionBackendServicesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListRegionBackendServicesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListRegionBackendServicesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListRegionBackendServicesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListRegionBackendServicesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListRegionBackendServicesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListRegionBackendServicesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListRegionBackendServicesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListRegionBackendServicesHttpRequest other) { + if (other == ListRegionBackendServicesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListRegionBackendServicesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListRegionBackendServicesHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListRegionBackendServicesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListRegionBackendServicesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListRegionBackendServicesHttpRequest) { + ListRegionBackendServicesHttpRequest that = (ListRegionBackendServicesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionCommitmentsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionCommitmentsHttpRequest.java new file mode 100644 index 000000000000..af22bce70777 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionCommitmentsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListRegionCommitmentsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListRegionCommitmentsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListRegionCommitmentsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListRegionCommitmentsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListRegionCommitmentsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListRegionCommitmentsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListRegionCommitmentsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListRegionCommitmentsHttpRequest other) { + if (other == ListRegionCommitmentsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListRegionCommitmentsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListRegionCommitmentsHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListRegionCommitmentsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListRegionCommitmentsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListRegionCommitmentsHttpRequest) { + ListRegionCommitmentsHttpRequest that = (ListRegionCommitmentsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionDiskTypesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionDiskTypesHttpRequest.java new file mode 100644 index 000000000000..850910078295 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionDiskTypesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListRegionDiskTypesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListRegionDiskTypesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListRegionDiskTypesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListRegionDiskTypesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListRegionDiskTypesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListRegionDiskTypesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListRegionDiskTypesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListRegionDiskTypesHttpRequest other) { + if (other == ListRegionDiskTypesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListRegionDiskTypesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListRegionDiskTypesHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListRegionDiskTypesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListRegionDiskTypesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListRegionDiskTypesHttpRequest) { + ListRegionDiskTypesHttpRequest that = (ListRegionDiskTypesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionDisksHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionDisksHttpRequest.java new file mode 100644 index 000000000000..ae818c4cc369 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionDisksHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListRegionDisksHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListRegionDisksHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListRegionDisksHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListRegionDisksHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListRegionDisksHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListRegionDisksHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListRegionDisksHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListRegionDisksHttpRequest other) { + if (other == ListRegionDisksHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListRegionDisksHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListRegionDisksHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListRegionDisksHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListRegionDisksHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListRegionDisksHttpRequest) { + ListRegionDisksHttpRequest that = (ListRegionDisksHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionInstanceGroupManagersHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionInstanceGroupManagersHttpRequest.java new file mode 100644 index 000000000000..49dec8728e7e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionInstanceGroupManagersHttpRequest.java @@ -0,0 +1,510 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListRegionInstanceGroupManagersHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListRegionInstanceGroupManagersHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListRegionInstanceGroupManagersHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListRegionInstanceGroupManagersHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListRegionInstanceGroupManagersHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListRegionInstanceGroupManagersHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListRegionInstanceGroupManagersHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListRegionInstanceGroupManagersHttpRequest other) { + if (other == ListRegionInstanceGroupManagersHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListRegionInstanceGroupManagersHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListRegionInstanceGroupManagersHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListRegionInstanceGroupManagersHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListRegionInstanceGroupManagersHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListRegionInstanceGroupManagersHttpRequest) { + ListRegionInstanceGroupManagersHttpRequest that = + (ListRegionInstanceGroupManagersHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionInstanceGroupsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionInstanceGroupsHttpRequest.java new file mode 100644 index 000000000000..273834703ead --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionInstanceGroupsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListRegionInstanceGroupsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListRegionInstanceGroupsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListRegionInstanceGroupsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListRegionInstanceGroupsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListRegionInstanceGroupsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListRegionInstanceGroupsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListRegionInstanceGroupsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListRegionInstanceGroupsHttpRequest other) { + if (other == ListRegionInstanceGroupsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListRegionInstanceGroupsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListRegionInstanceGroupsHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListRegionInstanceGroupsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListRegionInstanceGroupsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListRegionInstanceGroupsHttpRequest) { + ListRegionInstanceGroupsHttpRequest that = (ListRegionInstanceGroupsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionOperationsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionOperationsHttpRequest.java new file mode 100644 index 000000000000..1ec0e417def9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionOperationsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListRegionOperationsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListRegionOperationsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListRegionOperationsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListRegionOperationsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListRegionOperationsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListRegionOperationsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListRegionOperationsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListRegionOperationsHttpRequest other) { + if (other == ListRegionOperationsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListRegionOperationsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListRegionOperationsHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListRegionOperationsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListRegionOperationsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListRegionOperationsHttpRequest) { + ListRegionOperationsHttpRequest that = (ListRegionOperationsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionsHttpRequest.java new file mode 100644 index 000000000000..1854141ffced --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRegionsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListRegionsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListRegionsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListRegionsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListRegionsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListRegionsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListRegionsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListRegionsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListRegionsHttpRequest other) { + if (other == ListRegionsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListRegionsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListRegionsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListRegionsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListRegionsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListRegionsHttpRequest) { + ListRegionsHttpRequest that = (ListRegionsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRoutersHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRoutersHttpRequest.java new file mode 100644 index 000000000000..01ef08ef554a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRoutersHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListRoutersHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListRoutersHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListRoutersHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListRoutersHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListRoutersHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListRoutersHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListRoutersHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListRoutersHttpRequest other) { + if (other == ListRoutersHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListRoutersHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListRoutersHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListRoutersHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListRoutersHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListRoutersHttpRequest) { + ListRoutersHttpRequest that = (ListRoutersHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRoutesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRoutesHttpRequest.java new file mode 100644 index 000000000000..bd78370554b0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListRoutesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListRoutesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListRoutesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListRoutesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListRoutesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListRoutesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListRoutesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListRoutesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListRoutesHttpRequest other) { + if (other == ListRoutesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListRoutesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListRoutesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListRoutesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListRoutesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListRoutesHttpRequest) { + ListRoutesHttpRequest that = (ListRoutesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSnapshotsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSnapshotsHttpRequest.java new file mode 100644 index 000000000000..e9c265a28f91 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSnapshotsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListSnapshotsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListSnapshotsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListSnapshotsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListSnapshotsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListSnapshotsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListSnapshotsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListSnapshotsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListSnapshotsHttpRequest other) { + if (other == ListSnapshotsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListSnapshotsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListSnapshotsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListSnapshotsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListSnapshotsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListSnapshotsHttpRequest) { + ListSnapshotsHttpRequest that = (ListSnapshotsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSslCertificatesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSslCertificatesHttpRequest.java new file mode 100644 index 000000000000..b099c7588532 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSslCertificatesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListSslCertificatesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListSslCertificatesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListSslCertificatesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListSslCertificatesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListSslCertificatesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListSslCertificatesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListSslCertificatesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListSslCertificatesHttpRequest other) { + if (other == ListSslCertificatesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListSslCertificatesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListSslCertificatesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListSslCertificatesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListSslCertificatesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListSslCertificatesHttpRequest) { + ListSslCertificatesHttpRequest that = (ListSslCertificatesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSslPoliciesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSslPoliciesHttpRequest.java new file mode 100644 index 000000000000..ff1727df14a9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSslPoliciesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListSslPoliciesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListSslPoliciesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListSslPoliciesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListSslPoliciesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListSslPoliciesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListSslPoliciesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListSslPoliciesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListSslPoliciesHttpRequest other) { + if (other == ListSslPoliciesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListSslPoliciesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListSslPoliciesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListSslPoliciesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListSslPoliciesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListSslPoliciesHttpRequest) { + ListSslPoliciesHttpRequest that = (ListSslPoliciesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSubnetworksHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSubnetworksHttpRequest.java new file mode 100644 index 000000000000..ee1517a229e4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListSubnetworksHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListSubnetworksHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListSubnetworksHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListSubnetworksHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListSubnetworksHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListSubnetworksHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListSubnetworksHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListSubnetworksHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListSubnetworksHttpRequest other) { + if (other == ListSubnetworksHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListSubnetworksHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListSubnetworksHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListSubnetworksHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListSubnetworksHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListSubnetworksHttpRequest) { + ListSubnetworksHttpRequest that = (ListSubnetworksHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetHttpProxiesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetHttpProxiesHttpRequest.java new file mode 100644 index 000000000000..fe7bf148cdba --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetHttpProxiesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListTargetHttpProxiesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListTargetHttpProxiesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListTargetHttpProxiesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListTargetHttpProxiesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListTargetHttpProxiesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListTargetHttpProxiesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListTargetHttpProxiesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListTargetHttpProxiesHttpRequest other) { + if (other == ListTargetHttpProxiesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListTargetHttpProxiesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListTargetHttpProxiesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListTargetHttpProxiesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListTargetHttpProxiesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListTargetHttpProxiesHttpRequest) { + ListTargetHttpProxiesHttpRequest that = (ListTargetHttpProxiesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetHttpsProxiesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetHttpsProxiesHttpRequest.java new file mode 100644 index 000000000000..7911a4a7f758 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetHttpsProxiesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListTargetHttpsProxiesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListTargetHttpsProxiesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListTargetHttpsProxiesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListTargetHttpsProxiesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListTargetHttpsProxiesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListTargetHttpsProxiesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListTargetHttpsProxiesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListTargetHttpsProxiesHttpRequest other) { + if (other == ListTargetHttpsProxiesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListTargetHttpsProxiesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListTargetHttpsProxiesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListTargetHttpsProxiesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListTargetHttpsProxiesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListTargetHttpsProxiesHttpRequest) { + ListTargetHttpsProxiesHttpRequest that = (ListTargetHttpsProxiesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetInstancesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetInstancesHttpRequest.java new file mode 100644 index 000000000000..643f3ab4322f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetInstancesHttpRequest.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListTargetInstancesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String zone; + + private ListTargetInstancesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.zone = null; + } + + private ListTargetInstancesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListTargetInstancesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListTargetInstancesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListTargetInstancesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListTargetInstancesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(ListTargetInstancesHttpRequest other) { + if (other == ListTargetInstancesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(ListTargetInstancesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public ListTargetInstancesHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListTargetInstancesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListTargetInstancesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListTargetInstancesHttpRequest) { + ListTargetInstancesHttpRequest that = (ListTargetInstancesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetPoolsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetPoolsHttpRequest.java new file mode 100644 index 000000000000..5effff1cc334 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetPoolsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListTargetPoolsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListTargetPoolsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListTargetPoolsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListTargetPoolsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListTargetPoolsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListTargetPoolsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListTargetPoolsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListTargetPoolsHttpRequest other) { + if (other == ListTargetPoolsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListTargetPoolsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListTargetPoolsHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListTargetPoolsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListTargetPoolsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListTargetPoolsHttpRequest) { + ListTargetPoolsHttpRequest that = (ListTargetPoolsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetSslProxiesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetSslProxiesHttpRequest.java new file mode 100644 index 000000000000..eb79d63ca80d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetSslProxiesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListTargetSslProxiesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListTargetSslProxiesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListTargetSslProxiesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListTargetSslProxiesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListTargetSslProxiesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListTargetSslProxiesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListTargetSslProxiesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListTargetSslProxiesHttpRequest other) { + if (other == ListTargetSslProxiesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListTargetSslProxiesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListTargetSslProxiesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListTargetSslProxiesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListTargetSslProxiesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListTargetSslProxiesHttpRequest) { + ListTargetSslProxiesHttpRequest that = (ListTargetSslProxiesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetTcpProxiesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetTcpProxiesHttpRequest.java new file mode 100644 index 000000000000..1f80fe35142d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetTcpProxiesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListTargetTcpProxiesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListTargetTcpProxiesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListTargetTcpProxiesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListTargetTcpProxiesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListTargetTcpProxiesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListTargetTcpProxiesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListTargetTcpProxiesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListTargetTcpProxiesHttpRequest other) { + if (other == ListTargetTcpProxiesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListTargetTcpProxiesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListTargetTcpProxiesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListTargetTcpProxiesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListTargetTcpProxiesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListTargetTcpProxiesHttpRequest) { + ListTargetTcpProxiesHttpRequest that = (ListTargetTcpProxiesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetVpnGatewaysHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetVpnGatewaysHttpRequest.java new file mode 100644 index 000000000000..0e017f6edd2b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListTargetVpnGatewaysHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListTargetVpnGatewaysHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListTargetVpnGatewaysHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListTargetVpnGatewaysHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListTargetVpnGatewaysHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListTargetVpnGatewaysHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListTargetVpnGatewaysHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListTargetVpnGatewaysHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListTargetVpnGatewaysHttpRequest other) { + if (other == ListTargetVpnGatewaysHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListTargetVpnGatewaysHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListTargetVpnGatewaysHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListTargetVpnGatewaysHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListTargetVpnGatewaysHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListTargetVpnGatewaysHttpRequest) { + ListTargetVpnGatewaysHttpRequest that = (ListTargetVpnGatewaysHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListUrlMapsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListUrlMapsHttpRequest.java new file mode 100644 index 000000000000..4173d3714524 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListUrlMapsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListUrlMapsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListUrlMapsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListUrlMapsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListUrlMapsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListUrlMapsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListUrlMapsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListUrlMapsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListUrlMapsHttpRequest other) { + if (other == ListUrlMapsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListUrlMapsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListUrlMapsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListUrlMapsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListUrlMapsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListUrlMapsHttpRequest) { + ListUrlMapsHttpRequest that = (ListUrlMapsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListVpnTunnelsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListVpnTunnelsHttpRequest.java new file mode 100644 index 000000000000..6d1142436e0a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListVpnTunnelsHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListVpnTunnelsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String userIp; + + private ListVpnTunnelsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.userIp = null; + } + + private ListVpnTunnelsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String region, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListVpnTunnelsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListVpnTunnelsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListVpnTunnelsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListVpnTunnelsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String region; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListVpnTunnelsHttpRequest other) { + if (other == ListVpnTunnelsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListVpnTunnelsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListVpnTunnelsHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListVpnTunnelsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListVpnTunnelsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListVpnTunnelsHttpRequest) { + ListVpnTunnelsHttpRequest that = (ListVpnTunnelsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + region, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListXpnHostsProjectsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListXpnHostsProjectsHttpRequest.java new file mode 100644 index 000000000000..c25ffe2c79dd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListXpnHostsProjectsHttpRequest.java @@ -0,0 +1,544 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListXpnHostsProjectsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource; + private final String quotaUser; + private final String userIp; + + private ListXpnHostsProjectsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.projectsListXpnHostsRequestResource = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListXpnHostsProjectsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.projectsListXpnHostsRequestResource = projectsListXpnHostsRequestResource; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("projectsListXpnHostsRequestResource")) { + return projectsListXpnHostsRequestResource; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ProjectsListXpnHostsRequest getApiMessageRequestBody() { + return projectsListXpnHostsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public ProjectsListXpnHostsRequest getProjectsListXpnHostsRequestResource() { + return projectsListXpnHostsRequestResource; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListXpnHostsProjectsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListXpnHostsProjectsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListXpnHostsProjectsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListXpnHostsProjectsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListXpnHostsProjectsHttpRequest other) { + if (other == ListXpnHostsProjectsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getProjectsListXpnHostsRequestResource() != null) { + this.projectsListXpnHostsRequestResource = other.projectsListXpnHostsRequestResource; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListXpnHostsProjectsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.projectsListXpnHostsRequestResource = source.projectsListXpnHostsRequestResource; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public ProjectsListXpnHostsRequest getProjectsListXpnHostsRequestResource() { + return projectsListXpnHostsRequestResource; + } + + public Builder setProjectsListXpnHostsRequestResource( + ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource) { + this.projectsListXpnHostsRequestResource = projectsListXpnHostsRequestResource; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListXpnHostsProjectsHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListXpnHostsProjectsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + projectsListXpnHostsRequestResource, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setProjectsListXpnHostsRequestResource(this.projectsListXpnHostsRequestResource); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListXpnHostsProjectsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "projectsListXpnHostsRequestResource=" + + projectsListXpnHostsRequestResource + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListXpnHostsProjectsHttpRequest) { + ListXpnHostsProjectsHttpRequest that = (ListXpnHostsProjectsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals( + this.projectsListXpnHostsRequestResource, + that.getProjectsListXpnHostsRequestResource()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + projectsListXpnHostsRequestResource, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListZoneOperationsHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListZoneOperationsHttpRequest.java new file mode 100644 index 000000000000..7c6f29c1f4e0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListZoneOperationsHttpRequest.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListZoneOperationsHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String quotaUser; + private final String userIp; + private final String zone; + + private ListZoneOperationsHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.quotaUser = null; + this.userIp = null; + this.zone = null; + } + + private ListZoneOperationsHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String quotaUser, + String userIp, + String zone) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListZoneOperationsHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListZoneOperationsHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListZoneOperationsHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListZoneOperationsHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String quotaUser; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(ListZoneOperationsHttpRequest other) { + if (other == ListZoneOperationsHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(ListZoneOperationsHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public ListZoneOperationsHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListZoneOperationsHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListZoneOperationsHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListZoneOperationsHttpRequest) { + ListZoneOperationsHttpRequest that = (ListZoneOperationsHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + quotaUser, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListZonesHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListZonesHttpRequest.java new file mode 100644 index 000000000000..1c49589566a8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ListZonesHttpRequest.java @@ -0,0 +1,509 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ListZonesHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String filter; + private final String key; + private final Integer maxResults; + private final String orderBy; + private final String pageToken; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String userIp; + + private ListZonesHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.filter = null; + this.key = null; + this.maxResults = null; + this.orderBy = null; + this.pageToken = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.userIp = null; + } + + private ListZonesHttpRequest( + String access_token, + String callback, + String fields, + String filter, + String key, + Integer maxResults, + String orderBy, + String pageToken, + String prettyPrint, + String project, + String quotaUser, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.filter = filter; + this.key = key; + this.maxResults = maxResults; + this.orderBy = orderBy; + this.pageToken = pageToken; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("filter")) { + return filter; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("maxResults")) { + return maxResults; + } + if (fieldName.equals("orderBy")) { + return orderBy; + } + if (fieldName.equals("pageToken")) { + return pageToken; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFilter() { + return filter; + } + + public String getKey() { + return key; + } + + public Integer getMaxResults() { + return maxResults; + } + + public String getOrderBy() { + return orderBy; + } + + public String getPageToken() { + return pageToken; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ListZonesHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ListZonesHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ListZonesHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ListZonesHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String filter; + private String key; + private Integer maxResults; + private String orderBy; + private String pageToken; + private String prettyPrint; + private String project; + private String quotaUser; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ListZonesHttpRequest other) { + if (other == ListZonesHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFilter() != null) { + this.filter = other.filter; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMaxResults() != null) { + this.maxResults = other.maxResults; + } + if (other.getOrderBy() != null) { + this.orderBy = other.orderBy; + } + if (other.getPageToken() != null) { + this.pageToken = other.pageToken; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ListZonesHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.filter = source.filter; + this.key = source.key; + this.maxResults = source.maxResults; + this.orderBy = source.orderBy; + this.pageToken = source.pageToken; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFilter() { + return filter; + } + + public Builder setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Integer getMaxResults() { + return maxResults; + } + + public Builder setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + public String getOrderBy() { + return orderBy; + } + + public Builder setOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + public String getPageToken() { + return pageToken; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ListZonesHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ListZonesHttpRequest( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setFilter(this.filter); + newBuilder.setKey(this.key); + newBuilder.setMaxResults(this.maxResults); + newBuilder.setOrderBy(this.orderBy); + newBuilder.setPageToken(this.pageToken); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ListZonesHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "filter=" + + filter + + ", " + + "key=" + + key + + ", " + + "maxResults=" + + maxResults + + ", " + + "orderBy=" + + orderBy + + ", " + + "pageToken=" + + pageToken + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ListZonesHttpRequest) { + ListZonesHttpRequest that = (ListZonesHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.filter, that.getFilter()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.maxResults, that.getMaxResults()) + && Objects.equals(this.orderBy, that.getOrderBy()) + && Objects.equals(this.pageToken, that.getPageToken()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + filter, + key, + maxResults, + orderBy, + pageToken, + prettyPrint, + project, + quotaUser, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineType.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineType.java new file mode 100644 index 000000000000..1cfb5c318521 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineType.java @@ -0,0 +1,607 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class MachineType implements ApiMessage { + private final String creationTimestamp; + private final DeprecationStatus deprecated; + private final String description; + private final Integer guestCpus; + private final String id; + private final Integer imageSpaceGb; + private final Boolean isSharedCpu; + private final String kind; + private final Integer maximumPersistentDisks; + private final String maximumPersistentDisksSizeGb; + private final Integer memoryMb; + private final String name; + private final List scratchDisks; + private final String selfLink; + private final String zone; + + private MachineType() { + this.creationTimestamp = null; + this.deprecated = null; + this.description = null; + this.guestCpus = null; + this.id = null; + this.imageSpaceGb = null; + this.isSharedCpu = null; + this.kind = null; + this.maximumPersistentDisks = null; + this.maximumPersistentDisksSizeGb = null; + this.memoryMb = null; + this.name = null; + this.scratchDisks = null; + this.selfLink = null; + this.zone = null; + } + + private MachineType( + String creationTimestamp, + DeprecationStatus deprecated, + String description, + Integer guestCpus, + String id, + Integer imageSpaceGb, + Boolean isSharedCpu, + String kind, + Integer maximumPersistentDisks, + String maximumPersistentDisksSizeGb, + Integer memoryMb, + String name, + List scratchDisks, + String selfLink, + String zone) { + this.creationTimestamp = creationTimestamp; + this.deprecated = deprecated; + this.description = description; + this.guestCpus = guestCpus; + this.id = id; + this.imageSpaceGb = imageSpaceGb; + this.isSharedCpu = isSharedCpu; + this.kind = kind; + this.maximumPersistentDisks = maximumPersistentDisks; + this.maximumPersistentDisksSizeGb = maximumPersistentDisksSizeGb; + this.memoryMb = memoryMb; + this.name = name; + this.scratchDisks = scratchDisks; + this.selfLink = selfLink; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("deprecated")) { + return deprecated; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("guestCpus")) { + return guestCpus; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("imageSpaceGb")) { + return imageSpaceGb; + } + if (fieldName.equals("isSharedCpu")) { + return isSharedCpu; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("maximumPersistentDisks")) { + return maximumPersistentDisks; + } + if (fieldName.equals("maximumPersistentDisksSizeGb")) { + return maximumPersistentDisksSizeGb; + } + if (fieldName.equals("memoryMb")) { + return memoryMb; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("scratchDisks")) { + return scratchDisks; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public String getDescription() { + return description; + } + + public Integer getGuestCpus() { + return guestCpus; + } + + public String getId() { + return id; + } + + public Integer getImageSpaceGb() { + return imageSpaceGb; + } + + public Boolean getIsSharedCpu() { + return isSharedCpu; + } + + public String getKind() { + return kind; + } + + public Integer getMaximumPersistentDisks() { + return maximumPersistentDisks; + } + + public String getMaximumPersistentDisksSizeGb() { + return maximumPersistentDisksSizeGb; + } + + public Integer getMemoryMb() { + return memoryMb; + } + + public String getName() { + return name; + } + + public List getScratchDisksList() { + return scratchDisks; + } + + public String getSelfLink() { + return selfLink; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(MachineType prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static MachineType getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final MachineType DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new MachineType(); + } + + public static class Builder { + private String creationTimestamp; + private DeprecationStatus deprecated; + private String description; + private Integer guestCpus; + private String id; + private Integer imageSpaceGb; + private Boolean isSharedCpu; + private String kind; + private Integer maximumPersistentDisks; + private String maximumPersistentDisksSizeGb; + private Integer memoryMb; + private String name; + private List scratchDisks; + private String selfLink; + private String zone; + + Builder() {} + + public Builder mergeFrom(MachineType other) { + if (other == MachineType.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDeprecated() != null) { + this.deprecated = other.deprecated; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getGuestCpus() != null) { + this.guestCpus = other.guestCpus; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getImageSpaceGb() != null) { + this.imageSpaceGb = other.imageSpaceGb; + } + if (other.getIsSharedCpu() != null) { + this.isSharedCpu = other.isSharedCpu; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getMaximumPersistentDisks() != null) { + this.maximumPersistentDisks = other.maximumPersistentDisks; + } + if (other.getMaximumPersistentDisksSizeGb() != null) { + this.maximumPersistentDisksSizeGb = other.maximumPersistentDisksSizeGb; + } + if (other.getMemoryMb() != null) { + this.memoryMb = other.memoryMb; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getScratchDisksList() != null) { + this.scratchDisks = other.scratchDisks; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(MachineType source) { + this.creationTimestamp = source.creationTimestamp; + this.deprecated = source.deprecated; + this.description = source.description; + this.guestCpus = source.guestCpus; + this.id = source.id; + this.imageSpaceGb = source.imageSpaceGb; + this.isSharedCpu = source.isSharedCpu; + this.kind = source.kind; + this.maximumPersistentDisks = source.maximumPersistentDisks; + this.maximumPersistentDisksSizeGb = source.maximumPersistentDisksSizeGb; + this.memoryMb = source.memoryMb; + this.name = source.name; + this.scratchDisks = source.scratchDisks; + this.selfLink = source.selfLink; + this.zone = source.zone; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public Builder setDeprecated(DeprecationStatus deprecated) { + this.deprecated = deprecated; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public Integer getGuestCpus() { + return guestCpus; + } + + public Builder setGuestCpus(Integer guestCpus) { + this.guestCpus = guestCpus; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Integer getImageSpaceGb() { + return imageSpaceGb; + } + + public Builder setImageSpaceGb(Integer imageSpaceGb) { + this.imageSpaceGb = imageSpaceGb; + return this; + } + + public Boolean getIsSharedCpu() { + return isSharedCpu; + } + + public Builder setIsSharedCpu(Boolean isSharedCpu) { + this.isSharedCpu = isSharedCpu; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public Integer getMaximumPersistentDisks() { + return maximumPersistentDisks; + } + + public Builder setMaximumPersistentDisks(Integer maximumPersistentDisks) { + this.maximumPersistentDisks = maximumPersistentDisks; + return this; + } + + public String getMaximumPersistentDisksSizeGb() { + return maximumPersistentDisksSizeGb; + } + + public Builder setMaximumPersistentDisksSizeGb(String maximumPersistentDisksSizeGb) { + this.maximumPersistentDisksSizeGb = maximumPersistentDisksSizeGb; + return this; + } + + public Integer getMemoryMb() { + return memoryMb; + } + + public Builder setMemoryMb(Integer memoryMb) { + this.memoryMb = memoryMb; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public List getScratchDisksList() { + return scratchDisks; + } + + public Builder addAllScratchDisks(List scratchDisks) { + if (this.scratchDisks == null) { + this.scratchDisks = new ArrayList<>(scratchDisks.size()); + } + this.scratchDisks.addAll(scratchDisks); + return this; + } + + public Builder addScratchDisks(ScratchDisks scratchDisks) { + this.scratchDisks.add(scratchDisks); + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public MachineType build() { + + return new MachineType( + creationTimestamp, + deprecated, + description, + guestCpus, + id, + imageSpaceGb, + isSharedCpu, + kind, + maximumPersistentDisks, + maximumPersistentDisksSizeGb, + memoryMb, + name, + scratchDisks, + selfLink, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDeprecated(this.deprecated); + newBuilder.setDescription(this.description); + newBuilder.setGuestCpus(this.guestCpus); + newBuilder.setId(this.id); + newBuilder.setImageSpaceGb(this.imageSpaceGb); + newBuilder.setIsSharedCpu(this.isSharedCpu); + newBuilder.setKind(this.kind); + newBuilder.setMaximumPersistentDisks(this.maximumPersistentDisks); + newBuilder.setMaximumPersistentDisksSizeGb(this.maximumPersistentDisksSizeGb); + newBuilder.setMemoryMb(this.memoryMb); + newBuilder.setName(this.name); + newBuilder.addAllScratchDisks(this.scratchDisks); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "MachineType{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "deprecated=" + + deprecated + + ", " + + "description=" + + description + + ", " + + "guestCpus=" + + guestCpus + + ", " + + "id=" + + id + + ", " + + "imageSpaceGb=" + + imageSpaceGb + + ", " + + "isSharedCpu=" + + isSharedCpu + + ", " + + "kind=" + + kind + + ", " + + "maximumPersistentDisks=" + + maximumPersistentDisks + + ", " + + "maximumPersistentDisksSizeGb=" + + maximumPersistentDisksSizeGb + + ", " + + "memoryMb=" + + memoryMb + + ", " + + "name=" + + name + + ", " + + "scratchDisks=" + + scratchDisks + + ", " + + "selfLink=" + + selfLink + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof MachineType) { + MachineType that = (MachineType) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.deprecated, that.getDeprecated()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.guestCpus, that.getGuestCpus()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.imageSpaceGb, that.getImageSpaceGb()) + && Objects.equals(this.isSharedCpu, that.getIsSharedCpu()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.maximumPersistentDisks, that.getMaximumPersistentDisks()) + && Objects.equals( + this.maximumPersistentDisksSizeGb, that.getMaximumPersistentDisksSizeGb()) + && Objects.equals(this.memoryMb, that.getMemoryMb()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.scratchDisks, that.getScratchDisksList()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + deprecated, + description, + guestCpus, + id, + imageSpaceGb, + isSharedCpu, + kind, + maximumPersistentDisks, + maximumPersistentDisksSizeGb, + memoryMb, + name, + scratchDisks, + selfLink, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeAggregatedList.java new file mode 100644 index 000000000000..2aea9edf43de --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class MachineTypeAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private MachineTypeAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private MachineTypeAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(MachineTypeAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static MachineTypeAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final MachineTypeAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new MachineTypeAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(MachineTypeAggregatedList other) { + if (other == MachineTypeAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(MachineTypeAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public MachineTypeAggregatedList build() { + + return new MachineTypeAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "MachineTypeAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof MachineTypeAggregatedList) { + MachineTypeAggregatedList that = (MachineTypeAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeClient.java new file mode 100644 index 000000000000..7e9e700554a0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeClient.java @@ -0,0 +1,726 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.MachineTypeStub; +import com.google.cloud.compute.v1.stub.MachineTypeStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+ *   ProjectZoneMachineTypeName machineType = ProjectZoneMachineTypeName.of("[PROJECT]", "[ZONE]", "[MACHINE_TYPE]");
+ *   MachineType response = machineTypeClient.getMachineType(machineType);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the machineTypeClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of MachineTypeSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * MachineTypeSettings machineTypeSettings =
+ *     MachineTypeSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * MachineTypeClient machineTypeClient =
+ *     MachineTypeClient.create(machineTypeSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * MachineTypeSettings machineTypeSettings =
+ *     MachineTypeSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * MachineTypeClient machineTypeClient =
+ *     MachineTypeClient.create(machineTypeSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class MachineTypeClient implements BackgroundResource { + private final MachineTypeSettings settings; + private final MachineTypeStub stub; + + /** Constructs an instance of MachineTypeClient with default settings. */ + public static final MachineTypeClient create() throws IOException { + return create(MachineTypeSettings.newBuilder().build()); + } + + /** + * Constructs an instance of MachineTypeClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final MachineTypeClient create(MachineTypeSettings settings) throws IOException { + return new MachineTypeClient(settings); + } + + /** + * Constructs an instance of MachineTypeClient, using the given stub for making calls. This is for + * advanced usage - prefer to use MachineTypeSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final MachineTypeClient create(MachineTypeStub stub) { + return new MachineTypeClient(stub); + } + + /** + * Constructs an instance of MachineTypeClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected MachineTypeClient(MachineTypeSettings settings) throws IOException { + this.settings = settings; + this.stub = ((MachineTypeStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected MachineTypeClient(MachineTypeStub stub) { + this.settings = null; + this.stub = stub; + } + + public final MachineTypeSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public MachineTypeStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of machine types. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (MachineTypesScopedList element : machineTypeClient.aggregatedListMachineTypes(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListMachineTypesPagedResponse aggregatedListMachineTypes( + ProjectName project) { + AggregatedListMachineTypesHttpRequest request = + AggregatedListMachineTypesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListMachineTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of machine types. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (MachineTypesScopedList element : machineTypeClient.aggregatedListMachineTypes(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListMachineTypesPagedResponse aggregatedListMachineTypes(String project) { + AggregatedListMachineTypesHttpRequest request = + AggregatedListMachineTypesHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListMachineTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of machine types. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListMachineTypesHttpRequest request = AggregatedListMachineTypesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (MachineTypesScopedList element : machineTypeClient.aggregatedListMachineTypes(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListMachineTypesPagedResponse aggregatedListMachineTypes( + AggregatedListMachineTypesHttpRequest request) { + return aggregatedListMachineTypesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of machine types. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListMachineTypesHttpRequest request = AggregatedListMachineTypesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListMachineTypesPagedResponse> future = machineTypeClient.aggregatedListMachineTypesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (MachineTypesScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListMachineTypesHttpRequest, AggregatedListMachineTypesPagedResponse> + aggregatedListMachineTypesPagedCallable() { + return stub.aggregatedListMachineTypesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of machine types. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListMachineTypesHttpRequest request = AggregatedListMachineTypesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     MachineTypeAggregatedList response = machineTypeClient.aggregatedListMachineTypesCallable().call(request);
+   *     for (MachineTypesScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListMachineTypesCallable() { + return stub.aggregatedListMachineTypesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified machine type. Gets a list of available machine types by making a list() + * request. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectZoneMachineTypeName machineType = ProjectZoneMachineTypeName.of("[PROJECT]", "[ZONE]", "[MACHINE_TYPE]");
+   *   MachineType response = machineTypeClient.getMachineType(machineType);
+   * }
+   * 
+ * + * @param machineType Name of the machine type to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final MachineType getMachineType(ProjectZoneMachineTypeName machineType) { + + GetMachineTypeHttpRequest request = + GetMachineTypeHttpRequest.newBuilder() + .setMachineType(machineType == null ? null : machineType.toString()) + .build(); + return getMachineType(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified machine type. Gets a list of available machine types by making a list() + * request. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectZoneMachineTypeName machineType = ProjectZoneMachineTypeName.of("[PROJECT]", "[ZONE]", "[MACHINE_TYPE]");
+   *   MachineType response = machineTypeClient.getMachineType(machineType.toString());
+   * }
+   * 
+ * + * @param machineType Name of the machine type to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final MachineType getMachineType(String machineType) { + + GetMachineTypeHttpRequest request = + GetMachineTypeHttpRequest.newBuilder().setMachineType(machineType).build(); + return getMachineType(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified machine type. Gets a list of available machine types by making a list() + * request. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectZoneMachineTypeName machineType = ProjectZoneMachineTypeName.of("[PROJECT]", "[ZONE]", "[MACHINE_TYPE]");
+   *   GetMachineTypeHttpRequest request = GetMachineTypeHttpRequest.newBuilder()
+   *     .setMachineType(machineType.toString())
+   *     .build();
+   *   MachineType response = machineTypeClient.getMachineType(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final MachineType getMachineType(GetMachineTypeHttpRequest request) { + return getMachineTypeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified machine type. Gets a list of available machine types by making a list() + * request. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectZoneMachineTypeName machineType = ProjectZoneMachineTypeName.of("[PROJECT]", "[ZONE]", "[MACHINE_TYPE]");
+   *   GetMachineTypeHttpRequest request = GetMachineTypeHttpRequest.newBuilder()
+   *     .setMachineType(machineType.toString())
+   *     .build();
+   *   ApiFuture<MachineType> future = machineTypeClient.getMachineTypeCallable().futureCall(request);
+   *   // Do something
+   *   MachineType response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getMachineTypeCallable() { + return stub.getMachineTypeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of machine types available to the specified project. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (MachineType element : machineTypeClient.listMachineTypes(zone).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListMachineTypesPagedResponse listMachineTypes(ProjectZoneName zone) { + ListMachineTypesHttpRequest request = + ListMachineTypesHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .build(); + return listMachineTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of machine types available to the specified project. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (MachineType element : machineTypeClient.listMachineTypes(zone.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone The name of the zone for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListMachineTypesPagedResponse listMachineTypes(String zone) { + ListMachineTypesHttpRequest request = + ListMachineTypesHttpRequest.newBuilder().setZone(zone).build(); + return listMachineTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of machine types available to the specified project. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListMachineTypesHttpRequest request = ListMachineTypesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   for (MachineType element : machineTypeClient.listMachineTypes(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListMachineTypesPagedResponse listMachineTypes(ListMachineTypesHttpRequest request) { + return listMachineTypesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of machine types available to the specified project. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListMachineTypesHttpRequest request = ListMachineTypesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   ApiFuture<ListMachineTypesPagedResponse> future = machineTypeClient.listMachineTypesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (MachineType element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listMachineTypesPagedCallable() { + return stub.listMachineTypesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of machine types available to the specified project. + * + *

Sample code: + * + *


+   * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListMachineTypesHttpRequest request = ListMachineTypesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   while (true) {
+   *     MachineTypeList response = machineTypeClient.listMachineTypesCallable().call(request);
+   *     for (MachineType element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listMachineTypesCallable() { + return stub.listMachineTypesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListMachineTypesPagedResponse + extends AbstractPagedListResponse< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, MachineTypesScopedList, + AggregatedListMachineTypesPage, AggregatedListMachineTypesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + MachineTypesScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListMachineTypesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + AggregatedListMachineTypesPage, AggregatedListMachineTypesPagedResponse>() { + @Override + public AggregatedListMachineTypesPagedResponse apply( + AggregatedListMachineTypesPage input) { + return new AggregatedListMachineTypesPagedResponse(input); + } + }); + } + + private AggregatedListMachineTypesPagedResponse(AggregatedListMachineTypesPage page) { + super(page, AggregatedListMachineTypesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListMachineTypesPage + extends AbstractPage< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, MachineTypesScopedList, + AggregatedListMachineTypesPage> { + + private AggregatedListMachineTypesPage( + PageContext< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + MachineTypesScopedList> + context, + MachineTypeAggregatedList response) { + super(context, response); + } + + private static AggregatedListMachineTypesPage createEmptyPage() { + return new AggregatedListMachineTypesPage(null, null); + } + + @Override + protected AggregatedListMachineTypesPage createPage( + PageContext< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + MachineTypesScopedList> + context, + MachineTypeAggregatedList response) { + return new AggregatedListMachineTypesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + MachineTypesScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListMachineTypesFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, MachineTypesScopedList, + AggregatedListMachineTypesPage, AggregatedListMachineTypesFixedSizeCollection> { + + private AggregatedListMachineTypesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListMachineTypesFixedSizeCollection createEmptyCollection() { + return new AggregatedListMachineTypesFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListMachineTypesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListMachineTypesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListMachineTypesPagedResponse + extends AbstractPagedListResponse< + ListMachineTypesHttpRequest, MachineTypeList, MachineType, ListMachineTypesPage, + ListMachineTypesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListMachineTypesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListMachineTypesPagedResponse apply(ListMachineTypesPage input) { + return new ListMachineTypesPagedResponse(input); + } + }); + } + + private ListMachineTypesPagedResponse(ListMachineTypesPage page) { + super(page, ListMachineTypesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListMachineTypesPage + extends AbstractPage< + ListMachineTypesHttpRequest, MachineTypeList, MachineType, ListMachineTypesPage> { + + private ListMachineTypesPage( + PageContext context, + MachineTypeList response) { + super(context, response); + } + + private static ListMachineTypesPage createEmptyPage() { + return new ListMachineTypesPage(null, null); + } + + @Override + protected ListMachineTypesPage createPage( + PageContext context, + MachineTypeList response) { + return new ListMachineTypesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListMachineTypesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListMachineTypesHttpRequest, MachineTypeList, MachineType, ListMachineTypesPage, + ListMachineTypesFixedSizeCollection> { + + private ListMachineTypesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListMachineTypesFixedSizeCollection createEmptyCollection() { + return new ListMachineTypesFixedSizeCollection(null, 0); + } + + @Override + protected ListMachineTypesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListMachineTypesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeList.java new file mode 100644 index 000000000000..e0fe295eb4bb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class MachineTypeList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private MachineTypeList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private MachineTypeList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(MachineTypeList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static MachineTypeList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final MachineTypeList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new MachineTypeList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(MachineTypeList other) { + if (other == MachineTypeList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(MachineTypeList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(MachineType items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public MachineTypeList build() { + + return new MachineTypeList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "MachineTypeList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof MachineTypeList) { + MachineTypeList that = (MachineTypeList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeSettings.java new file mode 100644 index 000000000000..2d056103b652 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypeSettings.java @@ -0,0 +1,214 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.MachineTypeClient.AggregatedListMachineTypesPagedResponse; +import static com.google.cloud.compute.v1.MachineTypeClient.ListMachineTypesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.MachineTypeStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link MachineTypeClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getMachineType to 30 seconds: + * + *

+ * 
+ * MachineTypeSettings.Builder machineTypeSettingsBuilder =
+ *     MachineTypeSettings.newBuilder();
+ * machineTypeSettingsBuilder.getMachineTypeSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * MachineTypeSettings machineTypeSettings = machineTypeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class MachineTypeSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListMachineTypes. */ + public PagedCallSettings< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + AggregatedListMachineTypesPagedResponse> + aggregatedListMachineTypesSettings() { + return ((MachineTypeStubSettings) getStubSettings()).aggregatedListMachineTypesSettings(); + } + + /** Returns the object with the settings used for calls to getMachineType. */ + public UnaryCallSettings getMachineTypeSettings() { + return ((MachineTypeStubSettings) getStubSettings()).getMachineTypeSettings(); + } + + /** Returns the object with the settings used for calls to listMachineTypes. */ + public PagedCallSettings< + ListMachineTypesHttpRequest, MachineTypeList, ListMachineTypesPagedResponse> + listMachineTypesSettings() { + return ((MachineTypeStubSettings) getStubSettings()).listMachineTypesSettings(); + } + + public static final MachineTypeSettings create(MachineTypeStubSettings stub) throws IOException { + return new MachineTypeSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return MachineTypeStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return MachineTypeStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return MachineTypeStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return MachineTypeStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return MachineTypeStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return MachineTypeStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return MachineTypeStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return MachineTypeStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected MachineTypeSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for MachineTypeSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(MachineTypeStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(MachineTypeStubSettings.newBuilder()); + } + + protected Builder(MachineTypeSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(MachineTypeStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public MachineTypeStubSettings.Builder getStubSettingsBuilder() { + return ((MachineTypeStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListMachineTypes. */ + public PagedCallSettings.Builder< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + AggregatedListMachineTypesPagedResponse> + aggregatedListMachineTypesSettings() { + return getStubSettingsBuilder().aggregatedListMachineTypesSettings(); + } + + /** Returns the builder for the settings used for calls to getMachineType. */ + public UnaryCallSettings.Builder + getMachineTypeSettings() { + return getStubSettingsBuilder().getMachineTypeSettings(); + } + + /** Returns the builder for the settings used for calls to listMachineTypes. */ + public PagedCallSettings.Builder< + ListMachineTypesHttpRequest, MachineTypeList, ListMachineTypesPagedResponse> + listMachineTypesSettings() { + return getStubSettingsBuilder().listMachineTypesSettings(); + } + + @Override + public MachineTypeSettings build() throws IOException { + return new MachineTypeSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypesScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypesScopedList.java new file mode 100644 index 000000000000..e9508a1838d6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MachineTypesScopedList.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class MachineTypesScopedList implements ApiMessage { + private final List machineTypes; + private final Warning warning; + + private MachineTypesScopedList() { + this.machineTypes = null; + this.warning = null; + } + + private MachineTypesScopedList(List machineTypes, Warning warning) { + this.machineTypes = machineTypes; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("machineTypes")) { + return machineTypes; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getMachineTypesList() { + return machineTypes; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(MachineTypesScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static MachineTypesScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final MachineTypesScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new MachineTypesScopedList(); + } + + public static class Builder { + private List machineTypes; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(MachineTypesScopedList other) { + if (other == MachineTypesScopedList.getDefaultInstance()) return this; + if (other.getMachineTypesList() != null) { + this.machineTypes = other.machineTypes; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(MachineTypesScopedList source) { + this.machineTypes = source.machineTypes; + this.warning = source.warning; + } + + public List getMachineTypesList() { + return machineTypes; + } + + public Builder addAllMachineTypes(List machineTypes) { + if (this.machineTypes == null) { + this.machineTypes = new ArrayList<>(machineTypes.size()); + } + this.machineTypes.addAll(machineTypes); + return this; + } + + public Builder addMachineTypes(MachineType machineTypes) { + this.machineTypes.add(machineTypes); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public MachineTypesScopedList build() { + + return new MachineTypesScopedList(machineTypes, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllMachineTypes(this.machineTypes); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "MachineTypesScopedList{" + + "machineTypes=" + + machineTypes + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof MachineTypesScopedList) { + MachineTypesScopedList that = (MachineTypesScopedList) o; + return Objects.equals(this.machineTypes, that.getMachineTypesList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(machineTypes, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ManagedInstance.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ManagedInstance.java new file mode 100644 index 000000000000..29e6d18ac983 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ManagedInstance.java @@ -0,0 +1,267 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ManagedInstance implements ApiMessage { + private final String currentAction; + private final String id; + private final String instance; + private final String instanceStatus; + private final ManagedInstanceLastAttempt lastAttempt; + + private ManagedInstance() { + this.currentAction = null; + this.id = null; + this.instance = null; + this.instanceStatus = null; + this.lastAttempt = null; + } + + private ManagedInstance( + String currentAction, + String id, + String instance, + String instanceStatus, + ManagedInstanceLastAttempt lastAttempt) { + this.currentAction = currentAction; + this.id = id; + this.instance = instance; + this.instanceStatus = instanceStatus; + this.lastAttempt = lastAttempt; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("currentAction")) { + return currentAction; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("instanceStatus")) { + return instanceStatus; + } + if (fieldName.equals("lastAttempt")) { + return lastAttempt; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCurrentAction() { + return currentAction; + } + + public String getId() { + return id; + } + + public String getInstance() { + return instance; + } + + public String getInstanceStatus() { + return instanceStatus; + } + + public ManagedInstanceLastAttempt getLastAttempt() { + return lastAttempt; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ManagedInstance prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ManagedInstance getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ManagedInstance DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ManagedInstance(); + } + + public static class Builder { + private String currentAction; + private String id; + private String instance; + private String instanceStatus; + private ManagedInstanceLastAttempt lastAttempt; + + Builder() {} + + public Builder mergeFrom(ManagedInstance other) { + if (other == ManagedInstance.getDefaultInstance()) return this; + if (other.getCurrentAction() != null) { + this.currentAction = other.currentAction; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getInstanceStatus() != null) { + this.instanceStatus = other.instanceStatus; + } + if (other.getLastAttempt() != null) { + this.lastAttempt = other.lastAttempt; + } + return this; + } + + Builder(ManagedInstance source) { + this.currentAction = source.currentAction; + this.id = source.id; + this.instance = source.instance; + this.instanceStatus = source.instanceStatus; + this.lastAttempt = source.lastAttempt; + } + + public String getCurrentAction() { + return currentAction; + } + + public Builder setCurrentAction(String currentAction) { + this.currentAction = currentAction; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getInstanceStatus() { + return instanceStatus; + } + + public Builder setInstanceStatus(String instanceStatus) { + this.instanceStatus = instanceStatus; + return this; + } + + public ManagedInstanceLastAttempt getLastAttempt() { + return lastAttempt; + } + + public Builder setLastAttempt(ManagedInstanceLastAttempt lastAttempt) { + this.lastAttempt = lastAttempt; + return this; + } + + public ManagedInstance build() { + + return new ManagedInstance(currentAction, id, instance, instanceStatus, lastAttempt); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCurrentAction(this.currentAction); + newBuilder.setId(this.id); + newBuilder.setInstance(this.instance); + newBuilder.setInstanceStatus(this.instanceStatus); + newBuilder.setLastAttempt(this.lastAttempt); + return newBuilder; + } + } + + @Override + public String toString() { + return "ManagedInstance{" + + "currentAction=" + + currentAction + + ", " + + "id=" + + id + + ", " + + "instance=" + + instance + + ", " + + "instanceStatus=" + + instanceStatus + + ", " + + "lastAttempt=" + + lastAttempt + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ManagedInstance) { + ManagedInstance that = (ManagedInstance) o; + return Objects.equals(this.currentAction, that.getCurrentAction()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.instanceStatus, that.getInstanceStatus()) + && Objects.equals(this.lastAttempt, that.getLastAttempt()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(currentAction, id, instance, instanceStatus, lastAttempt); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ManagedInstanceLastAttempt.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ManagedInstanceLastAttempt.java new file mode 100644 index 000000000000..a6c4ddf12359 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ManagedInstanceLastAttempt.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ManagedInstanceLastAttempt implements ApiMessage { + private final Errors errors; + + private ManagedInstanceLastAttempt() { + this.errors = null; + } + + private ManagedInstanceLastAttempt(Errors errors) { + this.errors = errors; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("errors")) { + return errors; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Errors getErrors() { + return errors; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ManagedInstanceLastAttempt prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ManagedInstanceLastAttempt getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ManagedInstanceLastAttempt DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ManagedInstanceLastAttempt(); + } + + public static class Builder { + private Errors errors; + + Builder() {} + + public Builder mergeFrom(ManagedInstanceLastAttempt other) { + if (other == ManagedInstanceLastAttempt.getDefaultInstance()) return this; + if (other.getErrors() != null) { + this.errors = other.errors; + } + return this; + } + + Builder(ManagedInstanceLastAttempt source) { + this.errors = source.errors; + } + + public Errors getErrors() { + return errors; + } + + public Builder setErrors(Errors errors) { + this.errors = errors; + return this; + } + + public ManagedInstanceLastAttempt build() { + return new ManagedInstanceLastAttempt(errors); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setErrors(this.errors); + return newBuilder; + } + } + + @Override + public String toString() { + return "ManagedInstanceLastAttempt{" + "errors=" + errors + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ManagedInstanceLastAttempt) { + ManagedInstanceLastAttempt that = (ManagedInstanceLastAttempt) o; + return Objects.equals(this.errors, that.getErrors()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(errors); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Metadata.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Metadata.java new file mode 100644 index 000000000000..df0f5847fa27 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Metadata.java @@ -0,0 +1,213 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Metadata implements ApiMessage { + private final String fingerprint; + private final List items; + private final String kind; + + private Metadata() { + this.fingerprint = null; + this.items = null; + this.kind = null; + } + + private Metadata(String fingerprint, List items, String kind) { + this.fingerprint = fingerprint; + this.items = items; + this.kind = kind; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getFingerprint() { + return fingerprint; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Metadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Metadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Metadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Metadata(); + } + + public static class Builder { + private String fingerprint; + private List items; + private String kind; + + Builder() {} + + public Builder mergeFrom(Metadata other) { + if (other == Metadata.getDefaultInstance()) return this; + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + return this; + } + + Builder(Metadata source) { + this.fingerprint = source.fingerprint; + this.items = source.items; + this.kind = source.kind; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Items items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public Metadata build() { + + return new Metadata(fingerprint, items, kind); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + return newBuilder; + } + } + + @Override + public String toString() { + return "Metadata{" + + "fingerprint=" + + fingerprint + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Metadata) { + Metadata that = (Metadata) o; + return Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(fingerprint, items, kind); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MoveDiskProjectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MoveDiskProjectHttpRequest.java new file mode 100644 index 000000000000..c95d807b2326 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MoveDiskProjectHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class MoveDiskProjectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final DiskMoveRequest diskMoveRequestResource; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private MoveDiskProjectHttpRequest() { + this.access_token = null; + this.callback = null; + this.diskMoveRequestResource = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private MoveDiskProjectHttpRequest( + String access_token, + String callback, + DiskMoveRequest diskMoveRequestResource, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.diskMoveRequestResource = diskMoveRequestResource; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("diskMoveRequestResource")) { + return diskMoveRequestResource; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public DiskMoveRequest getApiMessageRequestBody() { + return diskMoveRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public DiskMoveRequest getDiskMoveRequestResource() { + return diskMoveRequestResource; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(MoveDiskProjectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static MoveDiskProjectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final MoveDiskProjectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new MoveDiskProjectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private DiskMoveRequest diskMoveRequestResource; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(MoveDiskProjectHttpRequest other) { + if (other == MoveDiskProjectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDiskMoveRequestResource() != null) { + this.diskMoveRequestResource = other.diskMoveRequestResource; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(MoveDiskProjectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.diskMoveRequestResource = source.diskMoveRequestResource; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public DiskMoveRequest getDiskMoveRequestResource() { + return diskMoveRequestResource; + } + + public Builder setDiskMoveRequestResource(DiskMoveRequest diskMoveRequestResource) { + this.diskMoveRequestResource = diskMoveRequestResource; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public MoveDiskProjectHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new MoveDiskProjectHttpRequest( + access_token, + callback, + diskMoveRequestResource, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDiskMoveRequestResource(this.diskMoveRequestResource); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "MoveDiskProjectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "diskMoveRequestResource=" + + diskMoveRequestResource + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof MoveDiskProjectHttpRequest) { + MoveDiskProjectHttpRequest that = (MoveDiskProjectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.diskMoveRequestResource, that.getDiskMoveRequestResource()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + diskMoveRequestResource, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MoveInstanceProjectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MoveInstanceProjectHttpRequest.java new file mode 100644 index 000000000000..63cd98cdf273 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/MoveInstanceProjectHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class MoveInstanceProjectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final InstanceMoveRequest instanceMoveRequestResource; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private MoveInstanceProjectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceMoveRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private MoveInstanceProjectHttpRequest( + String access_token, + String callback, + String fields, + InstanceMoveRequest instanceMoveRequestResource, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceMoveRequestResource = instanceMoveRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceMoveRequestResource")) { + return instanceMoveRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceMoveRequest getApiMessageRequestBody() { + return instanceMoveRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public InstanceMoveRequest getInstanceMoveRequestResource() { + return instanceMoveRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(MoveInstanceProjectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static MoveInstanceProjectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final MoveInstanceProjectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new MoveInstanceProjectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private InstanceMoveRequest instanceMoveRequestResource; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(MoveInstanceProjectHttpRequest other) { + if (other == MoveInstanceProjectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceMoveRequestResource() != null) { + this.instanceMoveRequestResource = other.instanceMoveRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(MoveInstanceProjectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceMoveRequestResource = source.instanceMoveRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public InstanceMoveRequest getInstanceMoveRequestResource() { + return instanceMoveRequestResource; + } + + public Builder setInstanceMoveRequestResource(InstanceMoveRequest instanceMoveRequestResource) { + this.instanceMoveRequestResource = instanceMoveRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public MoveInstanceProjectHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new MoveInstanceProjectHttpRequest( + access_token, + callback, + fields, + instanceMoveRequestResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceMoveRequestResource(this.instanceMoveRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "MoveInstanceProjectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceMoveRequestResource=" + + instanceMoveRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof MoveInstanceProjectHttpRequest) { + MoveInstanceProjectHttpRequest that = (MoveInstanceProjectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceMoveRequestResource, that.getInstanceMoveRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceMoveRequestResource, + key, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NamedPort.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NamedPort.java new file mode 100644 index 000000000000..00a11aaee175 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NamedPort.java @@ -0,0 +1,168 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class NamedPort implements ApiMessage { + private final String name; + private final Integer port; + + private NamedPort() { + this.name = null; + this.port = null; + } + + private NamedPort(String name, Integer port) { + this.name = name; + this.port = port; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("port")) { + return port; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getName() { + return name; + } + + public Integer getPort() { + return port; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(NamedPort prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static NamedPort getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final NamedPort DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new NamedPort(); + } + + public static class Builder { + private String name; + private Integer port; + + Builder() {} + + public Builder mergeFrom(NamedPort other) { + if (other == NamedPort.getDefaultInstance()) return this; + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPort() != null) { + this.port = other.port; + } + return this; + } + + Builder(NamedPort source) { + this.name = source.name; + this.port = source.port; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Integer getPort() { + return port; + } + + public Builder setPort(Integer port) { + this.port = port; + return this; + } + + public NamedPort build() { + + return new NamedPort(name, port); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setName(this.name); + newBuilder.setPort(this.port); + return newBuilder; + } + } + + @Override + public String toString() { + return "NamedPort{" + "name=" + name + ", " + "port=" + port + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof NamedPort) { + NamedPort that = (NamedPort) o; + return Objects.equals(this.name, that.getName()) && Objects.equals(this.port, that.getPort()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(name, port); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Network.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Network.java new file mode 100644 index 000000000000..4ce606f5aa81 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Network.java @@ -0,0 +1,518 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Network implements ApiMessage { + private final Boolean autoCreateSubnetworks; + private final String creationTimestamp; + private final String description; + private final String gatewayIPv4; + private final String iPv4Range; + private final String id; + private final String kind; + private final String name; + private final List peerings; + private final NetworkRoutingConfig routingConfig; + private final String selfLink; + private final List subnetworks; + + private Network() { + this.autoCreateSubnetworks = null; + this.creationTimestamp = null; + this.description = null; + this.gatewayIPv4 = null; + this.iPv4Range = null; + this.id = null; + this.kind = null; + this.name = null; + this.peerings = null; + this.routingConfig = null; + this.selfLink = null; + this.subnetworks = null; + } + + private Network( + Boolean autoCreateSubnetworks, + String creationTimestamp, + String description, + String gatewayIPv4, + String iPv4Range, + String id, + String kind, + String name, + List peerings, + NetworkRoutingConfig routingConfig, + String selfLink, + List subnetworks) { + this.autoCreateSubnetworks = autoCreateSubnetworks; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.gatewayIPv4 = gatewayIPv4; + this.iPv4Range = iPv4Range; + this.id = id; + this.kind = kind; + this.name = name; + this.peerings = peerings; + this.routingConfig = routingConfig; + this.selfLink = selfLink; + this.subnetworks = subnetworks; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("autoCreateSubnetworks")) { + return autoCreateSubnetworks; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("gatewayIPv4")) { + return gatewayIPv4; + } + if (fieldName.equals("iPv4Range")) { + return iPv4Range; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("peerings")) { + return peerings; + } + if (fieldName.equals("routingConfig")) { + return routingConfig; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("subnetworks")) { + return subnetworks; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getAutoCreateSubnetworks() { + return autoCreateSubnetworks; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getGatewayIPv4() { + return gatewayIPv4; + } + + public String getIPv4Range() { + return iPv4Range; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public List getPeeringsList() { + return peerings; + } + + public NetworkRoutingConfig getRoutingConfig() { + return routingConfig; + } + + public String getSelfLink() { + return selfLink; + } + + public List getSubnetworksList() { + return subnetworks; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Network prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Network getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Network DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Network(); + } + + public static class Builder { + private Boolean autoCreateSubnetworks; + private String creationTimestamp; + private String description; + private String gatewayIPv4; + private String iPv4Range; + private String id; + private String kind; + private String name; + private List peerings; + private NetworkRoutingConfig routingConfig; + private String selfLink; + private List subnetworks; + + Builder() {} + + public Builder mergeFrom(Network other) { + if (other == Network.getDefaultInstance()) return this; + if (other.getAutoCreateSubnetworks() != null) { + this.autoCreateSubnetworks = other.autoCreateSubnetworks; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getGatewayIPv4() != null) { + this.gatewayIPv4 = other.gatewayIPv4; + } + if (other.getIPv4Range() != null) { + this.iPv4Range = other.iPv4Range; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPeeringsList() != null) { + this.peerings = other.peerings; + } + if (other.getRoutingConfig() != null) { + this.routingConfig = other.routingConfig; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSubnetworksList() != null) { + this.subnetworks = other.subnetworks; + } + return this; + } + + Builder(Network source) { + this.autoCreateSubnetworks = source.autoCreateSubnetworks; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.gatewayIPv4 = source.gatewayIPv4; + this.iPv4Range = source.iPv4Range; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.peerings = source.peerings; + this.routingConfig = source.routingConfig; + this.selfLink = source.selfLink; + this.subnetworks = source.subnetworks; + } + + public Boolean getAutoCreateSubnetworks() { + return autoCreateSubnetworks; + } + + public Builder setAutoCreateSubnetworks(Boolean autoCreateSubnetworks) { + this.autoCreateSubnetworks = autoCreateSubnetworks; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getGatewayIPv4() { + return gatewayIPv4; + } + + public Builder setGatewayIPv4(String gatewayIPv4) { + this.gatewayIPv4 = gatewayIPv4; + return this; + } + + public String getIPv4Range() { + return iPv4Range; + } + + public Builder setIPv4Range(String iPv4Range) { + this.iPv4Range = iPv4Range; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public List getPeeringsList() { + return peerings; + } + + public Builder addAllPeerings(List peerings) { + if (this.peerings == null) { + this.peerings = new ArrayList<>(peerings.size()); + } + this.peerings.addAll(peerings); + return this; + } + + public Builder addPeerings(NetworkPeering peerings) { + this.peerings.add(peerings); + return this; + } + + public NetworkRoutingConfig getRoutingConfig() { + return routingConfig; + } + + public Builder setRoutingConfig(NetworkRoutingConfig routingConfig) { + this.routingConfig = routingConfig; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public List getSubnetworksList() { + return subnetworks; + } + + public Builder addAllSubnetworks(List subnetworks) { + if (this.subnetworks == null) { + this.subnetworks = new ArrayList<>(subnetworks.size()); + } + this.subnetworks.addAll(subnetworks); + return this; + } + + public Builder addSubnetworks(String subnetworks) { + this.subnetworks.add(subnetworks); + return this; + } + + public Network build() { + + return new Network( + autoCreateSubnetworks, + creationTimestamp, + description, + gatewayIPv4, + iPv4Range, + id, + kind, + name, + peerings, + routingConfig, + selfLink, + subnetworks); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAutoCreateSubnetworks(this.autoCreateSubnetworks); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setGatewayIPv4(this.gatewayIPv4); + newBuilder.setIPv4Range(this.iPv4Range); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.addAllPeerings(this.peerings); + newBuilder.setRoutingConfig(this.routingConfig); + newBuilder.setSelfLink(this.selfLink); + newBuilder.addAllSubnetworks(this.subnetworks); + return newBuilder; + } + } + + @Override + public String toString() { + return "Network{" + + "autoCreateSubnetworks=" + + autoCreateSubnetworks + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "gatewayIPv4=" + + gatewayIPv4 + + ", " + + "iPv4Range=" + + iPv4Range + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "peerings=" + + peerings + + ", " + + "routingConfig=" + + routingConfig + + ", " + + "selfLink=" + + selfLink + + ", " + + "subnetworks=" + + subnetworks + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Network) { + Network that = (Network) o; + return Objects.equals(this.autoCreateSubnetworks, that.getAutoCreateSubnetworks()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.gatewayIPv4, that.getGatewayIPv4()) + && Objects.equals(this.iPv4Range, that.getIPv4Range()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.peerings, that.getPeeringsList()) + && Objects.equals(this.routingConfig, that.getRoutingConfig()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.subnetworks, that.getSubnetworksList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + autoCreateSubnetworks, + creationTimestamp, + description, + gatewayIPv4, + iPv4Range, + id, + kind, + name, + peerings, + routingConfig, + selfLink, + subnetworks); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkClient.java new file mode 100644 index 000000000000..d32a0201db26 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkClient.java @@ -0,0 +1,1132 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.NetworkStub; +import com.google.cloud.compute.v1.stub.NetworkStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (NetworkClient networkClient = NetworkClient.create()) {
+ *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+ *   NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
+ *   Operation response = networkClient.addPeeringNetwork(network, networksAddPeeringRequestResource);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the networkClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of NetworkSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * NetworkSettings networkSettings =
+ *     NetworkSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * NetworkClient networkClient =
+ *     NetworkClient.create(networkSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * NetworkSettings networkSettings =
+ *     NetworkSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * NetworkClient networkClient =
+ *     NetworkClient.create(networkSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class NetworkClient implements BackgroundResource { + private final NetworkSettings settings; + private final NetworkStub stub; + + /** Constructs an instance of NetworkClient with default settings. */ + public static final NetworkClient create() throws IOException { + return create(NetworkSettings.newBuilder().build()); + } + + /** + * Constructs an instance of NetworkClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final NetworkClient create(NetworkSettings settings) throws IOException { + return new NetworkClient(settings); + } + + /** + * Constructs an instance of NetworkClient, using the given stub for making calls. This is for + * advanced usage - prefer to use NetworkSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final NetworkClient create(NetworkStub stub) { + return new NetworkClient(stub); + } + + /** + * Constructs an instance of NetworkClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected NetworkClient(NetworkSettings settings) throws IOException { + this.settings = settings; + this.stub = ((NetworkStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected NetworkClient(NetworkStub stub) { + this.settings = null; + this.stub = stub; + } + + public final NetworkSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public NetworkStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds a peering to the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
+   *   Operation response = networkClient.addPeeringNetwork(network, networksAddPeeringRequestResource);
+   * }
+   * 
+ * + * @param network Name of the network resource to add peering to. + * @param networksAddPeeringRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addPeeringNetwork( + ProjectGlobalNetworkName network, + NetworksAddPeeringRequest networksAddPeeringRequestResource) { + + AddPeeringNetworkHttpRequest request = + AddPeeringNetworkHttpRequest.newBuilder() + .setNetwork(network == null ? null : network.toString()) + .setNetworksAddPeeringRequestResource(networksAddPeeringRequestResource) + .build(); + return addPeeringNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds a peering to the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
+   *   Operation response = networkClient.addPeeringNetwork(network.toString(), networksAddPeeringRequestResource);
+   * }
+   * 
+ * + * @param network Name of the network resource to add peering to. + * @param networksAddPeeringRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addPeeringNetwork( + String network, NetworksAddPeeringRequest networksAddPeeringRequestResource) { + + AddPeeringNetworkHttpRequest request = + AddPeeringNetworkHttpRequest.newBuilder() + .setNetwork(network) + .setNetworksAddPeeringRequestResource(networksAddPeeringRequestResource) + .build(); + return addPeeringNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds a peering to the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
+   *   AddPeeringNetworkHttpRequest request = AddPeeringNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .setNetworksAddPeeringRequestResource(networksAddPeeringRequestResource)
+   *     .build();
+   *   Operation response = networkClient.addPeeringNetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addPeeringNetwork(AddPeeringNetworkHttpRequest request) { + return addPeeringNetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds a peering to the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
+   *   AddPeeringNetworkHttpRequest request = AddPeeringNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .setNetworksAddPeeringRequestResource(networksAddPeeringRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = networkClient.addPeeringNetworkCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable addPeeringNetworkCallable() { + return stub.addPeeringNetworkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   Operation response = networkClient.deleteNetwork(network);
+   * }
+   * 
+ * + * @param network Name of the network to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteNetwork(ProjectGlobalNetworkName network) { + + DeleteNetworkHttpRequest request = + DeleteNetworkHttpRequest.newBuilder() + .setNetwork(network == null ? null : network.toString()) + .build(); + return deleteNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   Operation response = networkClient.deleteNetwork(network.toString());
+   * }
+   * 
+ * + * @param network Name of the network to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteNetwork(String network) { + + DeleteNetworkHttpRequest request = + DeleteNetworkHttpRequest.newBuilder().setNetwork(network).build(); + return deleteNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   DeleteNetworkHttpRequest request = DeleteNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .build();
+   *   Operation response = networkClient.deleteNetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteNetwork(DeleteNetworkHttpRequest request) { + return deleteNetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   DeleteNetworkHttpRequest request = DeleteNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = networkClient.deleteNetworkCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteNetworkCallable() { + return stub.deleteNetworkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified network. Gets a list of available networks by making a list() request. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   Network response = networkClient.getNetwork(network);
+   * }
+   * 
+ * + * @param network Name of the network to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Network getNetwork(ProjectGlobalNetworkName network) { + + GetNetworkHttpRequest request = + GetNetworkHttpRequest.newBuilder() + .setNetwork(network == null ? null : network.toString()) + .build(); + return getNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified network. Gets a list of available networks by making a list() request. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   Network response = networkClient.getNetwork(network.toString());
+   * }
+   * 
+ * + * @param network Name of the network to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Network getNetwork(String network) { + + GetNetworkHttpRequest request = GetNetworkHttpRequest.newBuilder().setNetwork(network).build(); + return getNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified network. Gets a list of available networks by making a list() request. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   GetNetworkHttpRequest request = GetNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .build();
+   *   Network response = networkClient.getNetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Network getNetwork(GetNetworkHttpRequest request) { + return getNetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified network. Gets a list of available networks by making a list() request. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   GetNetworkHttpRequest request = GetNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .build();
+   *   ApiFuture<Network> future = networkClient.getNetworkCallable().futureCall(request);
+   *   // Do something
+   *   Network response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getNetworkCallable() { + return stub.getNetworkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a network in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Network networkResource = Network.newBuilder().build();
+   *   Operation response = networkClient.insertNetwork(project, networkResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param networkResource Represents a Network resource. Read Networks and Firewalls for more + * information. (== resource_for v1.networks ==) (== resource_for beta.networks ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertNetwork(ProjectName project, Network networkResource) { + + InsertNetworkHttpRequest request = + InsertNetworkHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setNetworkResource(networkResource) + .build(); + return insertNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a network in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Network networkResource = Network.newBuilder().build();
+   *   Operation response = networkClient.insertNetwork(project.toString(), networkResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param networkResource Represents a Network resource. Read Networks and Firewalls for more + * information. (== resource_for v1.networks ==) (== resource_for beta.networks ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertNetwork(String project, Network networkResource) { + + InsertNetworkHttpRequest request = + InsertNetworkHttpRequest.newBuilder() + .setProject(project) + .setNetworkResource(networkResource) + .build(); + return insertNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a network in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Network networkResource = Network.newBuilder().build();
+   *   InsertNetworkHttpRequest request = InsertNetworkHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setNetworkResource(networkResource)
+   *     .build();
+   *   Operation response = networkClient.insertNetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertNetwork(InsertNetworkHttpRequest request) { + return insertNetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a network in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Network networkResource = Network.newBuilder().build();
+   *   InsertNetworkHttpRequest request = InsertNetworkHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setNetworkResource(networkResource)
+   *     .build();
+   *   ApiFuture<Operation> future = networkClient.insertNetworkCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertNetworkCallable() { + return stub.insertNetworkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of networks available to the specified project. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Network element : networkClient.listNetworks(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListNetworksPagedResponse listNetworks(ProjectName project) { + ListNetworksHttpRequest request = + ListNetworksHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listNetworks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of networks available to the specified project. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Network element : networkClient.listNetworks(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListNetworksPagedResponse listNetworks(String project) { + ListNetworksHttpRequest request = + ListNetworksHttpRequest.newBuilder().setProject(project).build(); + return listNetworks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of networks available to the specified project. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListNetworksHttpRequest request = ListNetworksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (Network element : networkClient.listNetworks(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListNetworksPagedResponse listNetworks(ListNetworksHttpRequest request) { + return listNetworksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of networks available to the specified project. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListNetworksHttpRequest request = ListNetworksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListNetworksPagedResponse> future = networkClient.listNetworksPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Network element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listNetworksPagedCallable() { + return stub.listNetworksPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of networks available to the specified project. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListNetworksHttpRequest request = ListNetworksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     NetworkList response = networkClient.listNetworksCallable().call(request);
+   *     for (Network element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listNetworksCallable() { + return stub.listNetworksCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified network with the data included in the request. Only the following fields + * can be modified: routingConfig.routingMode. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   Network networkResource = Network.newBuilder().build();
+   *   Operation response = networkClient.patchNetwork(network, networkResource);
+   * }
+   * 
+ * + * @param network Name of the network to update. + * @param networkResource Represents a Network resource. Read Networks and Firewalls for more + * information. (== resource_for v1.networks ==) (== resource_for beta.networks ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchNetwork(ProjectGlobalNetworkName network, Network networkResource) { + + PatchNetworkHttpRequest request = + PatchNetworkHttpRequest.newBuilder() + .setNetwork(network == null ? null : network.toString()) + .setNetworkResource(networkResource) + .build(); + return patchNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified network with the data included in the request. Only the following fields + * can be modified: routingConfig.routingMode. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   Network networkResource = Network.newBuilder().build();
+   *   Operation response = networkClient.patchNetwork(network.toString(), networkResource);
+   * }
+   * 
+ * + * @param network Name of the network to update. + * @param networkResource Represents a Network resource. Read Networks and Firewalls for more + * information. (== resource_for v1.networks ==) (== resource_for beta.networks ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchNetwork(String network, Network networkResource) { + + PatchNetworkHttpRequest request = + PatchNetworkHttpRequest.newBuilder() + .setNetwork(network) + .setNetworkResource(networkResource) + .build(); + return patchNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified network with the data included in the request. Only the following fields + * can be modified: routingConfig.routingMode. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   Network networkResource = Network.newBuilder().build();
+   *   PatchNetworkHttpRequest request = PatchNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .setNetworkResource(networkResource)
+   *     .build();
+   *   Operation response = networkClient.patchNetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchNetwork(PatchNetworkHttpRequest request) { + return patchNetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified network with the data included in the request. Only the following fields + * can be modified: routingConfig.routingMode. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   Network networkResource = Network.newBuilder().build();
+   *   PatchNetworkHttpRequest request = PatchNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .setNetworkResource(networkResource)
+   *     .build();
+   *   ApiFuture<Operation> future = networkClient.patchNetworkCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable patchNetworkCallable() { + return stub.patchNetworkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes a peering from the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   NetworksRemovePeeringRequest networksRemovePeeringRequestResource = NetworksRemovePeeringRequest.newBuilder().build();
+   *   Operation response = networkClient.removePeeringNetwork(network, networksRemovePeeringRequestResource);
+   * }
+   * 
+ * + * @param network Name of the network resource to remove peering from. + * @param networksRemovePeeringRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removePeeringNetwork( + ProjectGlobalNetworkName network, + NetworksRemovePeeringRequest networksRemovePeeringRequestResource) { + + RemovePeeringNetworkHttpRequest request = + RemovePeeringNetworkHttpRequest.newBuilder() + .setNetwork(network == null ? null : network.toString()) + .setNetworksRemovePeeringRequestResource(networksRemovePeeringRequestResource) + .build(); + return removePeeringNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes a peering from the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   NetworksRemovePeeringRequest networksRemovePeeringRequestResource = NetworksRemovePeeringRequest.newBuilder().build();
+   *   Operation response = networkClient.removePeeringNetwork(network.toString(), networksRemovePeeringRequestResource);
+   * }
+   * 
+ * + * @param network Name of the network resource to remove peering from. + * @param networksRemovePeeringRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removePeeringNetwork( + String network, NetworksRemovePeeringRequest networksRemovePeeringRequestResource) { + + RemovePeeringNetworkHttpRequest request = + RemovePeeringNetworkHttpRequest.newBuilder() + .setNetwork(network) + .setNetworksRemovePeeringRequestResource(networksRemovePeeringRequestResource) + .build(); + return removePeeringNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes a peering from the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   NetworksRemovePeeringRequest networksRemovePeeringRequestResource = NetworksRemovePeeringRequest.newBuilder().build();
+   *   RemovePeeringNetworkHttpRequest request = RemovePeeringNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .setNetworksRemovePeeringRequestResource(networksRemovePeeringRequestResource)
+   *     .build();
+   *   Operation response = networkClient.removePeeringNetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removePeeringNetwork(RemovePeeringNetworkHttpRequest request) { + return removePeeringNetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes a peering from the specified network. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   NetworksRemovePeeringRequest networksRemovePeeringRequestResource = NetworksRemovePeeringRequest.newBuilder().build();
+   *   RemovePeeringNetworkHttpRequest request = RemovePeeringNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .setNetworksRemovePeeringRequestResource(networksRemovePeeringRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = networkClient.removePeeringNetworkCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + removePeeringNetworkCallable() { + return stub.removePeeringNetworkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Switches the network mode from auto subnet mode to custom subnet mode. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   Operation response = networkClient.switchToCustomModeNetwork(network);
+   * }
+   * 
+ * + * @param network Name of the network to be updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation switchToCustomModeNetwork(ProjectGlobalNetworkName network) { + + SwitchToCustomModeNetworkHttpRequest request = + SwitchToCustomModeNetworkHttpRequest.newBuilder() + .setNetwork(network == null ? null : network.toString()) + .build(); + return switchToCustomModeNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Switches the network mode from auto subnet mode to custom subnet mode. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   Operation response = networkClient.switchToCustomModeNetwork(network.toString());
+   * }
+   * 
+ * + * @param network Name of the network to be updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation switchToCustomModeNetwork(String network) { + + SwitchToCustomModeNetworkHttpRequest request = + SwitchToCustomModeNetworkHttpRequest.newBuilder().setNetwork(network).build(); + return switchToCustomModeNetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Switches the network mode from auto subnet mode to custom subnet mode. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   SwitchToCustomModeNetworkHttpRequest request = SwitchToCustomModeNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .build();
+   *   Operation response = networkClient.switchToCustomModeNetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation switchToCustomModeNetwork(SwitchToCustomModeNetworkHttpRequest request) { + return switchToCustomModeNetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Switches the network mode from auto subnet mode to custom subnet mode. + * + *

Sample code: + * + *


+   * try (NetworkClient networkClient = NetworkClient.create()) {
+   *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+   *   SwitchToCustomModeNetworkHttpRequest request = SwitchToCustomModeNetworkHttpRequest.newBuilder()
+   *     .setNetwork(network.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = networkClient.switchToCustomModeNetworkCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + switchToCustomModeNetworkCallable() { + return stub.switchToCustomModeNetworkCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListNetworksPagedResponse + extends AbstractPagedListResponse< + ListNetworksHttpRequest, NetworkList, Network, ListNetworksPage, + ListNetworksFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListNetworksPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListNetworksPagedResponse apply(ListNetworksPage input) { + return new ListNetworksPagedResponse(input); + } + }); + } + + private ListNetworksPagedResponse(ListNetworksPage page) { + super(page, ListNetworksFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListNetworksPage + extends AbstractPage { + + private ListNetworksPage( + PageContext context, NetworkList response) { + super(context, response); + } + + private static ListNetworksPage createEmptyPage() { + return new ListNetworksPage(null, null); + } + + @Override + protected ListNetworksPage createPage( + PageContext context, NetworkList response) { + return new ListNetworksPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListNetworksFixedSizeCollection + extends AbstractFixedSizeCollection< + ListNetworksHttpRequest, NetworkList, Network, ListNetworksPage, + ListNetworksFixedSizeCollection> { + + private ListNetworksFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListNetworksFixedSizeCollection createEmptyCollection() { + return new ListNetworksFixedSizeCollection(null, 0); + } + + @Override + protected ListNetworksFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListNetworksFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkInterface.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkInterface.java new file mode 100644 index 000000000000..52c668ae9840 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkInterface.java @@ -0,0 +1,376 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class NetworkInterface implements ApiMessage { + private final List accessConfigs; + private final List aliasIpRanges; + private final String fingerprint; + private final String kind; + private final String name; + private final String network; + private final String networkIP; + private final String subnetwork; + + private NetworkInterface() { + this.accessConfigs = null; + this.aliasIpRanges = null; + this.fingerprint = null; + this.kind = null; + this.name = null; + this.network = null; + this.networkIP = null; + this.subnetwork = null; + } + + private NetworkInterface( + List accessConfigs, + List aliasIpRanges, + String fingerprint, + String kind, + String name, + String network, + String networkIP, + String subnetwork) { + this.accessConfigs = accessConfigs; + this.aliasIpRanges = aliasIpRanges; + this.fingerprint = fingerprint; + this.kind = kind; + this.name = name; + this.network = network; + this.networkIP = networkIP; + this.subnetwork = subnetwork; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("accessConfigs")) { + return accessConfigs; + } + if (fieldName.equals("aliasIpRanges")) { + return aliasIpRanges; + } + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("networkIP")) { + return networkIP; + } + if (fieldName.equals("subnetwork")) { + return subnetwork; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getAccessConfigsList() { + return accessConfigs; + } + + public List getAliasIpRangesList() { + return aliasIpRanges; + } + + public String getFingerprint() { + return fingerprint; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getNetwork() { + return network; + } + + public String getNetworkIP() { + return networkIP; + } + + public String getSubnetwork() { + return subnetwork; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(NetworkInterface prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static NetworkInterface getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final NetworkInterface DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new NetworkInterface(); + } + + public static class Builder { + private List accessConfigs; + private List aliasIpRanges; + private String fingerprint; + private String kind; + private String name; + private String network; + private String networkIP; + private String subnetwork; + + Builder() {} + + public Builder mergeFrom(NetworkInterface other) { + if (other == NetworkInterface.getDefaultInstance()) return this; + if (other.getAccessConfigsList() != null) { + this.accessConfigs = other.accessConfigs; + } + if (other.getAliasIpRangesList() != null) { + this.aliasIpRanges = other.aliasIpRanges; + } + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getNetworkIP() != null) { + this.networkIP = other.networkIP; + } + if (other.getSubnetwork() != null) { + this.subnetwork = other.subnetwork; + } + return this; + } + + Builder(NetworkInterface source) { + this.accessConfigs = source.accessConfigs; + this.aliasIpRanges = source.aliasIpRanges; + this.fingerprint = source.fingerprint; + this.kind = source.kind; + this.name = source.name; + this.network = source.network; + this.networkIP = source.networkIP; + this.subnetwork = source.subnetwork; + } + + public List getAccessConfigsList() { + return accessConfigs; + } + + public Builder addAllAccessConfigs(List accessConfigs) { + if (this.accessConfigs == null) { + this.accessConfigs = new ArrayList<>(accessConfigs.size()); + } + this.accessConfigs.addAll(accessConfigs); + return this; + } + + public Builder addAccessConfigs(AccessConfig accessConfigs) { + this.accessConfigs.add(accessConfigs); + return this; + } + + public List getAliasIpRangesList() { + return aliasIpRanges; + } + + public Builder addAllAliasIpRanges(List aliasIpRanges) { + if (this.aliasIpRanges == null) { + this.aliasIpRanges = new ArrayList<>(aliasIpRanges.size()); + } + this.aliasIpRanges.addAll(aliasIpRanges); + return this; + } + + public Builder addAliasIpRanges(AliasIpRange aliasIpRanges) { + this.aliasIpRanges.add(aliasIpRanges); + return this; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public String getNetworkIP() { + return networkIP; + } + + public Builder setNetworkIP(String networkIP) { + this.networkIP = networkIP; + return this; + } + + public String getSubnetwork() { + return subnetwork; + } + + public Builder setSubnetwork(String subnetwork) { + this.subnetwork = subnetwork; + return this; + } + + public NetworkInterface build() { + + return new NetworkInterface( + accessConfigs, aliasIpRanges, fingerprint, kind, name, network, networkIP, subnetwork); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllAccessConfigs(this.accessConfigs); + newBuilder.addAllAliasIpRanges(this.aliasIpRanges); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setNetwork(this.network); + newBuilder.setNetworkIP(this.networkIP); + newBuilder.setSubnetwork(this.subnetwork); + return newBuilder; + } + } + + @Override + public String toString() { + return "NetworkInterface{" + + "accessConfigs=" + + accessConfigs + + ", " + + "aliasIpRanges=" + + aliasIpRanges + + ", " + + "fingerprint=" + + fingerprint + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "network=" + + network + + ", " + + "networkIP=" + + networkIP + + ", " + + "subnetwork=" + + subnetwork + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof NetworkInterface) { + NetworkInterface that = (NetworkInterface) o; + return Objects.equals(this.accessConfigs, that.getAccessConfigsList()) + && Objects.equals(this.aliasIpRanges, that.getAliasIpRangesList()) + && Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.networkIP, that.getNetworkIP()) + && Objects.equals(this.subnetwork, that.getSubnetwork()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + accessConfigs, aliasIpRanges, fingerprint, kind, name, network, networkIP, subnetwork); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkList.java new file mode 100644 index 000000000000..7173c819e1c2 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class NetworkList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private NetworkList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private NetworkList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(NetworkList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static NetworkList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final NetworkList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new NetworkList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(NetworkList other) { + if (other == NetworkList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(NetworkList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Network items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public NetworkList build() { + + return new NetworkList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "NetworkList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof NetworkList) { + NetworkList that = (NetworkList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkPeering.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkPeering.java new file mode 100644 index 000000000000..358916af8b13 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkPeering.java @@ -0,0 +1,263 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class NetworkPeering implements ApiMessage { + private final Boolean autoCreateRoutes; + private final String name; + private final String network; + private final String state; + private final String stateDetails; + + private NetworkPeering() { + this.autoCreateRoutes = null; + this.name = null; + this.network = null; + this.state = null; + this.stateDetails = null; + } + + private NetworkPeering( + Boolean autoCreateRoutes, String name, String network, String state, String stateDetails) { + this.autoCreateRoutes = autoCreateRoutes; + this.name = name; + this.network = network; + this.state = state; + this.stateDetails = stateDetails; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("autoCreateRoutes")) { + return autoCreateRoutes; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("state")) { + return state; + } + if (fieldName.equals("stateDetails")) { + return stateDetails; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getAutoCreateRoutes() { + return autoCreateRoutes; + } + + public String getName() { + return name; + } + + public String getNetwork() { + return network; + } + + public String getState() { + return state; + } + + public String getStateDetails() { + return stateDetails; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(NetworkPeering prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static NetworkPeering getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final NetworkPeering DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new NetworkPeering(); + } + + public static class Builder { + private Boolean autoCreateRoutes; + private String name; + private String network; + private String state; + private String stateDetails; + + Builder() {} + + public Builder mergeFrom(NetworkPeering other) { + if (other == NetworkPeering.getDefaultInstance()) return this; + if (other.getAutoCreateRoutes() != null) { + this.autoCreateRoutes = other.autoCreateRoutes; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getState() != null) { + this.state = other.state; + } + if (other.getStateDetails() != null) { + this.stateDetails = other.stateDetails; + } + return this; + } + + Builder(NetworkPeering source) { + this.autoCreateRoutes = source.autoCreateRoutes; + this.name = source.name; + this.network = source.network; + this.state = source.state; + this.stateDetails = source.stateDetails; + } + + public Boolean getAutoCreateRoutes() { + return autoCreateRoutes; + } + + public Builder setAutoCreateRoutes(Boolean autoCreateRoutes) { + this.autoCreateRoutes = autoCreateRoutes; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public String getState() { + return state; + } + + public Builder setState(String state) { + this.state = state; + return this; + } + + public String getStateDetails() { + return stateDetails; + } + + public Builder setStateDetails(String stateDetails) { + this.stateDetails = stateDetails; + return this; + } + + public NetworkPeering build() { + + return new NetworkPeering(autoCreateRoutes, name, network, state, stateDetails); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAutoCreateRoutes(this.autoCreateRoutes); + newBuilder.setName(this.name); + newBuilder.setNetwork(this.network); + newBuilder.setState(this.state); + newBuilder.setStateDetails(this.stateDetails); + return newBuilder; + } + } + + @Override + public String toString() { + return "NetworkPeering{" + + "autoCreateRoutes=" + + autoCreateRoutes + + ", " + + "name=" + + name + + ", " + + "network=" + + network + + ", " + + "state=" + + state + + ", " + + "stateDetails=" + + stateDetails + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof NetworkPeering) { + NetworkPeering that = (NetworkPeering) o; + return Objects.equals(this.autoCreateRoutes, that.getAutoCreateRoutes()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.state, that.getState()) + && Objects.equals(this.stateDetails, that.getStateDetails()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(autoCreateRoutes, name, network, state, stateDetails); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkRoutingConfig.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkRoutingConfig.java new file mode 100644 index 000000000000..fee7e20c4536 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkRoutingConfig.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class NetworkRoutingConfig implements ApiMessage { + private final String routingMode; + + private NetworkRoutingConfig() { + this.routingMode = null; + } + + private NetworkRoutingConfig(String routingMode) { + this.routingMode = routingMode; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("routingMode")) { + return routingMode; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getRoutingMode() { + return routingMode; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(NetworkRoutingConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static NetworkRoutingConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final NetworkRoutingConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new NetworkRoutingConfig(); + } + + public static class Builder { + private String routingMode; + + Builder() {} + + public Builder mergeFrom(NetworkRoutingConfig other) { + if (other == NetworkRoutingConfig.getDefaultInstance()) return this; + if (other.getRoutingMode() != null) { + this.routingMode = other.routingMode; + } + return this; + } + + Builder(NetworkRoutingConfig source) { + this.routingMode = source.routingMode; + } + + public String getRoutingMode() { + return routingMode; + } + + public Builder setRoutingMode(String routingMode) { + this.routingMode = routingMode; + return this; + } + + public NetworkRoutingConfig build() { + return new NetworkRoutingConfig(routingMode); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setRoutingMode(this.routingMode); + return newBuilder; + } + } + + @Override + public String toString() { + return "NetworkRoutingConfig{" + "routingMode=" + routingMode + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof NetworkRoutingConfig) { + NetworkRoutingConfig that = (NetworkRoutingConfig) o; + return Objects.equals(this.routingMode, that.getRoutingMode()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(routingMode); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkSettings.java new file mode 100644 index 000000000000..68dce009848f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworkSettings.java @@ -0,0 +1,260 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.NetworkClient.ListNetworksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.NetworkStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link NetworkClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of addPeeringNetwork to 30 seconds: + * + *

+ * 
+ * NetworkSettings.Builder networkSettingsBuilder =
+ *     NetworkSettings.newBuilder();
+ * networkSettingsBuilder.addPeeringNetworkSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * NetworkSettings networkSettings = networkSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class NetworkSettings extends ClientSettings { + /** Returns the object with the settings used for calls to addPeeringNetwork. */ + public UnaryCallSettings addPeeringNetworkSettings() { + return ((NetworkStubSettings) getStubSettings()).addPeeringNetworkSettings(); + } + + /** Returns the object with the settings used for calls to deleteNetwork. */ + public UnaryCallSettings deleteNetworkSettings() { + return ((NetworkStubSettings) getStubSettings()).deleteNetworkSettings(); + } + + /** Returns the object with the settings used for calls to getNetwork. */ + public UnaryCallSettings getNetworkSettings() { + return ((NetworkStubSettings) getStubSettings()).getNetworkSettings(); + } + + /** Returns the object with the settings used for calls to insertNetwork. */ + public UnaryCallSettings insertNetworkSettings() { + return ((NetworkStubSettings) getStubSettings()).insertNetworkSettings(); + } + + /** Returns the object with the settings used for calls to listNetworks. */ + public PagedCallSettings + listNetworksSettings() { + return ((NetworkStubSettings) getStubSettings()).listNetworksSettings(); + } + + /** Returns the object with the settings used for calls to patchNetwork. */ + public UnaryCallSettings patchNetworkSettings() { + return ((NetworkStubSettings) getStubSettings()).patchNetworkSettings(); + } + + /** Returns the object with the settings used for calls to removePeeringNetwork. */ + public UnaryCallSettings + removePeeringNetworkSettings() { + return ((NetworkStubSettings) getStubSettings()).removePeeringNetworkSettings(); + } + + /** Returns the object with the settings used for calls to switchToCustomModeNetwork. */ + public UnaryCallSettings + switchToCustomModeNetworkSettings() { + return ((NetworkStubSettings) getStubSettings()).switchToCustomModeNetworkSettings(); + } + + public static final NetworkSettings create(NetworkStubSettings stub) throws IOException { + return new NetworkSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return NetworkStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return NetworkStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return NetworkStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return NetworkStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return NetworkStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return NetworkStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return NetworkStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return NetworkStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected NetworkSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for NetworkSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(NetworkStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(NetworkStubSettings.newBuilder()); + } + + protected Builder(NetworkSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(NetworkStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public NetworkStubSettings.Builder getStubSettingsBuilder() { + return ((NetworkStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to addPeeringNetwork. */ + public UnaryCallSettings.Builder + addPeeringNetworkSettings() { + return getStubSettingsBuilder().addPeeringNetworkSettings(); + } + + /** Returns the builder for the settings used for calls to deleteNetwork. */ + public UnaryCallSettings.Builder deleteNetworkSettings() { + return getStubSettingsBuilder().deleteNetworkSettings(); + } + + /** Returns the builder for the settings used for calls to getNetwork. */ + public UnaryCallSettings.Builder getNetworkSettings() { + return getStubSettingsBuilder().getNetworkSettings(); + } + + /** Returns the builder for the settings used for calls to insertNetwork. */ + public UnaryCallSettings.Builder insertNetworkSettings() { + return getStubSettingsBuilder().insertNetworkSettings(); + } + + /** Returns the builder for the settings used for calls to listNetworks. */ + public PagedCallSettings.Builder< + ListNetworksHttpRequest, NetworkList, ListNetworksPagedResponse> + listNetworksSettings() { + return getStubSettingsBuilder().listNetworksSettings(); + } + + /** Returns the builder for the settings used for calls to patchNetwork. */ + public UnaryCallSettings.Builder patchNetworkSettings() { + return getStubSettingsBuilder().patchNetworkSettings(); + } + + /** Returns the builder for the settings used for calls to removePeeringNetwork. */ + public UnaryCallSettings.Builder + removePeeringNetworkSettings() { + return getStubSettingsBuilder().removePeeringNetworkSettings(); + } + + /** Returns the builder for the settings used for calls to switchToCustomModeNetwork. */ + public UnaryCallSettings.Builder + switchToCustomModeNetworkSettings() { + return getStubSettingsBuilder().switchToCustomModeNetworkSettings(); + } + + @Override + public NetworkSettings build() throws IOException { + return new NetworkSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworksAddPeeringRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworksAddPeeringRequest.java new file mode 100644 index 000000000000..c70d12129013 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworksAddPeeringRequest.java @@ -0,0 +1,204 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class NetworksAddPeeringRequest implements ApiMessage { + private final Boolean autoCreateRoutes; + private final String name; + private final String peerNetwork; + + private NetworksAddPeeringRequest() { + this.autoCreateRoutes = null; + this.name = null; + this.peerNetwork = null; + } + + private NetworksAddPeeringRequest(Boolean autoCreateRoutes, String name, String peerNetwork) { + this.autoCreateRoutes = autoCreateRoutes; + this.name = name; + this.peerNetwork = peerNetwork; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("autoCreateRoutes")) { + return autoCreateRoutes; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("peerNetwork")) { + return peerNetwork; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getAutoCreateRoutes() { + return autoCreateRoutes; + } + + public String getName() { + return name; + } + + public String getPeerNetwork() { + return peerNetwork; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(NetworksAddPeeringRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static NetworksAddPeeringRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final NetworksAddPeeringRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new NetworksAddPeeringRequest(); + } + + public static class Builder { + private Boolean autoCreateRoutes; + private String name; + private String peerNetwork; + + Builder() {} + + public Builder mergeFrom(NetworksAddPeeringRequest other) { + if (other == NetworksAddPeeringRequest.getDefaultInstance()) return this; + if (other.getAutoCreateRoutes() != null) { + this.autoCreateRoutes = other.autoCreateRoutes; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPeerNetwork() != null) { + this.peerNetwork = other.peerNetwork; + } + return this; + } + + Builder(NetworksAddPeeringRequest source) { + this.autoCreateRoutes = source.autoCreateRoutes; + this.name = source.name; + this.peerNetwork = source.peerNetwork; + } + + public Boolean getAutoCreateRoutes() { + return autoCreateRoutes; + } + + public Builder setAutoCreateRoutes(Boolean autoCreateRoutes) { + this.autoCreateRoutes = autoCreateRoutes; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getPeerNetwork() { + return peerNetwork; + } + + public Builder setPeerNetwork(String peerNetwork) { + this.peerNetwork = peerNetwork; + return this; + } + + public NetworksAddPeeringRequest build() { + + return new NetworksAddPeeringRequest(autoCreateRoutes, name, peerNetwork); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAutoCreateRoutes(this.autoCreateRoutes); + newBuilder.setName(this.name); + newBuilder.setPeerNetwork(this.peerNetwork); + return newBuilder; + } + } + + @Override + public String toString() { + return "NetworksAddPeeringRequest{" + + "autoCreateRoutes=" + + autoCreateRoutes + + ", " + + "name=" + + name + + ", " + + "peerNetwork=" + + peerNetwork + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof NetworksAddPeeringRequest) { + NetworksAddPeeringRequest that = (NetworksAddPeeringRequest) o; + return Objects.equals(this.autoCreateRoutes, that.getAutoCreateRoutes()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.peerNetwork, that.getPeerNetwork()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(autoCreateRoutes, name, peerNetwork); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworksRemovePeeringRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworksRemovePeeringRequest.java new file mode 100644 index 000000000000..397a37cef130 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NetworksRemovePeeringRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class NetworksRemovePeeringRequest implements ApiMessage { + private final String name; + + private NetworksRemovePeeringRequest() { + this.name = null; + } + + private NetworksRemovePeeringRequest(String name) { + this.name = name; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("name")) { + return name; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getName() { + return name; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(NetworksRemovePeeringRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static NetworksRemovePeeringRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final NetworksRemovePeeringRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new NetworksRemovePeeringRequest(); + } + + public static class Builder { + private String name; + + Builder() {} + + public Builder mergeFrom(NetworksRemovePeeringRequest other) { + if (other == NetworksRemovePeeringRequest.getDefaultInstance()) return this; + if (other.getName() != null) { + this.name = other.name; + } + return this; + } + + Builder(NetworksRemovePeeringRequest source) { + this.name = source.name; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public NetworksRemovePeeringRequest build() { + return new NetworksRemovePeeringRequest(name); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setName(this.name); + return newBuilder; + } + } + + @Override + public String toString() { + return "NetworksRemovePeeringRequest{" + "name=" + name + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof NetworksRemovePeeringRequest) { + NetworksRemovePeeringRequest that = (NetworksRemovePeeringRequest) o; + return Objects.equals(this.name, that.getName()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(name); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Operation.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Operation.java new file mode 100644 index 000000000000..1ce06a104dea --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Operation.java @@ -0,0 +1,862 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Operation implements ApiMessage { + private final String clientOperationId; + private final String creationTimestamp; + private final String description; + private final String endTime; + private final Error error; + private final String httpErrorMessage; + private final Integer httpErrorStatusCode; + private final String id; + private final String insertTime; + private final String kind; + private final String name; + private final String operationType; + private final Integer progress; + private final String region; + private final String selfLink; + private final String startTime; + private final String status; + private final String statusMessage; + private final String targetId; + private final String targetLink; + private final String user; + private final List warnings; + private final String zone; + + private Operation() { + this.clientOperationId = null; + this.creationTimestamp = null; + this.description = null; + this.endTime = null; + this.error = null; + this.httpErrorMessage = null; + this.httpErrorStatusCode = null; + this.id = null; + this.insertTime = null; + this.kind = null; + this.name = null; + this.operationType = null; + this.progress = null; + this.region = null; + this.selfLink = null; + this.startTime = null; + this.status = null; + this.statusMessage = null; + this.targetId = null; + this.targetLink = null; + this.user = null; + this.warnings = null; + this.zone = null; + } + + private Operation( + String clientOperationId, + String creationTimestamp, + String description, + String endTime, + Error error, + String httpErrorMessage, + Integer httpErrorStatusCode, + String id, + String insertTime, + String kind, + String name, + String operationType, + Integer progress, + String region, + String selfLink, + String startTime, + String status, + String statusMessage, + String targetId, + String targetLink, + String user, + List warnings, + String zone) { + this.clientOperationId = clientOperationId; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.endTime = endTime; + this.error = error; + this.httpErrorMessage = httpErrorMessage; + this.httpErrorStatusCode = httpErrorStatusCode; + this.id = id; + this.insertTime = insertTime; + this.kind = kind; + this.name = name; + this.operationType = operationType; + this.progress = progress; + this.region = region; + this.selfLink = selfLink; + this.startTime = startTime; + this.status = status; + this.statusMessage = statusMessage; + this.targetId = targetId; + this.targetLink = targetLink; + this.user = user; + this.warnings = warnings; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("clientOperationId")) { + return clientOperationId; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("endTime")) { + return endTime; + } + if (fieldName.equals("error")) { + return error; + } + if (fieldName.equals("httpErrorMessage")) { + return httpErrorMessage; + } + if (fieldName.equals("httpErrorStatusCode")) { + return httpErrorStatusCode; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("insertTime")) { + return insertTime; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("operationType")) { + return operationType; + } + if (fieldName.equals("progress")) { + return progress; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("startTime")) { + return startTime; + } + if (fieldName.equals("status")) { + return status; + } + if (fieldName.equals("statusMessage")) { + return statusMessage; + } + if (fieldName.equals("targetId")) { + return targetId; + } + if (fieldName.equals("targetLink")) { + return targetLink; + } + if (fieldName.equals("user")) { + return user; + } + if (fieldName.equals("warnings")) { + return warnings; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getClientOperationId() { + return clientOperationId; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getEndTime() { + return endTime; + } + + public Error getError() { + return error; + } + + public String getHttpErrorMessage() { + return httpErrorMessage; + } + + public Integer getHttpErrorStatusCode() { + return httpErrorStatusCode; + } + + public String getId() { + return id; + } + + public String getInsertTime() { + return insertTime; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getOperationType() { + return operationType; + } + + public Integer getProgress() { + return progress; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public String getStartTime() { + return startTime; + } + + public String getStatus() { + return status; + } + + public String getStatusMessage() { + return statusMessage; + } + + public String getTargetId() { + return targetId; + } + + public String getTargetLink() { + return targetLink; + } + + public String getUser() { + return user; + } + + public List getWarningsList() { + return warnings; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Operation prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Operation getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Operation DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Operation(); + } + + public static class Builder { + private String clientOperationId; + private String creationTimestamp; + private String description; + private String endTime; + private Error error; + private String httpErrorMessage; + private Integer httpErrorStatusCode; + private String id; + private String insertTime; + private String kind; + private String name; + private String operationType; + private Integer progress; + private String region; + private String selfLink; + private String startTime; + private String status; + private String statusMessage; + private String targetId; + private String targetLink; + private String user; + private List warnings; + private String zone; + + Builder() {} + + public Builder mergeFrom(Operation other) { + if (other == Operation.getDefaultInstance()) return this; + if (other.getClientOperationId() != null) { + this.clientOperationId = other.clientOperationId; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getEndTime() != null) { + this.endTime = other.endTime; + } + if (other.getError() != null) { + this.error = other.error; + } + if (other.getHttpErrorMessage() != null) { + this.httpErrorMessage = other.httpErrorMessage; + } + if (other.getHttpErrorStatusCode() != null) { + this.httpErrorStatusCode = other.httpErrorStatusCode; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getInsertTime() != null) { + this.insertTime = other.insertTime; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getOperationType() != null) { + this.operationType = other.operationType; + } + if (other.getProgress() != null) { + this.progress = other.progress; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getStartTime() != null) { + this.startTime = other.startTime; + } + if (other.getStatus() != null) { + this.status = other.status; + } + if (other.getStatusMessage() != null) { + this.statusMessage = other.statusMessage; + } + if (other.getTargetId() != null) { + this.targetId = other.targetId; + } + if (other.getTargetLink() != null) { + this.targetLink = other.targetLink; + } + if (other.getUser() != null) { + this.user = other.user; + } + if (other.getWarningsList() != null) { + this.warnings = other.warnings; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(Operation source) { + this.clientOperationId = source.clientOperationId; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.endTime = source.endTime; + this.error = source.error; + this.httpErrorMessage = source.httpErrorMessage; + this.httpErrorStatusCode = source.httpErrorStatusCode; + this.id = source.id; + this.insertTime = source.insertTime; + this.kind = source.kind; + this.name = source.name; + this.operationType = source.operationType; + this.progress = source.progress; + this.region = source.region; + this.selfLink = source.selfLink; + this.startTime = source.startTime; + this.status = source.status; + this.statusMessage = source.statusMessage; + this.targetId = source.targetId; + this.targetLink = source.targetLink; + this.user = source.user; + this.warnings = source.warnings; + this.zone = source.zone; + } + + public String getClientOperationId() { + return clientOperationId; + } + + public Builder setClientOperationId(String clientOperationId) { + this.clientOperationId = clientOperationId; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getEndTime() { + return endTime; + } + + public Builder setEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + public Error getError() { + return error; + } + + public Builder setError(Error error) { + this.error = error; + return this; + } + + public String getHttpErrorMessage() { + return httpErrorMessage; + } + + public Builder setHttpErrorMessage(String httpErrorMessage) { + this.httpErrorMessage = httpErrorMessage; + return this; + } + + public Integer getHttpErrorStatusCode() { + return httpErrorStatusCode; + } + + public Builder setHttpErrorStatusCode(Integer httpErrorStatusCode) { + this.httpErrorStatusCode = httpErrorStatusCode; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getInsertTime() { + return insertTime; + } + + public Builder setInsertTime(String insertTime) { + this.insertTime = insertTime; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getOperationType() { + return operationType; + } + + public Builder setOperationType(String operationType) { + this.operationType = operationType; + return this; + } + + public Integer getProgress() { + return progress; + } + + public Builder setProgress(Integer progress) { + this.progress = progress; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getStartTime() { + return startTime; + } + + public Builder setStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public String getStatusMessage() { + return statusMessage; + } + + public Builder setStatusMessage(String statusMessage) { + this.statusMessage = statusMessage; + return this; + } + + public String getTargetId() { + return targetId; + } + + public Builder setTargetId(String targetId) { + this.targetId = targetId; + return this; + } + + public String getTargetLink() { + return targetLink; + } + + public Builder setTargetLink(String targetLink) { + this.targetLink = targetLink; + return this; + } + + public String getUser() { + return user; + } + + public Builder setUser(String user) { + this.user = user; + return this; + } + + public List getWarningsList() { + return warnings; + } + + public Builder addAllWarnings(List warnings) { + if (this.warnings == null) { + this.warnings = new ArrayList<>(warnings.size()); + } + this.warnings.addAll(warnings); + return this; + } + + public Builder addWarnings(Warnings warnings) { + this.warnings.add(warnings); + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public Operation build() { + + return new Operation( + clientOperationId, + creationTimestamp, + description, + endTime, + error, + httpErrorMessage, + httpErrorStatusCode, + id, + insertTime, + kind, + name, + operationType, + progress, + region, + selfLink, + startTime, + status, + statusMessage, + targetId, + targetLink, + user, + warnings, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setClientOperationId(this.clientOperationId); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setEndTime(this.endTime); + newBuilder.setError(this.error); + newBuilder.setHttpErrorMessage(this.httpErrorMessage); + newBuilder.setHttpErrorStatusCode(this.httpErrorStatusCode); + newBuilder.setId(this.id); + newBuilder.setInsertTime(this.insertTime); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setOperationType(this.operationType); + newBuilder.setProgress(this.progress); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setStartTime(this.startTime); + newBuilder.setStatus(this.status); + newBuilder.setStatusMessage(this.statusMessage); + newBuilder.setTargetId(this.targetId); + newBuilder.setTargetLink(this.targetLink); + newBuilder.setUser(this.user); + newBuilder.addAllWarnings(this.warnings); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "Operation{" + + "clientOperationId=" + + clientOperationId + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "endTime=" + + endTime + + ", " + + "error=" + + error + + ", " + + "httpErrorMessage=" + + httpErrorMessage + + ", " + + "httpErrorStatusCode=" + + httpErrorStatusCode + + ", " + + "id=" + + id + + ", " + + "insertTime=" + + insertTime + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "operationType=" + + operationType + + ", " + + "progress=" + + progress + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + ", " + + "startTime=" + + startTime + + ", " + + "status=" + + status + + ", " + + "statusMessage=" + + statusMessage + + ", " + + "targetId=" + + targetId + + ", " + + "targetLink=" + + targetLink + + ", " + + "user=" + + user + + ", " + + "warnings=" + + warnings + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Operation) { + Operation that = (Operation) o; + return Objects.equals(this.clientOperationId, that.getClientOperationId()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.endTime, that.getEndTime()) + && Objects.equals(this.error, that.getError()) + && Objects.equals(this.httpErrorMessage, that.getHttpErrorMessage()) + && Objects.equals(this.httpErrorStatusCode, that.getHttpErrorStatusCode()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.insertTime, that.getInsertTime()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.operationType, that.getOperationType()) + && Objects.equals(this.progress, that.getProgress()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.startTime, that.getStartTime()) + && Objects.equals(this.status, that.getStatus()) + && Objects.equals(this.statusMessage, that.getStatusMessage()) + && Objects.equals(this.targetId, that.getTargetId()) + && Objects.equals(this.targetLink, that.getTargetLink()) + && Objects.equals(this.user, that.getUser()) + && Objects.equals(this.warnings, that.getWarningsList()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + clientOperationId, + creationTimestamp, + description, + endTime, + error, + httpErrorMessage, + httpErrorStatusCode, + id, + insertTime, + kind, + name, + operationType, + progress, + region, + selfLink, + startTime, + status, + statusMessage, + targetId, + targetLink, + user, + warnings, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/OperationAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/OperationAggregatedList.java new file mode 100644 index 000000000000..29bdd2229966 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/OperationAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class OperationAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private OperationAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private OperationAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(OperationAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static OperationAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final OperationAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new OperationAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(OperationAggregatedList other) { + if (other == OperationAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(OperationAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public OperationAggregatedList build() { + + return new OperationAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "OperationAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof OperationAggregatedList) { + OperationAggregatedList that = (OperationAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/OperationList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/OperationList.java new file mode 100644 index 000000000000..f02a5fb2cd7d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/OperationList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class OperationList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private OperationList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private OperationList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(OperationList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static OperationList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final OperationList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new OperationList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(OperationList other) { + if (other == OperationList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(OperationList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Operation items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public OperationList build() { + + return new OperationList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "OperationList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof OperationList) { + OperationList that = (OperationList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/OperationsScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/OperationsScopedList.java new file mode 100644 index 000000000000..b6ce075a7325 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/OperationsScopedList.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class OperationsScopedList implements ApiMessage { + private final List operations; + private final Warning warning; + + private OperationsScopedList() { + this.operations = null; + this.warning = null; + } + + private OperationsScopedList(List operations, Warning warning) { + this.operations = operations; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("operations")) { + return operations; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getOperationsList() { + return operations; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(OperationsScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static OperationsScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final OperationsScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new OperationsScopedList(); + } + + public static class Builder { + private List operations; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(OperationsScopedList other) { + if (other == OperationsScopedList.getDefaultInstance()) return this; + if (other.getOperationsList() != null) { + this.operations = other.operations; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(OperationsScopedList source) { + this.operations = source.operations; + this.warning = source.warning; + } + + public List getOperationsList() { + return operations; + } + + public Builder addAllOperations(List operations) { + if (this.operations == null) { + this.operations = new ArrayList<>(operations.size()); + } + this.operations.addAll(operations); + return this; + } + + public Builder addOperations(Operation operations) { + this.operations.add(operations); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public OperationsScopedList build() { + + return new OperationsScopedList(operations, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllOperations(this.operations); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "OperationsScopedList{" + "operations=" + operations + ", " + "warning=" + warning + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof OperationsScopedList) { + OperationsScopedList that = (OperationsScopedList) o; + return Objects.equals(this.operations, that.getOperationsList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(operations, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchAutoscalerHttpRequest.java new file mode 100644 index 000000000000..2102af68384b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchAutoscalerHttpRequest.java @@ -0,0 +1,504 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchAutoscalerHttpRequest implements ApiMessage { + private final String access_token; + private final String autoscaler; + private final Autoscaler autoscalerResource; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + private final String zone; + + private PatchAutoscalerHttpRequest() { + this.access_token = null; + this.autoscaler = null; + this.autoscalerResource = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + this.zone = null; + } + + private PatchAutoscalerHttpRequest( + String access_token, + String autoscaler, + Autoscaler autoscalerResource, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp, + String zone) { + this.access_token = access_token; + this.autoscaler = autoscaler; + this.autoscalerResource = autoscalerResource; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("autoscaler")) { + return autoscaler; + } + if (fieldName.equals("autoscalerResource")) { + return autoscalerResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public Autoscaler getApiMessageRequestBody() { + return autoscalerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchAutoscalerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchAutoscalerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchAutoscalerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchAutoscalerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String autoscaler; + private Autoscaler autoscalerResource; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(PatchAutoscalerHttpRequest other) { + if (other == PatchAutoscalerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAutoscaler() != null) { + this.autoscaler = other.autoscaler; + } + if (other.getAutoscalerResource() != null) { + this.autoscalerResource = other.autoscalerResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(PatchAutoscalerHttpRequest source) { + this.access_token = source.access_token; + this.autoscaler = source.autoscaler; + this.autoscalerResource = source.autoscalerResource; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Builder setAutoscaler(String autoscaler) { + this.autoscaler = autoscaler; + return this; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public Builder setAutoscalerResource(Autoscaler autoscalerResource) { + this.autoscalerResource = autoscalerResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public PatchAutoscalerHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchAutoscalerHttpRequest( + access_token, + autoscaler, + autoscalerResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAutoscaler(this.autoscaler); + newBuilder.setAutoscalerResource(this.autoscalerResource); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchAutoscalerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "autoscaler=" + + autoscaler + + ", " + + "autoscalerResource=" + + autoscalerResource + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchAutoscalerHttpRequest) { + PatchAutoscalerHttpRequest that = (PatchAutoscalerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.autoscaler, that.getAutoscaler()) + && Objects.equals(this.autoscalerResource, that.getAutoscalerResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + autoscaler, + autoscalerResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendBucketHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendBucketHttpRequest.java new file mode 100644 index 000000000000..c2557817a243 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendBucketHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchBackendBucketHttpRequest implements ApiMessage { + private final String access_token; + private final String backendBucket; + private final BackendBucket backendBucketResource; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private PatchBackendBucketHttpRequest() { + this.access_token = null; + this.backendBucket = null; + this.backendBucketResource = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private PatchBackendBucketHttpRequest( + String access_token, + String backendBucket, + BackendBucket backendBucketResource, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendBucket = backendBucket; + this.backendBucketResource = backendBucketResource; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendBucket")) { + return backendBucket; + } + if (fieldName.equals("backendBucketResource")) { + return backendBucketResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public BackendBucket getApiMessageRequestBody() { + return backendBucketResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendBucket() { + return backendBucket; + } + + public BackendBucket getBackendBucketResource() { + return backendBucketResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchBackendBucketHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchBackendBucketHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchBackendBucketHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchBackendBucketHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendBucket; + private BackendBucket backendBucketResource; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchBackendBucketHttpRequest other) { + if (other == PatchBackendBucketHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendBucket() != null) { + this.backendBucket = other.backendBucket; + } + if (other.getBackendBucketResource() != null) { + this.backendBucketResource = other.backendBucketResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchBackendBucketHttpRequest source) { + this.access_token = source.access_token; + this.backendBucket = source.backendBucket; + this.backendBucketResource = source.backendBucketResource; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendBucket() { + return backendBucket; + } + + public Builder setBackendBucket(String backendBucket) { + this.backendBucket = backendBucket; + return this; + } + + public BackendBucket getBackendBucketResource() { + return backendBucketResource; + } + + public Builder setBackendBucketResource(BackendBucket backendBucketResource) { + this.backendBucketResource = backendBucketResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchBackendBucketHttpRequest build() { + String missing = ""; + + if (backendBucket == null) { + missing += " backendBucket"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchBackendBucketHttpRequest( + access_token, + backendBucket, + backendBucketResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendBucket(this.backendBucket); + newBuilder.setBackendBucketResource(this.backendBucketResource); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchBackendBucketHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendBucket=" + + backendBucket + + ", " + + "backendBucketResource=" + + backendBucketResource + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchBackendBucketHttpRequest) { + PatchBackendBucketHttpRequest that = (PatchBackendBucketHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendBucket, that.getBackendBucket()) + && Objects.equals(this.backendBucketResource, that.getBackendBucketResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendBucket, + backendBucketResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendServiceHttpRequest.java new file mode 100644 index 000000000000..cbd151c53a69 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendServiceHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final String backendService; + private final BackendService backendServiceResource; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private PatchBackendServiceHttpRequest() { + this.access_token = null; + this.backendService = null; + this.backendServiceResource = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private PatchBackendServiceHttpRequest( + String access_token, + String backendService, + BackendService backendServiceResource, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendService = backendService; + this.backendServiceResource = backendServiceResource; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendService")) { + return backendService; + } + if (fieldName.equals("backendServiceResource")) { + return backendServiceResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public BackendService getApiMessageRequestBody() { + return backendServiceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendService() { + return backendService; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendService; + private BackendService backendServiceResource; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchBackendServiceHttpRequest other) { + if (other == PatchBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendService() != null) { + this.backendService = other.backendService; + } + if (other.getBackendServiceResource() != null) { + this.backendServiceResource = other.backendServiceResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendService = source.backendService; + this.backendServiceResource = source.backendServiceResource; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendService() { + return backendService; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public Builder setBackendServiceResource(BackendService backendServiceResource) { + this.backendServiceResource = backendServiceResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchBackendServiceHttpRequest build() { + String missing = ""; + + if (backendService == null) { + missing += " backendService"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchBackendServiceHttpRequest( + access_token, + backendService, + backendServiceResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendService(this.backendService); + newBuilder.setBackendServiceResource(this.backendServiceResource); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendService=" + + backendService + + ", " + + "backendServiceResource=" + + backendServiceResource + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchBackendServiceHttpRequest) { + PatchBackendServiceHttpRequest that = (PatchBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.backendServiceResource, that.getBackendServiceResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendService, + backendServiceResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchFirewallHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchFirewallHttpRequest.java new file mode 100644 index 000000000000..b9eeb0fcb088 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchFirewallHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchFirewallHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String firewall; + private final Firewall firewallResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private PatchFirewallHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.firewall = null; + this.firewallResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private PatchFirewallHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String firewall, + Firewall firewallResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.firewall = firewall; + this.firewallResource = firewallResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("firewall")) { + return firewall; + } + if (fieldName.equals("firewallResource")) { + return firewallResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Firewall getApiMessageRequestBody() { + return firewallResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFirewall() { + return firewall; + } + + public Firewall getFirewallResource() { + return firewallResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchFirewallHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchFirewallHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchFirewallHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchFirewallHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String firewall; + private Firewall firewallResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchFirewallHttpRequest other) { + if (other == PatchFirewallHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFirewall() != null) { + this.firewall = other.firewall; + } + if (other.getFirewallResource() != null) { + this.firewallResource = other.firewallResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchFirewallHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.firewall = source.firewall; + this.firewallResource = source.firewallResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFirewall() { + return firewall; + } + + public Builder setFirewall(String firewall) { + this.firewall = firewall; + return this; + } + + public Firewall getFirewallResource() { + return firewallResource; + } + + public Builder setFirewallResource(Firewall firewallResource) { + this.firewallResource = firewallResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchFirewallHttpRequest build() { + String missing = ""; + + if (firewall == null) { + missing += " firewall"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchFirewallHttpRequest( + access_token, + callback, + fieldMask, + fields, + firewall, + firewallResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setFirewall(this.firewall); + newBuilder.setFirewallResource(this.firewallResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchFirewallHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "firewall=" + + firewall + + ", " + + "firewallResource=" + + firewallResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchFirewallHttpRequest) { + PatchFirewallHttpRequest that = (PatchFirewallHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.firewall, that.getFirewall()) + && Objects.equals(this.firewallResource, that.getFirewallResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + firewall, + firewallResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHealthCheckHttpRequest.java new file mode 100644 index 000000000000..4434ba523295 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHealthCheckHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String healthCheck; + private final HealthCheck healthCheckResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private PatchHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.healthCheck = null; + this.healthCheckResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private PatchHealthCheckHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String healthCheck, + HealthCheck healthCheckResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.healthCheck = healthCheck; + this.healthCheckResource = healthCheckResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("healthCheck")) { + return healthCheck; + } + if (fieldName.equals("healthCheckResource")) { + return healthCheckResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public HealthCheck getApiMessageRequestBody() { + return healthCheckResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHealthCheck() { + return healthCheck; + } + + public HealthCheck getHealthCheckResource() { + return healthCheckResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String healthCheck; + private HealthCheck healthCheckResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchHealthCheckHttpRequest other) { + if (other == PatchHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHealthCheck() != null) { + this.healthCheck = other.healthCheck; + } + if (other.getHealthCheckResource() != null) { + this.healthCheckResource = other.healthCheckResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.healthCheck = source.healthCheck; + this.healthCheckResource = source.healthCheckResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHealthCheck() { + return healthCheck; + } + + public Builder setHealthCheck(String healthCheck) { + this.healthCheck = healthCheck; + return this; + } + + public HealthCheck getHealthCheckResource() { + return healthCheckResource; + } + + public Builder setHealthCheckResource(HealthCheck healthCheckResource) { + this.healthCheckResource = healthCheckResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchHealthCheckHttpRequest build() { + String missing = ""; + + if (healthCheck == null) { + missing += " healthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchHealthCheckHttpRequest( + access_token, + callback, + fieldMask, + fields, + healthCheck, + healthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setHealthCheck(this.healthCheck); + newBuilder.setHealthCheckResource(this.healthCheckResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "healthCheck=" + + healthCheck + + ", " + + "healthCheckResource=" + + healthCheckResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchHealthCheckHttpRequest) { + PatchHealthCheckHttpRequest that = (PatchHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.healthCheck, that.getHealthCheck()) + && Objects.equals(this.healthCheckResource, that.getHealthCheckResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + healthCheck, + healthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpHealthCheckHttpRequest.java new file mode 100644 index 000000000000..547949750001 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpHealthCheckHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchHttpHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String httpHealthCheck; + private final HttpHealthCheck2 httpHealthCheckResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private PatchHttpHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.httpHealthCheck = null; + this.httpHealthCheckResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private PatchHttpHealthCheckHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String httpHealthCheck, + HttpHealthCheck2 httpHealthCheckResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.httpHealthCheck = httpHealthCheck; + this.httpHealthCheckResource = httpHealthCheckResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("httpHealthCheck")) { + return httpHealthCheck; + } + if (fieldName.equals("httpHealthCheckResource")) { + return httpHealthCheckResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public HttpHealthCheck2 getApiMessageRequestBody() { + return httpHealthCheckResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHttpHealthCheck() { + return httpHealthCheck; + } + + public HttpHealthCheck2 getHttpHealthCheckResource() { + return httpHealthCheckResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchHttpHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchHttpHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchHttpHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchHttpHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String httpHealthCheck; + private HttpHealthCheck2 httpHealthCheckResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchHttpHealthCheckHttpRequest other) { + if (other == PatchHttpHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHttpHealthCheck() != null) { + this.httpHealthCheck = other.httpHealthCheck; + } + if (other.getHttpHealthCheckResource() != null) { + this.httpHealthCheckResource = other.httpHealthCheckResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchHttpHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.httpHealthCheck = source.httpHealthCheck; + this.httpHealthCheckResource = source.httpHealthCheckResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHttpHealthCheck() { + return httpHealthCheck; + } + + public Builder setHttpHealthCheck(String httpHealthCheck) { + this.httpHealthCheck = httpHealthCheck; + return this; + } + + public HttpHealthCheck2 getHttpHealthCheckResource() { + return httpHealthCheckResource; + } + + public Builder setHttpHealthCheckResource(HttpHealthCheck2 httpHealthCheckResource) { + this.httpHealthCheckResource = httpHealthCheckResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchHttpHealthCheckHttpRequest build() { + String missing = ""; + + if (httpHealthCheck == null) { + missing += " httpHealthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchHttpHealthCheckHttpRequest( + access_token, + callback, + fieldMask, + fields, + httpHealthCheck, + httpHealthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setHttpHealthCheck(this.httpHealthCheck); + newBuilder.setHttpHealthCheckResource(this.httpHealthCheckResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchHttpHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "httpHealthCheck=" + + httpHealthCheck + + ", " + + "httpHealthCheckResource=" + + httpHealthCheckResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchHttpHealthCheckHttpRequest) { + PatchHttpHealthCheckHttpRequest that = (PatchHttpHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.httpHealthCheck, that.getHttpHealthCheck()) + && Objects.equals(this.httpHealthCheckResource, that.getHttpHealthCheckResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + httpHealthCheck, + httpHealthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpsHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpsHealthCheckHttpRequest.java new file mode 100644 index 000000000000..fca2a190e0ea --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpsHealthCheckHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchHttpsHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String httpsHealthCheck; + private final HttpsHealthCheck2 httpsHealthCheckResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private PatchHttpsHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.httpsHealthCheck = null; + this.httpsHealthCheckResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private PatchHttpsHealthCheckHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String httpsHealthCheck, + HttpsHealthCheck2 httpsHealthCheckResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.httpsHealthCheck = httpsHealthCheck; + this.httpsHealthCheckResource = httpsHealthCheckResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("httpsHealthCheck")) { + return httpsHealthCheck; + } + if (fieldName.equals("httpsHealthCheckResource")) { + return httpsHealthCheckResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public HttpsHealthCheck2 getApiMessageRequestBody() { + return httpsHealthCheckResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public HttpsHealthCheck2 getHttpsHealthCheckResource() { + return httpsHealthCheckResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchHttpsHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchHttpsHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchHttpsHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchHttpsHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String httpsHealthCheck; + private HttpsHealthCheck2 httpsHealthCheckResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchHttpsHealthCheckHttpRequest other) { + if (other == PatchHttpsHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHttpsHealthCheck() != null) { + this.httpsHealthCheck = other.httpsHealthCheck; + } + if (other.getHttpsHealthCheckResource() != null) { + this.httpsHealthCheckResource = other.httpsHealthCheckResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchHttpsHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.httpsHealthCheck = source.httpsHealthCheck; + this.httpsHealthCheckResource = source.httpsHealthCheckResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public Builder setHttpsHealthCheck(String httpsHealthCheck) { + this.httpsHealthCheck = httpsHealthCheck; + return this; + } + + public HttpsHealthCheck2 getHttpsHealthCheckResource() { + return httpsHealthCheckResource; + } + + public Builder setHttpsHealthCheckResource(HttpsHealthCheck2 httpsHealthCheckResource) { + this.httpsHealthCheckResource = httpsHealthCheckResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchHttpsHealthCheckHttpRequest build() { + String missing = ""; + + if (httpsHealthCheck == null) { + missing += " httpsHealthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchHttpsHealthCheckHttpRequest( + access_token, + callback, + fieldMask, + fields, + httpsHealthCheck, + httpsHealthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setHttpsHealthCheck(this.httpsHealthCheck); + newBuilder.setHttpsHealthCheckResource(this.httpsHealthCheckResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchHttpsHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "httpsHealthCheck=" + + httpsHealthCheck + + ", " + + "httpsHealthCheckResource=" + + httpsHealthCheckResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchHttpsHealthCheckHttpRequest) { + PatchHttpsHealthCheckHttpRequest that = (PatchHttpsHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.httpsHealthCheck, that.getHttpsHealthCheck()) + && Objects.equals(this.httpsHealthCheckResource, that.getHttpsHealthCheckResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + httpsHealthCheck, + httpsHealthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchInterconnectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchInterconnectHttpRequest.java new file mode 100644 index 000000000000..d6e8277ab9a5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchInterconnectHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchInterconnectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String interconnect; + private final Interconnect interconnectResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private PatchInterconnectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.interconnect = null; + this.interconnectResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private PatchInterconnectHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String interconnect, + Interconnect interconnectResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.interconnect = interconnect; + this.interconnectResource = interconnectResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("interconnect")) { + return interconnect; + } + if (fieldName.equals("interconnectResource")) { + return interconnectResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Interconnect getApiMessageRequestBody() { + return interconnectResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInterconnect() { + return interconnect; + } + + public Interconnect getInterconnectResource() { + return interconnectResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchInterconnectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchInterconnectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchInterconnectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchInterconnectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String interconnect; + private Interconnect interconnectResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchInterconnectHttpRequest other) { + if (other == PatchInterconnectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInterconnect() != null) { + this.interconnect = other.interconnect; + } + if (other.getInterconnectResource() != null) { + this.interconnectResource = other.interconnectResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchInterconnectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.interconnect = source.interconnect; + this.interconnectResource = source.interconnectResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInterconnect() { + return interconnect; + } + + public Builder setInterconnect(String interconnect) { + this.interconnect = interconnect; + return this; + } + + public Interconnect getInterconnectResource() { + return interconnectResource; + } + + public Builder setInterconnectResource(Interconnect interconnectResource) { + this.interconnectResource = interconnectResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchInterconnectHttpRequest build() { + String missing = ""; + + if (interconnect == null) { + missing += " interconnect"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchInterconnectHttpRequest( + access_token, + callback, + fieldMask, + fields, + interconnect, + interconnectResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setInterconnect(this.interconnect); + newBuilder.setInterconnectResource(this.interconnectResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchInterconnectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "interconnect=" + + interconnect + + ", " + + "interconnectResource=" + + interconnectResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchInterconnectHttpRequest) { + PatchInterconnectHttpRequest that = (PatchInterconnectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.interconnect, that.getInterconnect()) + && Objects.equals(this.interconnectResource, that.getInterconnectResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + interconnect, + interconnectResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchNetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchNetworkHttpRequest.java new file mode 100644 index 000000000000..28d763a2bf0c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchNetworkHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchNetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String network; + private final Network networkResource; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private PatchNetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.network = null; + this.networkResource = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private PatchNetworkHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String key, + String network, + Network networkResource, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.network = network; + this.networkResource = networkResource; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("networkResource")) { + return networkResource; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Network getApiMessageRequestBody() { + return networkResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getNetwork() { + return network; + } + + public Network getNetworkResource() { + return networkResource; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchNetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchNetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchNetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchNetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String network; + private Network networkResource; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchNetworkHttpRequest other) { + if (other == PatchNetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getNetworkResource() != null) { + this.networkResource = other.networkResource; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchNetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.network = source.network; + this.networkResource = source.networkResource; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public Network getNetworkResource() { + return networkResource; + } + + public Builder setNetworkResource(Network networkResource) { + this.networkResource = networkResource; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchNetworkHttpRequest build() { + String missing = ""; + + if (network == null) { + missing += " network"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchNetworkHttpRequest( + access_token, + callback, + fieldMask, + fields, + key, + network, + networkResource, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setNetwork(this.network); + newBuilder.setNetworkResource(this.networkResource); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchNetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "network=" + + network + + ", " + + "networkResource=" + + networkResource + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchNetworkHttpRequest) { + PatchNetworkHttpRequest that = (PatchNetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.networkResource, that.getNetworkResource()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + key, + network, + networkResource, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionAutoscalerHttpRequest.java new file mode 100644 index 000000000000..c3c81698c71e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionAutoscalerHttpRequest.java @@ -0,0 +1,505 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchRegionAutoscalerHttpRequest implements ApiMessage { + private final String access_token; + private final String autoscaler; + private final Autoscaler autoscalerResource; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final String userIp; + + private PatchRegionAutoscalerHttpRequest() { + this.access_token = null; + this.autoscaler = null; + this.autoscalerResource = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.userIp = null; + } + + private PatchRegionAutoscalerHttpRequest( + String access_token, + String autoscaler, + Autoscaler autoscalerResource, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + String userIp) { + this.access_token = access_token; + this.autoscaler = autoscaler; + this.autoscalerResource = autoscalerResource; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("autoscaler")) { + return autoscaler; + } + if (fieldName.equals("autoscalerResource")) { + return autoscalerResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Autoscaler getApiMessageRequestBody() { + return autoscalerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchRegionAutoscalerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchRegionAutoscalerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchRegionAutoscalerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchRegionAutoscalerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String autoscaler; + private Autoscaler autoscalerResource; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchRegionAutoscalerHttpRequest other) { + if (other == PatchRegionAutoscalerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAutoscaler() != null) { + this.autoscaler = other.autoscaler; + } + if (other.getAutoscalerResource() != null) { + this.autoscalerResource = other.autoscalerResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchRegionAutoscalerHttpRequest source) { + this.access_token = source.access_token; + this.autoscaler = source.autoscaler; + this.autoscalerResource = source.autoscalerResource; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Builder setAutoscaler(String autoscaler) { + this.autoscaler = autoscaler; + return this; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public Builder setAutoscalerResource(Autoscaler autoscalerResource) { + this.autoscalerResource = autoscalerResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchRegionAutoscalerHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchRegionAutoscalerHttpRequest( + access_token, + autoscaler, + autoscalerResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAutoscaler(this.autoscaler); + newBuilder.setAutoscalerResource(this.autoscalerResource); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchRegionAutoscalerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "autoscaler=" + + autoscaler + + ", " + + "autoscalerResource=" + + autoscalerResource + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchRegionAutoscalerHttpRequest) { + PatchRegionAutoscalerHttpRequest that = (PatchRegionAutoscalerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.autoscaler, that.getAutoscaler()) + && Objects.equals(this.autoscalerResource, that.getAutoscalerResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + autoscaler, + autoscalerResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionBackendServiceHttpRequest.java new file mode 100644 index 000000000000..4f91c71c2486 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionBackendServiceHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchRegionBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final String backendService; + private final BackendService backendServiceResource; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private PatchRegionBackendServiceHttpRequest() { + this.access_token = null; + this.backendService = null; + this.backendServiceResource = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private PatchRegionBackendServiceHttpRequest( + String access_token, + String backendService, + BackendService backendServiceResource, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendService = backendService; + this.backendServiceResource = backendServiceResource; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendService")) { + return backendService; + } + if (fieldName.equals("backendServiceResource")) { + return backendServiceResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public BackendService getApiMessageRequestBody() { + return backendServiceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendService() { + return backendService; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchRegionBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchRegionBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchRegionBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchRegionBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendService; + private BackendService backendServiceResource; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchRegionBackendServiceHttpRequest other) { + if (other == PatchRegionBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendService() != null) { + this.backendService = other.backendService; + } + if (other.getBackendServiceResource() != null) { + this.backendServiceResource = other.backendServiceResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchRegionBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendService = source.backendService; + this.backendServiceResource = source.backendServiceResource; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendService() { + return backendService; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public Builder setBackendServiceResource(BackendService backendServiceResource) { + this.backendServiceResource = backendServiceResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchRegionBackendServiceHttpRequest build() { + String missing = ""; + + if (backendService == null) { + missing += " backendService"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchRegionBackendServiceHttpRequest( + access_token, + backendService, + backendServiceResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendService(this.backendService); + newBuilder.setBackendServiceResource(this.backendServiceResource); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchRegionBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendService=" + + backendService + + ", " + + "backendServiceResource=" + + backendServiceResource + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchRegionBackendServiceHttpRequest) { + PatchRegionBackendServiceHttpRequest that = (PatchRegionBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.backendServiceResource, that.getBackendServiceResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendService, + backendServiceResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRouterHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRouterHttpRequest.java new file mode 100644 index 000000000000..bf550127c4f0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRouterHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchRouterHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String router; + private final Router routerResource; + private final String userIp; + + private PatchRouterHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.router = null; + this.routerResource = null; + this.userIp = null; + } + + private PatchRouterHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String router, + Router routerResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.router = router; + this.routerResource = routerResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("router")) { + return router; + } + if (fieldName.equals("routerResource")) { + return routerResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Router getApiMessageRequestBody() { + return routerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getRouter() { + return router; + } + + public Router getRouterResource() { + return routerResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchRouterHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchRouterHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchRouterHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchRouterHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String router; + private Router routerResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchRouterHttpRequest other) { + if (other == PatchRouterHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getRouter() != null) { + this.router = other.router; + } + if (other.getRouterResource() != null) { + this.routerResource = other.routerResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchRouterHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.router = source.router; + this.routerResource = source.routerResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getRouter() { + return router; + } + + public Builder setRouter(String router) { + this.router = router; + return this; + } + + public Router getRouterResource() { + return routerResource; + } + + public Builder setRouterResource(Router routerResource) { + this.routerResource = routerResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchRouterHttpRequest build() { + String missing = ""; + + if (router == null) { + missing += " router"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchRouterHttpRequest( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + router, + routerResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setRouter(this.router); + newBuilder.setRouterResource(this.routerResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchRouterHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "router=" + + router + + ", " + + "routerResource=" + + routerResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchRouterHttpRequest) { + PatchRouterHttpRequest that = (PatchRouterHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.router, that.getRouter()) + && Objects.equals(this.routerResource, that.getRouterResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + router, + routerResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSslPolicyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSslPolicyHttpRequest.java new file mode 100644 index 000000000000..41c751755cd8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSslPolicyHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchSslPolicyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String sslPolicy; + private final SslPolicy sslPolicyResource; + private final String userIp; + + private PatchSslPolicyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.sslPolicy = null; + this.sslPolicyResource = null; + this.userIp = null; + } + + private PatchSslPolicyHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String sslPolicy, + SslPolicy sslPolicyResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.sslPolicy = sslPolicy; + this.sslPolicyResource = sslPolicyResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("sslPolicy")) { + return sslPolicy; + } + if (fieldName.equals("sslPolicyResource")) { + return sslPolicyResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public SslPolicy getApiMessageRequestBody() { + return sslPolicyResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public SslPolicy getSslPolicyResource() { + return sslPolicyResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchSslPolicyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchSslPolicyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchSslPolicyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchSslPolicyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String sslPolicy; + private SslPolicy sslPolicyResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchSslPolicyHttpRequest other) { + if (other == PatchSslPolicyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSslPolicy() != null) { + this.sslPolicy = other.sslPolicy; + } + if (other.getSslPolicyResource() != null) { + this.sslPolicyResource = other.sslPolicyResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchSslPolicyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.sslPolicy = source.sslPolicy; + this.sslPolicyResource = source.sslPolicyResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public Builder setSslPolicy(String sslPolicy) { + this.sslPolicy = sslPolicy; + return this; + } + + public SslPolicy getSslPolicyResource() { + return sslPolicyResource; + } + + public Builder setSslPolicyResource(SslPolicy sslPolicyResource) { + this.sslPolicyResource = sslPolicyResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchSslPolicyHttpRequest build() { + String missing = ""; + + if (sslPolicy == null) { + missing += " sslPolicy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchSslPolicyHttpRequest( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + sslPolicy, + sslPolicyResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSslPolicy(this.sslPolicy); + newBuilder.setSslPolicyResource(this.sslPolicyResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchSslPolicyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "sslPolicy=" + + sslPolicy + + ", " + + "sslPolicyResource=" + + sslPolicyResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchSslPolicyHttpRequest) { + PatchSslPolicyHttpRequest that = (PatchSslPolicyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.sslPolicy, that.getSslPolicy()) + && Objects.equals(this.sslPolicyResource, that.getSslPolicyResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + sslPolicy, + sslPolicyResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSubnetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSubnetworkHttpRequest.java new file mode 100644 index 000000000000..0cb24e08eb02 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSubnetworkHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchSubnetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String subnetwork; + private final Subnetwork subnetworkResource; + private final String userIp; + + private PatchSubnetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.subnetwork = null; + this.subnetworkResource = null; + this.userIp = null; + } + + private PatchSubnetworkHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String subnetwork, + Subnetwork subnetworkResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.subnetwork = subnetwork; + this.subnetworkResource = subnetworkResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("subnetwork")) { + return subnetwork; + } + if (fieldName.equals("subnetworkResource")) { + return subnetworkResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Subnetwork getApiMessageRequestBody() { + return subnetworkResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getSubnetwork() { + return subnetwork; + } + + public Subnetwork getSubnetworkResource() { + return subnetworkResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchSubnetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchSubnetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchSubnetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchSubnetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String subnetwork; + private Subnetwork subnetworkResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchSubnetworkHttpRequest other) { + if (other == PatchSubnetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSubnetwork() != null) { + this.subnetwork = other.subnetwork; + } + if (other.getSubnetworkResource() != null) { + this.subnetworkResource = other.subnetworkResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchSubnetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.subnetwork = source.subnetwork; + this.subnetworkResource = source.subnetworkResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getSubnetwork() { + return subnetwork; + } + + public Builder setSubnetwork(String subnetwork) { + this.subnetwork = subnetwork; + return this; + } + + public Subnetwork getSubnetworkResource() { + return subnetworkResource; + } + + public Builder setSubnetworkResource(Subnetwork subnetworkResource) { + this.subnetworkResource = subnetworkResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchSubnetworkHttpRequest build() { + String missing = ""; + + if (subnetwork == null) { + missing += " subnetwork"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchSubnetworkHttpRequest( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + subnetwork, + subnetworkResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSubnetwork(this.subnetwork); + newBuilder.setSubnetworkResource(this.subnetworkResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchSubnetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "subnetwork=" + + subnetwork + + ", " + + "subnetworkResource=" + + subnetworkResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchSubnetworkHttpRequest) { + PatchSubnetworkHttpRequest that = (PatchSubnetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.subnetwork, that.getSubnetwork()) + && Objects.equals(this.subnetworkResource, that.getSubnetworkResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + subnetwork, + subnetworkResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchUrlMapHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchUrlMapHttpRequest.java new file mode 100644 index 000000000000..ec3e86f9e168 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchUrlMapHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PatchUrlMapHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String urlMap; + private final UrlMap urlMapResource; + private final String userIp; + + private PatchUrlMapHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.urlMap = null; + this.urlMapResource = null; + this.userIp = null; + } + + private PatchUrlMapHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String urlMap, + UrlMap urlMapResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.urlMap = urlMap; + this.urlMapResource = urlMapResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("urlMap")) { + return urlMap; + } + if (fieldName.equals("urlMapResource")) { + return urlMapResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public UrlMap getApiMessageRequestBody() { + return urlMapResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUrlMap() { + return urlMap; + } + + public UrlMap getUrlMapResource() { + return urlMapResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PatchUrlMapHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PatchUrlMapHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PatchUrlMapHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PatchUrlMapHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String urlMap; + private UrlMap urlMapResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PatchUrlMapHttpRequest other) { + if (other == PatchUrlMapHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUrlMap() != null) { + this.urlMap = other.urlMap; + } + if (other.getUrlMapResource() != null) { + this.urlMapResource = other.urlMapResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PatchUrlMapHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.urlMap = source.urlMap; + this.urlMapResource = source.urlMapResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUrlMap() { + return urlMap; + } + + public Builder setUrlMap(String urlMap) { + this.urlMap = urlMap; + return this; + } + + public UrlMap getUrlMapResource() { + return urlMapResource; + } + + public Builder setUrlMapResource(UrlMap urlMapResource) { + this.urlMapResource = urlMapResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PatchUrlMapHttpRequest build() { + String missing = ""; + + if (urlMap == null) { + missing += " urlMap"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PatchUrlMapHttpRequest( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + urlMap, + urlMapResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUrlMap(this.urlMap); + newBuilder.setUrlMapResource(this.urlMapResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PatchUrlMapHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "urlMap=" + + urlMap + + ", " + + "urlMapResource=" + + urlMapResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PatchUrlMapHttpRequest) { + PatchUrlMapHttpRequest that = (PatchUrlMapHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.urlMap, that.getUrlMap()) + && Objects.equals(this.urlMapResource, that.getUrlMapResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + urlMap, + urlMapResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PathMatcher.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PathMatcher.java new file mode 100644 index 000000000000..2afb86aaf9a3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PathMatcher.java @@ -0,0 +1,243 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PathMatcher implements ApiMessage { + private final String defaultService; + private final String description; + private final String name; + private final List pathRules; + + private PathMatcher() { + this.defaultService = null; + this.description = null; + this.name = null; + this.pathRules = null; + } + + private PathMatcher( + String defaultService, String description, String name, List pathRules) { + this.defaultService = defaultService; + this.description = description; + this.name = name; + this.pathRules = pathRules; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("defaultService")) { + return defaultService; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("pathRules")) { + return pathRules; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getDefaultService() { + return defaultService; + } + + public String getDescription() { + return description; + } + + public String getName() { + return name; + } + + public List getPathRulesList() { + return pathRules; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PathMatcher prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PathMatcher getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PathMatcher DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PathMatcher(); + } + + public static class Builder { + private String defaultService; + private String description; + private String name; + private List pathRules; + + Builder() {} + + public Builder mergeFrom(PathMatcher other) { + if (other == PathMatcher.getDefaultInstance()) return this; + if (other.getDefaultService() != null) { + this.defaultService = other.defaultService; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPathRulesList() != null) { + this.pathRules = other.pathRules; + } + return this; + } + + Builder(PathMatcher source) { + this.defaultService = source.defaultService; + this.description = source.description; + this.name = source.name; + this.pathRules = source.pathRules; + } + + public String getDefaultService() { + return defaultService; + } + + public Builder setDefaultService(String defaultService) { + this.defaultService = defaultService; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public List getPathRulesList() { + return pathRules; + } + + public Builder addAllPathRules(List pathRules) { + if (this.pathRules == null) { + this.pathRules = new ArrayList<>(pathRules.size()); + } + this.pathRules.addAll(pathRules); + return this; + } + + public Builder addPathRules(PathRule pathRules) { + this.pathRules.add(pathRules); + return this; + } + + public PathMatcher build() { + + return new PathMatcher(defaultService, description, name, pathRules); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDefaultService(this.defaultService); + newBuilder.setDescription(this.description); + newBuilder.setName(this.name); + newBuilder.addAllPathRules(this.pathRules); + return newBuilder; + } + } + + @Override + public String toString() { + return "PathMatcher{" + + "defaultService=" + + defaultService + + ", " + + "description=" + + description + + ", " + + "name=" + + name + + ", " + + "pathRules=" + + pathRules + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PathMatcher) { + PathMatcher that = (PathMatcher) o; + return Objects.equals(this.defaultService, that.getDefaultService()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.pathRules, that.getPathRulesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(defaultService, description, name, pathRules); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PathRule.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PathRule.java new file mode 100644 index 000000000000..88bbf46bf25a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PathRule.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PathRule implements ApiMessage { + private final List paths; + private final String service; + + private PathRule() { + this.paths = null; + this.service = null; + } + + private PathRule(List paths, String service) { + this.paths = paths; + this.service = service; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("paths")) { + return paths; + } + if (fieldName.equals("service")) { + return service; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getPathsList() { + return paths; + } + + public String getService() { + return service; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PathRule prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PathRule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PathRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PathRule(); + } + + public static class Builder { + private List paths; + private String service; + + Builder() {} + + public Builder mergeFrom(PathRule other) { + if (other == PathRule.getDefaultInstance()) return this; + if (other.getPathsList() != null) { + this.paths = other.paths; + } + if (other.getService() != null) { + this.service = other.service; + } + return this; + } + + Builder(PathRule source) { + this.paths = source.paths; + this.service = source.service; + } + + public List getPathsList() { + return paths; + } + + public Builder addAllPaths(List paths) { + if (this.paths == null) { + this.paths = new ArrayList<>(paths.size()); + } + this.paths.addAll(paths); + return this; + } + + public Builder addPaths(String paths) { + this.paths.add(paths); + return this; + } + + public String getService() { + return service; + } + + public Builder setService(String service) { + this.service = service; + return this; + } + + public PathRule build() { + + return new PathRule(paths, service); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllPaths(this.paths); + newBuilder.setService(this.service); + return newBuilder; + } + } + + @Override + public String toString() { + return "PathRule{" + "paths=" + paths + ", " + "service=" + service + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PathRule) { + PathRule that = (PathRule) o; + return Objects.equals(this.paths, that.getPathsList()) + && Objects.equals(this.service, that.getService()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(paths, service); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PreviewRouterHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PreviewRouterHttpRequest.java new file mode 100644 index 000000000000..c27d00c0cf1b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PreviewRouterHttpRequest.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class PreviewRouterHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String router; + private final Router routerResource; + private final String userIp; + + private PreviewRouterHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.router = null; + this.routerResource = null; + this.userIp = null; + } + + private PreviewRouterHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String router, + Router routerResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.router = router; + this.routerResource = routerResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("router")) { + return router; + } + if (fieldName.equals("routerResource")) { + return routerResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Router getApiMessageRequestBody() { + return routerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRouter() { + return router; + } + + public Router getRouterResource() { + return routerResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(PreviewRouterHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static PreviewRouterHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final PreviewRouterHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new PreviewRouterHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String router; + private Router routerResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(PreviewRouterHttpRequest other) { + if (other == PreviewRouterHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRouter() != null) { + this.router = other.router; + } + if (other.getRouterResource() != null) { + this.routerResource = other.routerResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(PreviewRouterHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.router = source.router; + this.routerResource = source.routerResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRouter() { + return router; + } + + public Builder setRouter(String router) { + this.router = router; + return this; + } + + public Router getRouterResource() { + return routerResource; + } + + public Builder setRouterResource(Router routerResource) { + this.routerResource = routerResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public PreviewRouterHttpRequest build() { + String missing = ""; + + if (router == null) { + missing += " router"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new PreviewRouterHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + router, + routerResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRouter(this.router); + newBuilder.setRouterResource(this.routerResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "PreviewRouterHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "router=" + + router + + ", " + + "routerResource=" + + routerResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof PreviewRouterHttpRequest) { + PreviewRouterHttpRequest that = (PreviewRouterHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.router, that.getRouter()) + && Objects.equals(this.routerResource, that.getRouterResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + router, + routerResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Project.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Project.java new file mode 100644 index 000000000000..e3522dc027f1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Project.java @@ -0,0 +1,518 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Project implements ApiMessage { + private final Metadata commonInstanceMetadata; + private final String creationTimestamp; + private final String defaultServiceAccount; + private final String description; + private final List enabledFeatures; + private final String id; + private final String kind; + private final String name; + private final List quotas; + private final String selfLink; + private final UsageExportLocation usageExportLocation; + private final String xpnProjectStatus; + + private Project() { + this.commonInstanceMetadata = null; + this.creationTimestamp = null; + this.defaultServiceAccount = null; + this.description = null; + this.enabledFeatures = null; + this.id = null; + this.kind = null; + this.name = null; + this.quotas = null; + this.selfLink = null; + this.usageExportLocation = null; + this.xpnProjectStatus = null; + } + + private Project( + Metadata commonInstanceMetadata, + String creationTimestamp, + String defaultServiceAccount, + String description, + List enabledFeatures, + String id, + String kind, + String name, + List quotas, + String selfLink, + UsageExportLocation usageExportLocation, + String xpnProjectStatus) { + this.commonInstanceMetadata = commonInstanceMetadata; + this.creationTimestamp = creationTimestamp; + this.defaultServiceAccount = defaultServiceAccount; + this.description = description; + this.enabledFeatures = enabledFeatures; + this.id = id; + this.kind = kind; + this.name = name; + this.quotas = quotas; + this.selfLink = selfLink; + this.usageExportLocation = usageExportLocation; + this.xpnProjectStatus = xpnProjectStatus; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("commonInstanceMetadata")) { + return commonInstanceMetadata; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("defaultServiceAccount")) { + return defaultServiceAccount; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("enabledFeatures")) { + return enabledFeatures; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("quotas")) { + return quotas; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("usageExportLocation")) { + return usageExportLocation; + } + if (fieldName.equals("xpnProjectStatus")) { + return xpnProjectStatus; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Metadata getCommonInstanceMetadata() { + return commonInstanceMetadata; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDefaultServiceAccount() { + return defaultServiceAccount; + } + + public String getDescription() { + return description; + } + + public List getEnabledFeaturesList() { + return enabledFeatures; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public List getQuotasList() { + return quotas; + } + + public String getSelfLink() { + return selfLink; + } + + public UsageExportLocation getUsageExportLocation() { + return usageExportLocation; + } + + public String getXpnProjectStatus() { + return xpnProjectStatus; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Project prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Project getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Project DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Project(); + } + + public static class Builder { + private Metadata commonInstanceMetadata; + private String creationTimestamp; + private String defaultServiceAccount; + private String description; + private List enabledFeatures; + private String id; + private String kind; + private String name; + private List quotas; + private String selfLink; + private UsageExportLocation usageExportLocation; + private String xpnProjectStatus; + + Builder() {} + + public Builder mergeFrom(Project other) { + if (other == Project.getDefaultInstance()) return this; + if (other.getCommonInstanceMetadata() != null) { + this.commonInstanceMetadata = other.commonInstanceMetadata; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDefaultServiceAccount() != null) { + this.defaultServiceAccount = other.defaultServiceAccount; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getEnabledFeaturesList() != null) { + this.enabledFeatures = other.enabledFeatures; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getQuotasList() != null) { + this.quotas = other.quotas; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getUsageExportLocation() != null) { + this.usageExportLocation = other.usageExportLocation; + } + if (other.getXpnProjectStatus() != null) { + this.xpnProjectStatus = other.xpnProjectStatus; + } + return this; + } + + Builder(Project source) { + this.commonInstanceMetadata = source.commonInstanceMetadata; + this.creationTimestamp = source.creationTimestamp; + this.defaultServiceAccount = source.defaultServiceAccount; + this.description = source.description; + this.enabledFeatures = source.enabledFeatures; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.quotas = source.quotas; + this.selfLink = source.selfLink; + this.usageExportLocation = source.usageExportLocation; + this.xpnProjectStatus = source.xpnProjectStatus; + } + + public Metadata getCommonInstanceMetadata() { + return commonInstanceMetadata; + } + + public Builder setCommonInstanceMetadata(Metadata commonInstanceMetadata) { + this.commonInstanceMetadata = commonInstanceMetadata; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDefaultServiceAccount() { + return defaultServiceAccount; + } + + public Builder setDefaultServiceAccount(String defaultServiceAccount) { + this.defaultServiceAccount = defaultServiceAccount; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public List getEnabledFeaturesList() { + return enabledFeatures; + } + + public Builder addAllEnabledFeatures(List enabledFeatures) { + if (this.enabledFeatures == null) { + this.enabledFeatures = new ArrayList<>(enabledFeatures.size()); + } + this.enabledFeatures.addAll(enabledFeatures); + return this; + } + + public Builder addEnabledFeatures(String enabledFeatures) { + this.enabledFeatures.add(enabledFeatures); + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public List getQuotasList() { + return quotas; + } + + public Builder addAllQuotas(List quotas) { + if (this.quotas == null) { + this.quotas = new ArrayList<>(quotas.size()); + } + this.quotas.addAll(quotas); + return this; + } + + public Builder addQuotas(Quota quotas) { + this.quotas.add(quotas); + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public UsageExportLocation getUsageExportLocation() { + return usageExportLocation; + } + + public Builder setUsageExportLocation(UsageExportLocation usageExportLocation) { + this.usageExportLocation = usageExportLocation; + return this; + } + + public String getXpnProjectStatus() { + return xpnProjectStatus; + } + + public Builder setXpnProjectStatus(String xpnProjectStatus) { + this.xpnProjectStatus = xpnProjectStatus; + return this; + } + + public Project build() { + + return new Project( + commonInstanceMetadata, + creationTimestamp, + defaultServiceAccount, + description, + enabledFeatures, + id, + kind, + name, + quotas, + selfLink, + usageExportLocation, + xpnProjectStatus); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCommonInstanceMetadata(this.commonInstanceMetadata); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDefaultServiceAccount(this.defaultServiceAccount); + newBuilder.setDescription(this.description); + newBuilder.addAllEnabledFeatures(this.enabledFeatures); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.addAllQuotas(this.quotas); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setUsageExportLocation(this.usageExportLocation); + newBuilder.setXpnProjectStatus(this.xpnProjectStatus); + return newBuilder; + } + } + + @Override + public String toString() { + return "Project{" + + "commonInstanceMetadata=" + + commonInstanceMetadata + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "defaultServiceAccount=" + + defaultServiceAccount + + ", " + + "description=" + + description + + ", " + + "enabledFeatures=" + + enabledFeatures + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "quotas=" + + quotas + + ", " + + "selfLink=" + + selfLink + + ", " + + "usageExportLocation=" + + usageExportLocation + + ", " + + "xpnProjectStatus=" + + xpnProjectStatus + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Project) { + Project that = (Project) o; + return Objects.equals(this.commonInstanceMetadata, that.getCommonInstanceMetadata()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.defaultServiceAccount, that.getDefaultServiceAccount()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.enabledFeatures, that.getEnabledFeaturesList()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.quotas, that.getQuotasList()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.usageExportLocation, that.getUsageExportLocation()) + && Objects.equals(this.xpnProjectStatus, that.getXpnProjectStatus()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + commonInstanceMetadata, + creationTimestamp, + defaultServiceAccount, + description, + enabledFeatures, + id, + kind, + name, + quotas, + selfLink, + usageExportLocation, + xpnProjectStatus); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectClient.java new file mode 100644 index 000000000000..51c5f47b353a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectClient.java @@ -0,0 +1,1707 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.ProjectStub; +import com.google.cloud.compute.v1.stub.ProjectStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (ProjectClient projectClient = ProjectClient.create()) {
+ *   ProjectName project = ProjectName.of("[PROJECT]");
+ *   Operation response = projectClient.disableXpnHostProject(project);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the projectClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of ProjectSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * ProjectSettings projectSettings =
+ *     ProjectSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ProjectClient projectClient =
+ *     ProjectClient.create(projectSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * ProjectSettings projectSettings =
+ *     ProjectSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ProjectClient projectClient =
+ *     ProjectClient.create(projectSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ProjectClient implements BackgroundResource { + private final ProjectSettings settings; + private final ProjectStub stub; + + /** Constructs an instance of ProjectClient with default settings. */ + public static final ProjectClient create() throws IOException { + return create(ProjectSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ProjectClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final ProjectClient create(ProjectSettings settings) throws IOException { + return new ProjectClient(settings); + } + + /** + * Constructs an instance of ProjectClient, using the given stub for making calls. This is for + * advanced usage - prefer to use ProjectSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final ProjectClient create(ProjectStub stub) { + return new ProjectClient(stub); + } + + /** + * Constructs an instance of ProjectClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected ProjectClient(ProjectSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ProjectStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected ProjectClient(ProjectStub stub) { + this.settings = null; + this.stub = stub; + } + + public final ProjectSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ProjectStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Disable this project as a shared VPC host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Operation response = projectClient.disableXpnHostProject(project);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation disableXpnHostProject(ProjectName project) { + + DisableXpnHostProjectHttpRequest request = + DisableXpnHostProjectHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return disableXpnHostProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Disable this project as a shared VPC host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Operation response = projectClient.disableXpnHostProject(project.toString());
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation disableXpnHostProject(String project) { + + DisableXpnHostProjectHttpRequest request = + DisableXpnHostProjectHttpRequest.newBuilder().setProject(project).build(); + return disableXpnHostProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Disable this project as a shared VPC host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   DisableXpnHostProjectHttpRequest request = DisableXpnHostProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   Operation response = projectClient.disableXpnHostProject(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation disableXpnHostProject(DisableXpnHostProjectHttpRequest request) { + return disableXpnHostProjectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Disable this project as a shared VPC host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   DisableXpnHostProjectHttpRequest request = DisableXpnHostProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = projectClient.disableXpnHostProjectCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + disableXpnHostProjectCallable() { + return stub.disableXpnHostProjectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Disable a serivce resource (a.k.a service project) associated with this host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource = ProjectsDisableXpnResourceRequest.newBuilder().build();
+   *   Operation response = projectClient.disableXpnResourceProject(project, projectsDisableXpnResourceRequestResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param projectsDisableXpnResourceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation disableXpnResourceProject( + ProjectName project, + ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource) { + + DisableXpnResourceProjectHttpRequest request = + DisableXpnResourceProjectHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setProjectsDisableXpnResourceRequestResource(projectsDisableXpnResourceRequestResource) + .build(); + return disableXpnResourceProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Disable a serivce resource (a.k.a service project) associated with this host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource = ProjectsDisableXpnResourceRequest.newBuilder().build();
+   *   Operation response = projectClient.disableXpnResourceProject(project.toString(), projectsDisableXpnResourceRequestResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param projectsDisableXpnResourceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation disableXpnResourceProject( + String project, ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource) { + + DisableXpnResourceProjectHttpRequest request = + DisableXpnResourceProjectHttpRequest.newBuilder() + .setProject(project) + .setProjectsDisableXpnResourceRequestResource(projectsDisableXpnResourceRequestResource) + .build(); + return disableXpnResourceProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Disable a serivce resource (a.k.a service project) associated with this host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource = ProjectsDisableXpnResourceRequest.newBuilder().build();
+   *   DisableXpnResourceProjectHttpRequest request = DisableXpnResourceProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setProjectsDisableXpnResourceRequestResource(projectsDisableXpnResourceRequestResource)
+   *     .build();
+   *   Operation response = projectClient.disableXpnResourceProject(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation disableXpnResourceProject(DisableXpnResourceProjectHttpRequest request) { + return disableXpnResourceProjectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Disable a serivce resource (a.k.a service project) associated with this host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource = ProjectsDisableXpnResourceRequest.newBuilder().build();
+   *   DisableXpnResourceProjectHttpRequest request = DisableXpnResourceProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setProjectsDisableXpnResourceRequestResource(projectsDisableXpnResourceRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = projectClient.disableXpnResourceProjectCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + disableXpnResourceProjectCallable() { + return stub.disableXpnResourceProjectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enable this project as a shared VPC host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Operation response = projectClient.enableXpnHostProject(project);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation enableXpnHostProject(ProjectName project) { + + EnableXpnHostProjectHttpRequest request = + EnableXpnHostProjectHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return enableXpnHostProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enable this project as a shared VPC host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Operation response = projectClient.enableXpnHostProject(project.toString());
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation enableXpnHostProject(String project) { + + EnableXpnHostProjectHttpRequest request = + EnableXpnHostProjectHttpRequest.newBuilder().setProject(project).build(); + return enableXpnHostProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enable this project as a shared VPC host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   EnableXpnHostProjectHttpRequest request = EnableXpnHostProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   Operation response = projectClient.enableXpnHostProject(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation enableXpnHostProject(EnableXpnHostProjectHttpRequest request) { + return enableXpnHostProjectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enable this project as a shared VPC host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   EnableXpnHostProjectHttpRequest request = EnableXpnHostProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = projectClient.enableXpnHostProjectCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + enableXpnHostProjectCallable() { + return stub.enableXpnHostProjectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enable service resource (a.k.a service project) for a host project, so that subnets in the host + * project can be used by instances in the service project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = ProjectsEnableXpnResourceRequest.newBuilder().build();
+   *   Operation response = projectClient.enableXpnResourceProject(project, projectsEnableXpnResourceRequestResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param projectsEnableXpnResourceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation enableXpnResourceProject( + ProjectName project, + ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource) { + + EnableXpnResourceProjectHttpRequest request = + EnableXpnResourceProjectHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setProjectsEnableXpnResourceRequestResource(projectsEnableXpnResourceRequestResource) + .build(); + return enableXpnResourceProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enable service resource (a.k.a service project) for a host project, so that subnets in the host + * project can be used by instances in the service project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = ProjectsEnableXpnResourceRequest.newBuilder().build();
+   *   Operation response = projectClient.enableXpnResourceProject(project.toString(), projectsEnableXpnResourceRequestResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param projectsEnableXpnResourceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation enableXpnResourceProject( + String project, ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource) { + + EnableXpnResourceProjectHttpRequest request = + EnableXpnResourceProjectHttpRequest.newBuilder() + .setProject(project) + .setProjectsEnableXpnResourceRequestResource(projectsEnableXpnResourceRequestResource) + .build(); + return enableXpnResourceProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enable service resource (a.k.a service project) for a host project, so that subnets in the host + * project can be used by instances in the service project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = ProjectsEnableXpnResourceRequest.newBuilder().build();
+   *   EnableXpnResourceProjectHttpRequest request = EnableXpnResourceProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setProjectsEnableXpnResourceRequestResource(projectsEnableXpnResourceRequestResource)
+   *     .build();
+   *   Operation response = projectClient.enableXpnResourceProject(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation enableXpnResourceProject(EnableXpnResourceProjectHttpRequest request) { + return enableXpnResourceProjectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enable service resource (a.k.a service project) for a host project, so that subnets in the host + * project can be used by instances in the service project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = ProjectsEnableXpnResourceRequest.newBuilder().build();
+   *   EnableXpnResourceProjectHttpRequest request = EnableXpnResourceProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setProjectsEnableXpnResourceRequestResource(projectsEnableXpnResourceRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = projectClient.enableXpnResourceProjectCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + enableXpnResourceProjectCallable() { + return stub.enableXpnResourceProjectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Project resource. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Project response = projectClient.getProject(project);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Project getProject(ProjectName project) { + + GetProjectHttpRequest request = + GetProjectHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return getProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Project resource. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Project response = projectClient.getProject(project.toString());
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Project getProject(String project) { + + GetProjectHttpRequest request = GetProjectHttpRequest.newBuilder().setProject(project).build(); + return getProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Project resource. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   GetProjectHttpRequest request = GetProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   Project response = projectClient.getProject(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + private final Project getProject(GetProjectHttpRequest request) { + return getProjectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Project resource. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   GetProjectHttpRequest request = GetProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<Project> future = projectClient.getProjectCallable().futureCall(request);
+   *   // Do something
+   *   Project response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getProjectCallable() { + return stub.getProjectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the shared VPC host project that this project links to. May be empty if no link exists. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Project response = projectClient.getXpnHostProject(project);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Project getXpnHostProject(ProjectName project) { + + GetXpnHostProjectHttpRequest request = + GetXpnHostProjectHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return getXpnHostProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the shared VPC host project that this project links to. May be empty if no link exists. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Project response = projectClient.getXpnHostProject(project.toString());
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Project getXpnHostProject(String project) { + + GetXpnHostProjectHttpRequest request = + GetXpnHostProjectHttpRequest.newBuilder().setProject(project).build(); + return getXpnHostProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the shared VPC host project that this project links to. May be empty if no link exists. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   GetXpnHostProjectHttpRequest request = GetXpnHostProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   Project response = projectClient.getXpnHostProject(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + private final Project getXpnHostProject(GetXpnHostProjectHttpRequest request) { + return getXpnHostProjectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the shared VPC host project that this project links to. May be empty if no link exists. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   GetXpnHostProjectHttpRequest request = GetXpnHostProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<Project> future = projectClient.getXpnHostProjectCallable().futureCall(request);
+   *   // Do something
+   *   Project response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getXpnHostProjectCallable() { + return stub.getXpnHostProjectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets service resources (a.k.a service project) associated with this host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (XpnResourceId element : projectClient.getXpnResourcesProjects(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final GetXpnResourcesProjectsPagedResponse getXpnResourcesProjects(ProjectName project) { + GetXpnResourcesProjectsHttpRequest request = + GetXpnResourcesProjectsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return getXpnResourcesProjects(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets service resources (a.k.a service project) associated with this host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (XpnResourceId element : projectClient.getXpnResourcesProjects(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final GetXpnResourcesProjectsPagedResponse getXpnResourcesProjects(String project) { + GetXpnResourcesProjectsHttpRequest request = + GetXpnResourcesProjectsHttpRequest.newBuilder().setProject(project).build(); + return getXpnResourcesProjects(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets service resources (a.k.a service project) associated with this host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   GetXpnResourcesProjectsHttpRequest request = GetXpnResourcesProjectsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (XpnResourceId element : projectClient.getXpnResourcesProjects(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final GetXpnResourcesProjectsPagedResponse getXpnResourcesProjects( + GetXpnResourcesProjectsHttpRequest request) { + return getXpnResourcesProjectsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets service resources (a.k.a service project) associated with this host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   GetXpnResourcesProjectsHttpRequest request = GetXpnResourcesProjectsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<GetXpnResourcesProjectsPagedResponse> future = projectClient.getXpnResourcesProjectsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (XpnResourceId element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + GetXpnResourcesProjectsHttpRequest, GetXpnResourcesProjectsPagedResponse> + getXpnResourcesProjectsPagedCallable() { + return stub.getXpnResourcesProjectsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets service resources (a.k.a service project) associated with this host project. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   GetXpnResourcesProjectsHttpRequest request = GetXpnResourcesProjectsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     ProjectsGetXpnResources response = projectClient.getXpnResourcesProjectsCallable().call(request);
+   *     for (XpnResourceId element : response.getResourcesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getXpnResourcesProjectsCallable() { + return stub.getXpnResourcesProjectsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all shared VPC host projects visible to the user in an organization. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = ProjectsListXpnHostsRequest.newBuilder().build();
+   *   for (Project element : projectClient.listXpnHostsProjects(project, projectsListXpnHostsRequestResource).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param projectsListXpnHostsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListXpnHostsProjectsPagedResponse listXpnHostsProjects( + ProjectName project, ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource) { + ListXpnHostsProjectsHttpRequest request = + ListXpnHostsProjectsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setProjectsListXpnHostsRequestResource(projectsListXpnHostsRequestResource) + .build(); + return listXpnHostsProjects(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all shared VPC host projects visible to the user in an organization. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = ProjectsListXpnHostsRequest.newBuilder().build();
+   *   for (Project element : projectClient.listXpnHostsProjects(project.toString(), projectsListXpnHostsRequestResource).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param projectsListXpnHostsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListXpnHostsProjectsPagedResponse listXpnHostsProjects( + String project, ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource) { + ListXpnHostsProjectsHttpRequest request = + ListXpnHostsProjectsHttpRequest.newBuilder() + .setProject(project) + .setProjectsListXpnHostsRequestResource(projectsListXpnHostsRequestResource) + .build(); + return listXpnHostsProjects(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all shared VPC host projects visible to the user in an organization. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = ProjectsListXpnHostsRequest.newBuilder().build();
+   *   ListXpnHostsProjectsHttpRequest request = ListXpnHostsProjectsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setProjectsListXpnHostsRequestResource(projectsListXpnHostsRequestResource)
+   *     .build();
+   *   for (Project element : projectClient.listXpnHostsProjects(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListXpnHostsProjectsPagedResponse listXpnHostsProjects( + ListXpnHostsProjectsHttpRequest request) { + return listXpnHostsProjectsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all shared VPC host projects visible to the user in an organization. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = ProjectsListXpnHostsRequest.newBuilder().build();
+   *   ListXpnHostsProjectsHttpRequest request = ListXpnHostsProjectsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setProjectsListXpnHostsRequestResource(projectsListXpnHostsRequestResource)
+   *     .build();
+   *   ApiFuture<ListXpnHostsProjectsPagedResponse> future = projectClient.listXpnHostsProjectsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Project element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listXpnHostsProjectsPagedCallable() { + return stub.listXpnHostsProjectsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all shared VPC host projects visible to the user in an organization. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = ProjectsListXpnHostsRequest.newBuilder().build();
+   *   ListXpnHostsProjectsHttpRequest request = ListXpnHostsProjectsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setProjectsListXpnHostsRequestResource(projectsListXpnHostsRequestResource)
+   *     .build();
+   *   while (true) {
+   *     XpnHostList response = projectClient.listXpnHostsProjectsCallable().call(request);
+   *     for (Project element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listXpnHostsProjectsCallable() { + return stub.listXpnHostsProjectsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Moves a persistent disk from one zone to another. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build();
+   *   Operation response = projectClient.moveDiskProject(project, diskMoveRequestResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param diskMoveRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation moveDiskProject( + ProjectName project, DiskMoveRequest diskMoveRequestResource) { + + MoveDiskProjectHttpRequest request = + MoveDiskProjectHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setDiskMoveRequestResource(diskMoveRequestResource) + .build(); + return moveDiskProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Moves a persistent disk from one zone to another. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build();
+   *   Operation response = projectClient.moveDiskProject(project.toString(), diskMoveRequestResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param diskMoveRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation moveDiskProject(String project, DiskMoveRequest diskMoveRequestResource) { + + MoveDiskProjectHttpRequest request = + MoveDiskProjectHttpRequest.newBuilder() + .setProject(project) + .setDiskMoveRequestResource(diskMoveRequestResource) + .build(); + return moveDiskProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Moves a persistent disk from one zone to another. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build();
+   *   MoveDiskProjectHttpRequest request = MoveDiskProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setDiskMoveRequestResource(diskMoveRequestResource)
+   *     .build();
+   *   Operation response = projectClient.moveDiskProject(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation moveDiskProject(MoveDiskProjectHttpRequest request) { + return moveDiskProjectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Moves a persistent disk from one zone to another. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build();
+   *   MoveDiskProjectHttpRequest request = MoveDiskProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setDiskMoveRequestResource(diskMoveRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = projectClient.moveDiskProjectCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable moveDiskProjectCallable() { + return stub.moveDiskProjectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Moves an instance and its attached persistent disks from one zone to another. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   InstanceMoveRequest instanceMoveRequestResource = InstanceMoveRequest.newBuilder().build();
+   *   Operation response = projectClient.moveInstanceProject(project, instanceMoveRequestResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param instanceMoveRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation moveInstanceProject( + ProjectName project, InstanceMoveRequest instanceMoveRequestResource) { + + MoveInstanceProjectHttpRequest request = + MoveInstanceProjectHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setInstanceMoveRequestResource(instanceMoveRequestResource) + .build(); + return moveInstanceProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Moves an instance and its attached persistent disks from one zone to another. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   InstanceMoveRequest instanceMoveRequestResource = InstanceMoveRequest.newBuilder().build();
+   *   Operation response = projectClient.moveInstanceProject(project.toString(), instanceMoveRequestResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param instanceMoveRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation moveInstanceProject( + String project, InstanceMoveRequest instanceMoveRequestResource) { + + MoveInstanceProjectHttpRequest request = + MoveInstanceProjectHttpRequest.newBuilder() + .setProject(project) + .setInstanceMoveRequestResource(instanceMoveRequestResource) + .build(); + return moveInstanceProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Moves an instance and its attached persistent disks from one zone to another. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   InstanceMoveRequest instanceMoveRequestResource = InstanceMoveRequest.newBuilder().build();
+   *   MoveInstanceProjectHttpRequest request = MoveInstanceProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setInstanceMoveRequestResource(instanceMoveRequestResource)
+   *     .build();
+   *   Operation response = projectClient.moveInstanceProject(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation moveInstanceProject(MoveInstanceProjectHttpRequest request) { + return moveInstanceProjectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Moves an instance and its attached persistent disks from one zone to another. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   InstanceMoveRequest instanceMoveRequestResource = InstanceMoveRequest.newBuilder().build();
+   *   MoveInstanceProjectHttpRequest request = MoveInstanceProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setInstanceMoveRequestResource(instanceMoveRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = projectClient.moveInstanceProjectCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + moveInstanceProjectCallable() { + return stub.moveInstanceProjectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets metadata common to all instances within the specified project using the data included in + * the request. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Metadata metadataResource = Metadata.newBuilder().build();
+   *   Operation response = projectClient.setCommonInstanceMetadataProject(project, metadataResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param metadataResource A metadata key/value entry. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setCommonInstanceMetadataProject( + ProjectName project, Metadata metadataResource) { + + SetCommonInstanceMetadataProjectHttpRequest request = + SetCommonInstanceMetadataProjectHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setMetadataResource(metadataResource) + .build(); + return setCommonInstanceMetadataProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets metadata common to all instances within the specified project using the data included in + * the request. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Metadata metadataResource = Metadata.newBuilder().build();
+   *   Operation response = projectClient.setCommonInstanceMetadataProject(project.toString(), metadataResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param metadataResource A metadata key/value entry. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setCommonInstanceMetadataProject( + String project, Metadata metadataResource) { + + SetCommonInstanceMetadataProjectHttpRequest request = + SetCommonInstanceMetadataProjectHttpRequest.newBuilder() + .setProject(project) + .setMetadataResource(metadataResource) + .build(); + return setCommonInstanceMetadataProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets metadata common to all instances within the specified project using the data included in + * the request. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Metadata metadataResource = Metadata.newBuilder().build();
+   *   SetCommonInstanceMetadataProjectHttpRequest request = SetCommonInstanceMetadataProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setMetadataResource(metadataResource)
+   *     .build();
+   *   Operation response = projectClient.setCommonInstanceMetadataProject(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setCommonInstanceMetadataProject( + SetCommonInstanceMetadataProjectHttpRequest request) { + return setCommonInstanceMetadataProjectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets metadata common to all instances within the specified project using the data included in + * the request. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Metadata metadataResource = Metadata.newBuilder().build();
+   *   SetCommonInstanceMetadataProjectHttpRequest request = SetCommonInstanceMetadataProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setMetadataResource(metadataResource)
+   *     .build();
+   *   ApiFuture<Operation> future = projectClient.setCommonInstanceMetadataProjectCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setCommonInstanceMetadataProjectCallable() { + return stub.setCommonInstanceMetadataProjectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enables the usage export feature and sets the usage export bucket where reports are stored. If + * you provide an empty request body using this method, the usage export feature will be disabled. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   UsageExportLocation usageExportLocationResource = UsageExportLocation.newBuilder().build();
+   *   Operation response = projectClient.setUsageExportBucketProject(project, usageExportLocationResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param usageExportLocationResource The location in Cloud Storage and naming method of the daily + * usage report. Contains bucket_name and report_name prefix. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setUsageExportBucketProject( + ProjectName project, UsageExportLocation usageExportLocationResource) { + + SetUsageExportBucketProjectHttpRequest request = + SetUsageExportBucketProjectHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setUsageExportLocationResource(usageExportLocationResource) + .build(); + return setUsageExportBucketProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enables the usage export feature and sets the usage export bucket where reports are stored. If + * you provide an empty request body using this method, the usage export feature will be disabled. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   UsageExportLocation usageExportLocationResource = UsageExportLocation.newBuilder().build();
+   *   Operation response = projectClient.setUsageExportBucketProject(project.toString(), usageExportLocationResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param usageExportLocationResource The location in Cloud Storage and naming method of the daily + * usage report. Contains bucket_name and report_name prefix. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setUsageExportBucketProject( + String project, UsageExportLocation usageExportLocationResource) { + + SetUsageExportBucketProjectHttpRequest request = + SetUsageExportBucketProjectHttpRequest.newBuilder() + .setProject(project) + .setUsageExportLocationResource(usageExportLocationResource) + .build(); + return setUsageExportBucketProject(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enables the usage export feature and sets the usage export bucket where reports are stored. If + * you provide an empty request body using this method, the usage export feature will be disabled. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   UsageExportLocation usageExportLocationResource = UsageExportLocation.newBuilder().build();
+   *   SetUsageExportBucketProjectHttpRequest request = SetUsageExportBucketProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setUsageExportLocationResource(usageExportLocationResource)
+   *     .build();
+   *   Operation response = projectClient.setUsageExportBucketProject(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setUsageExportBucketProject( + SetUsageExportBucketProjectHttpRequest request) { + return setUsageExportBucketProjectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Enables the usage export feature and sets the usage export bucket where reports are stored. If + * you provide an empty request body using this method, the usage export feature will be disabled. + * + *

Sample code: + * + *


+   * try (ProjectClient projectClient = ProjectClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   UsageExportLocation usageExportLocationResource = UsageExportLocation.newBuilder().build();
+   *   SetUsageExportBucketProjectHttpRequest request = SetUsageExportBucketProjectHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setUsageExportLocationResource(usageExportLocationResource)
+   *     .build();
+   *   ApiFuture<Operation> future = projectClient.setUsageExportBucketProjectCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setUsageExportBucketProjectCallable() { + return stub.setUsageExportBucketProjectCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class GetXpnResourcesProjectsPagedResponse + extends AbstractPagedListResponse< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, XpnResourceId, + GetXpnResourcesProjectsPage, GetXpnResourcesProjectsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + GetXpnResourcesProjectsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public GetXpnResourcesProjectsPagedResponse apply(GetXpnResourcesProjectsPage input) { + return new GetXpnResourcesProjectsPagedResponse(input); + } + }); + } + + private GetXpnResourcesProjectsPagedResponse(GetXpnResourcesProjectsPage page) { + super(page, GetXpnResourcesProjectsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class GetXpnResourcesProjectsPage + extends AbstractPage< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, XpnResourceId, + GetXpnResourcesProjectsPage> { + + private GetXpnResourcesProjectsPage( + PageContext + context, + ProjectsGetXpnResources response) { + super(context, response); + } + + private static GetXpnResourcesProjectsPage createEmptyPage() { + return new GetXpnResourcesProjectsPage(null, null); + } + + @Override + protected GetXpnResourcesProjectsPage createPage( + PageContext + context, + ProjectsGetXpnResources response) { + return new GetXpnResourcesProjectsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class GetXpnResourcesProjectsFixedSizeCollection + extends AbstractFixedSizeCollection< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, XpnResourceId, + GetXpnResourcesProjectsPage, GetXpnResourcesProjectsFixedSizeCollection> { + + private GetXpnResourcesProjectsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static GetXpnResourcesProjectsFixedSizeCollection createEmptyCollection() { + return new GetXpnResourcesProjectsFixedSizeCollection(null, 0); + } + + @Override + protected GetXpnResourcesProjectsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new GetXpnResourcesProjectsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListXpnHostsProjectsPagedResponse + extends AbstractPagedListResponse< + ListXpnHostsProjectsHttpRequest, XpnHostList, Project, ListXpnHostsProjectsPage, + ListXpnHostsProjectsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListXpnHostsProjectsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListXpnHostsProjectsPagedResponse apply(ListXpnHostsProjectsPage input) { + return new ListXpnHostsProjectsPagedResponse(input); + } + }); + } + + private ListXpnHostsProjectsPagedResponse(ListXpnHostsProjectsPage page) { + super(page, ListXpnHostsProjectsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListXpnHostsProjectsPage + extends AbstractPage< + ListXpnHostsProjectsHttpRequest, XpnHostList, Project, ListXpnHostsProjectsPage> { + + private ListXpnHostsProjectsPage( + PageContext context, + XpnHostList response) { + super(context, response); + } + + private static ListXpnHostsProjectsPage createEmptyPage() { + return new ListXpnHostsProjectsPage(null, null); + } + + @Override + protected ListXpnHostsProjectsPage createPage( + PageContext context, + XpnHostList response) { + return new ListXpnHostsProjectsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListXpnHostsProjectsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListXpnHostsProjectsHttpRequest, XpnHostList, Project, ListXpnHostsProjectsPage, + ListXpnHostsProjectsFixedSizeCollection> { + + private ListXpnHostsProjectsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListXpnHostsProjectsFixedSizeCollection createEmptyCollection() { + return new ListXpnHostsProjectsFixedSizeCollection(null, 0); + } + + @Override + protected ListXpnHostsProjectsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListXpnHostsProjectsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalAddressName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalAddressName.java new file mode 100644 index 000000000000..aef55a983e42 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalAddressName.java @@ -0,0 +1,163 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalAddressName implements ResourceName { + private final String address; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/addresses/{address}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalAddressName(Builder builder) { + address = Preconditions.checkNotNull(builder.getAddress()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalAddressName of(String address, String project) { + return newBuilder().setAddress(address).setProject(project).build(); + } + + public static String format(String address, String project) { + return of(address, project).toString(); + } + + public String getAddress() { + return address; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("address", address); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalAddressName parse(String formattedString) { + return ProjectGlobalAddressName.parse(formattedString); + } + }; + } + + public static ProjectGlobalAddressName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectGlobalAddressName.parse: formattedString not in valid format"); + return of(matchMap.get("address"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String address; + private String project; + + public String getAddress() { + return address; + } + + public String getProject() { + return project; + } + + public Builder setAddress(String address) { + this.address = address; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalAddressName projectGlobalAddressName) { + address = projectGlobalAddressName.address; + project = projectGlobalAddressName.project; + } + + public ProjectGlobalAddressName build() { + return new ProjectGlobalAddressName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "address", address, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalAddressName) { + ProjectGlobalAddressName that = (ProjectGlobalAddressName) o; + return Objects.equals(this.address, that.getAddress()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(address, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalBackendBucketName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalBackendBucketName.java new file mode 100644 index 000000000000..2c7efcb5b2f4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalBackendBucketName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalBackendBucketName implements ResourceName { + private final String backendBucket; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/backendBuckets/{backendBucket}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalBackendBucketName(Builder builder) { + backendBucket = Preconditions.checkNotNull(builder.getBackendBucket()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalBackendBucketName of(String backendBucket, String project) { + return newBuilder().setBackendBucket(backendBucket).setProject(project).build(); + } + + public static String format(String backendBucket, String project) { + return of(backendBucket, project).toString(); + } + + public String getBackendBucket() { + return backendBucket; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("backendBucket", backendBucket); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalBackendBucketName parse(String formattedString) { + return ProjectGlobalBackendBucketName.parse(formattedString); + } + }; + } + + public static ProjectGlobalBackendBucketName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalBackendBucketName.parse: formattedString not in valid format"); + return of(matchMap.get("backendBucket"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String backendBucket; + private String project; + + public String getBackendBucket() { + return backendBucket; + } + + public String getProject() { + return project; + } + + public Builder setBackendBucket(String backendBucket) { + this.backendBucket = backendBucket; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalBackendBucketName projectGlobalBackendBucketName) { + backendBucket = projectGlobalBackendBucketName.backendBucket; + project = projectGlobalBackendBucketName.project; + } + + public ProjectGlobalBackendBucketName build() { + return new ProjectGlobalBackendBucketName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "backendBucket", backendBucket, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalBackendBucketName) { + ProjectGlobalBackendBucketName that = (ProjectGlobalBackendBucketName) o; + return Objects.equals(this.backendBucket, that.getBackendBucket()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(backendBucket, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalBackendServiceName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalBackendServiceName.java new file mode 100644 index 000000000000..a134a701f0fc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalBackendServiceName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalBackendServiceName implements ResourceName { + private final String backendService; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/backendServices/{backendService}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalBackendServiceName(Builder builder) { + backendService = Preconditions.checkNotNull(builder.getBackendService()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalBackendServiceName of(String backendService, String project) { + return newBuilder().setBackendService(backendService).setProject(project).build(); + } + + public static String format(String backendService, String project) { + return of(backendService, project).toString(); + } + + public String getBackendService() { + return backendService; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("backendService", backendService); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalBackendServiceName parse(String formattedString) { + return ProjectGlobalBackendServiceName.parse(formattedString); + } + }; + } + + public static ProjectGlobalBackendServiceName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalBackendServiceName.parse: formattedString not in valid format"); + return of(matchMap.get("backendService"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String backendService; + private String project; + + public String getBackendService() { + return backendService; + } + + public String getProject() { + return project; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalBackendServiceName projectGlobalBackendServiceName) { + backendService = projectGlobalBackendServiceName.backendService; + project = projectGlobalBackendServiceName.project; + } + + public ProjectGlobalBackendServiceName build() { + return new ProjectGlobalBackendServiceName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "backendService", backendService, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalBackendServiceName) { + ProjectGlobalBackendServiceName that = (ProjectGlobalBackendServiceName) o; + return Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(backendService, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalFirewallName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalFirewallName.java new file mode 100644 index 000000000000..af760bb7c9e5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalFirewallName.java @@ -0,0 +1,164 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalFirewallName implements ResourceName { + private final String firewall; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/firewalls/{firewall}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalFirewallName(Builder builder) { + firewall = Preconditions.checkNotNull(builder.getFirewall()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalFirewallName of(String firewall, String project) { + return newBuilder().setFirewall(firewall).setProject(project).build(); + } + + public static String format(String firewall, String project) { + return of(firewall, project).toString(); + } + + public String getFirewall() { + return firewall; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("firewall", firewall); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalFirewallName parse(String formattedString) { + return ProjectGlobalFirewallName.parse(formattedString); + } + }; + } + + public static ProjectGlobalFirewallName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalFirewallName.parse: formattedString not in valid format"); + return of(matchMap.get("firewall"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String firewall; + private String project; + + public String getFirewall() { + return firewall; + } + + public String getProject() { + return project; + } + + public Builder setFirewall(String firewall) { + this.firewall = firewall; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalFirewallName projectGlobalFirewallName) { + firewall = projectGlobalFirewallName.firewall; + project = projectGlobalFirewallName.project; + } + + public ProjectGlobalFirewallName build() { + return new ProjectGlobalFirewallName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "firewall", firewall, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalFirewallName) { + ProjectGlobalFirewallName that = (ProjectGlobalFirewallName) o; + return Objects.equals(this.firewall, that.getFirewall()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(firewall, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalForwardingRuleName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalForwardingRuleName.java new file mode 100644 index 000000000000..8fcf192fc910 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalForwardingRuleName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalForwardingRuleName implements ResourceName { + private final String forwardingRule; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/forwardingRules/{forwardingRule}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalForwardingRuleName(Builder builder) { + forwardingRule = Preconditions.checkNotNull(builder.getForwardingRule()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalForwardingRuleName of(String forwardingRule, String project) { + return newBuilder().setForwardingRule(forwardingRule).setProject(project).build(); + } + + public static String format(String forwardingRule, String project) { + return of(forwardingRule, project).toString(); + } + + public String getForwardingRule() { + return forwardingRule; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("forwardingRule", forwardingRule); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalForwardingRuleName parse(String formattedString) { + return ProjectGlobalForwardingRuleName.parse(formattedString); + } + }; + } + + public static ProjectGlobalForwardingRuleName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalForwardingRuleName.parse: formattedString not in valid format"); + return of(matchMap.get("forwardingRule"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String forwardingRule; + private String project; + + public String getForwardingRule() { + return forwardingRule; + } + + public String getProject() { + return project; + } + + public Builder setForwardingRule(String forwardingRule) { + this.forwardingRule = forwardingRule; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalForwardingRuleName projectGlobalForwardingRuleName) { + forwardingRule = projectGlobalForwardingRuleName.forwardingRule; + project = projectGlobalForwardingRuleName.project; + } + + public ProjectGlobalForwardingRuleName build() { + return new ProjectGlobalForwardingRuleName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "forwardingRule", forwardingRule, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalForwardingRuleName) { + ProjectGlobalForwardingRuleName that = (ProjectGlobalForwardingRuleName) o; + return Objects.equals(this.forwardingRule, that.getForwardingRule()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(forwardingRule, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalHealthCheckName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalHealthCheckName.java new file mode 100644 index 000000000000..30c28b855e22 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalHealthCheckName.java @@ -0,0 +1,164 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalHealthCheckName implements ResourceName { + private final String healthCheck; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/healthChecks/{healthCheck}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalHealthCheckName(Builder builder) { + healthCheck = Preconditions.checkNotNull(builder.getHealthCheck()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalHealthCheckName of(String healthCheck, String project) { + return newBuilder().setHealthCheck(healthCheck).setProject(project).build(); + } + + public static String format(String healthCheck, String project) { + return of(healthCheck, project).toString(); + } + + public String getHealthCheck() { + return healthCheck; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("healthCheck", healthCheck); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalHealthCheckName parse(String formattedString) { + return ProjectGlobalHealthCheckName.parse(formattedString); + } + }; + } + + public static ProjectGlobalHealthCheckName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalHealthCheckName.parse: formattedString not in valid format"); + return of(matchMap.get("healthCheck"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String healthCheck; + private String project; + + public String getHealthCheck() { + return healthCheck; + } + + public String getProject() { + return project; + } + + public Builder setHealthCheck(String healthCheck) { + this.healthCheck = healthCheck; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalHealthCheckName projectGlobalHealthCheckName) { + healthCheck = projectGlobalHealthCheckName.healthCheck; + project = projectGlobalHealthCheckName.project; + } + + public ProjectGlobalHealthCheckName build() { + return new ProjectGlobalHealthCheckName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "healthCheck", healthCheck, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalHealthCheckName) { + ProjectGlobalHealthCheckName that = (ProjectGlobalHealthCheckName) o; + return Objects.equals(this.healthCheck, that.getHealthCheck()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(healthCheck, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalHttpHealthCheckName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalHttpHealthCheckName.java new file mode 100644 index 000000000000..b4ec6ba5d125 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalHttpHealthCheckName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalHttpHealthCheckName implements ResourceName { + private final String httpHealthCheck; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/httpHealthChecks/{httpHealthCheck}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalHttpHealthCheckName(Builder builder) { + httpHealthCheck = Preconditions.checkNotNull(builder.getHttpHealthCheck()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalHttpHealthCheckName of(String httpHealthCheck, String project) { + return newBuilder().setHttpHealthCheck(httpHealthCheck).setProject(project).build(); + } + + public static String format(String httpHealthCheck, String project) { + return of(httpHealthCheck, project).toString(); + } + + public String getHttpHealthCheck() { + return httpHealthCheck; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("httpHealthCheck", httpHealthCheck); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalHttpHealthCheckName parse(String formattedString) { + return ProjectGlobalHttpHealthCheckName.parse(formattedString); + } + }; + } + + public static ProjectGlobalHttpHealthCheckName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalHttpHealthCheckName.parse: formattedString not in valid format"); + return of(matchMap.get("httpHealthCheck"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String httpHealthCheck; + private String project; + + public String getHttpHealthCheck() { + return httpHealthCheck; + } + + public String getProject() { + return project; + } + + public Builder setHttpHealthCheck(String httpHealthCheck) { + this.httpHealthCheck = httpHealthCheck; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalHttpHealthCheckName projectGlobalHttpHealthCheckName) { + httpHealthCheck = projectGlobalHttpHealthCheckName.httpHealthCheck; + project = projectGlobalHttpHealthCheckName.project; + } + + public ProjectGlobalHttpHealthCheckName build() { + return new ProjectGlobalHttpHealthCheckName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "httpHealthCheck", httpHealthCheck, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalHttpHealthCheckName) { + ProjectGlobalHttpHealthCheckName that = (ProjectGlobalHttpHealthCheckName) o; + return Objects.equals(this.httpHealthCheck, that.getHttpHealthCheck()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(httpHealthCheck, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalHttpsHealthCheckName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalHttpsHealthCheckName.java new file mode 100644 index 000000000000..1db72f238bf1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalHttpsHealthCheckName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalHttpsHealthCheckName implements ResourceName { + private final String httpsHealthCheck; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/httpsHealthChecks/{httpsHealthCheck}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalHttpsHealthCheckName(Builder builder) { + httpsHealthCheck = Preconditions.checkNotNull(builder.getHttpsHealthCheck()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalHttpsHealthCheckName of(String httpsHealthCheck, String project) { + return newBuilder().setHttpsHealthCheck(httpsHealthCheck).setProject(project).build(); + } + + public static String format(String httpsHealthCheck, String project) { + return of(httpsHealthCheck, project).toString(); + } + + public String getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("httpsHealthCheck", httpsHealthCheck); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalHttpsHealthCheckName parse(String formattedString) { + return ProjectGlobalHttpsHealthCheckName.parse(formattedString); + } + }; + } + + public static ProjectGlobalHttpsHealthCheckName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalHttpsHealthCheckName.parse: formattedString not in valid format"); + return of(matchMap.get("httpsHealthCheck"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String httpsHealthCheck; + private String project; + + public String getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public String getProject() { + return project; + } + + public Builder setHttpsHealthCheck(String httpsHealthCheck) { + this.httpsHealthCheck = httpsHealthCheck; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalHttpsHealthCheckName projectGlobalHttpsHealthCheckName) { + httpsHealthCheck = projectGlobalHttpsHealthCheckName.httpsHealthCheck; + project = projectGlobalHttpsHealthCheckName.project; + } + + public ProjectGlobalHttpsHealthCheckName build() { + return new ProjectGlobalHttpsHealthCheckName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "httpsHealthCheck", httpsHealthCheck, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalHttpsHealthCheckName) { + ProjectGlobalHttpsHealthCheckName that = (ProjectGlobalHttpsHealthCheckName) o; + return Objects.equals(this.httpsHealthCheck, that.getHttpsHealthCheck()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(httpsHealthCheck, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalImageFamilyName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalImageFamilyName.java new file mode 100644 index 000000000000..13196e0b2749 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalImageFamilyName.java @@ -0,0 +1,164 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalImageFamilyName implements ResourceName { + private final String family; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/images/family/{family}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalImageFamilyName(Builder builder) { + family = Preconditions.checkNotNull(builder.getFamily()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalImageFamilyName of(String family, String project) { + return newBuilder().setFamily(family).setProject(project).build(); + } + + public static String format(String family, String project) { + return of(family, project).toString(); + } + + public String getFamily() { + return family; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("family", family); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalImageFamilyName parse(String formattedString) { + return ProjectGlobalImageFamilyName.parse(formattedString); + } + }; + } + + public static ProjectGlobalImageFamilyName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalImageFamilyName.parse: formattedString not in valid format"); + return of(matchMap.get("family"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String family; + private String project; + + public String getFamily() { + return family; + } + + public String getProject() { + return project; + } + + public Builder setFamily(String family) { + this.family = family; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalImageFamilyName projectGlobalImageFamilyName) { + family = projectGlobalImageFamilyName.family; + project = projectGlobalImageFamilyName.project; + } + + public ProjectGlobalImageFamilyName build() { + return new ProjectGlobalImageFamilyName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "family", family, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalImageFamilyName) { + ProjectGlobalImageFamilyName that = (ProjectGlobalImageFamilyName) o; + return Objects.equals(this.family, that.getFamily()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(family, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalImageName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalImageName.java new file mode 100644 index 000000000000..fc5ca114f751 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalImageName.java @@ -0,0 +1,163 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalImageName implements ResourceName { + private final String image; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/images/{image}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalImageName(Builder builder) { + image = Preconditions.checkNotNull(builder.getImage()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalImageName of(String image, String project) { + return newBuilder().setImage(image).setProject(project).build(); + } + + public static String format(String image, String project) { + return of(image, project).toString(); + } + + public String getImage() { + return image; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("image", image); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalImageName parse(String formattedString) { + return ProjectGlobalImageName.parse(formattedString); + } + }; + } + + public static ProjectGlobalImageName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectGlobalImageName.parse: formattedString not in valid format"); + return of(matchMap.get("image"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String image; + private String project; + + public String getImage() { + return image; + } + + public String getProject() { + return project; + } + + public Builder setImage(String image) { + this.image = image; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalImageName projectGlobalImageName) { + image = projectGlobalImageName.image; + project = projectGlobalImageName.project; + } + + public ProjectGlobalImageName build() { + return new ProjectGlobalImageName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "image", image, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalImageName) { + ProjectGlobalImageName that = (ProjectGlobalImageName) o; + return Objects.equals(this.image, that.getImage()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(image, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalImageResourceName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalImageResourceName.java new file mode 100644 index 000000000000..72733e2fa001 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalImageResourceName.java @@ -0,0 +1,164 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalImageResourceName implements ResourceName { + private final String project; + private final String resource; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/images/{resource}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalImageResourceName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + resource = Preconditions.checkNotNull(builder.getResource()); + } + + public static ProjectGlobalImageResourceName of(String project, String resource) { + return newBuilder().setProject(project).setResource(resource).build(); + } + + public static String format(String project, String resource) { + return of(project, resource).toString(); + } + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("resource", resource); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalImageResourceName parse(String formattedString) { + return ProjectGlobalImageResourceName.parse(formattedString); + } + }; + } + + public static ProjectGlobalImageResourceName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalImageResourceName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("resource")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String resource; + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalImageResourceName projectGlobalImageResourceName) { + project = projectGlobalImageResourceName.project; + resource = projectGlobalImageResourceName.resource; + } + + public ProjectGlobalImageResourceName build() { + return new ProjectGlobalImageResourceName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "resource", resource); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalImageResourceName) { + ProjectGlobalImageResourceName that = (ProjectGlobalImageResourceName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.resource, that.getResource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, resource); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalInstanceTemplateName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalInstanceTemplateName.java new file mode 100644 index 000000000000..093a5e68b050 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalInstanceTemplateName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalInstanceTemplateName implements ResourceName { + private final String instanceTemplate; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/instanceTemplates/{instanceTemplate}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalInstanceTemplateName(Builder builder) { + instanceTemplate = Preconditions.checkNotNull(builder.getInstanceTemplate()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalInstanceTemplateName of(String instanceTemplate, String project) { + return newBuilder().setInstanceTemplate(instanceTemplate).setProject(project).build(); + } + + public static String format(String instanceTemplate, String project) { + return of(instanceTemplate, project).toString(); + } + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("instanceTemplate", instanceTemplate); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalInstanceTemplateName parse(String formattedString) { + return ProjectGlobalInstanceTemplateName.parse(formattedString); + } + }; + } + + public static ProjectGlobalInstanceTemplateName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalInstanceTemplateName.parse: formattedString not in valid format"); + return of(matchMap.get("instanceTemplate"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String instanceTemplate; + private String project; + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public String getProject() { + return project; + } + + public Builder setInstanceTemplate(String instanceTemplate) { + this.instanceTemplate = instanceTemplate; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalInstanceTemplateName projectGlobalInstanceTemplateName) { + instanceTemplate = projectGlobalInstanceTemplateName.instanceTemplate; + project = projectGlobalInstanceTemplateName.project; + } + + public ProjectGlobalInstanceTemplateName build() { + return new ProjectGlobalInstanceTemplateName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "instanceTemplate", instanceTemplate, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalInstanceTemplateName) { + ProjectGlobalInstanceTemplateName that = (ProjectGlobalInstanceTemplateName) o; + return Objects.equals(this.instanceTemplate, that.getInstanceTemplate()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instanceTemplate, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalInterconnectLocationName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalInterconnectLocationName.java new file mode 100644 index 000000000000..ec2f643587e1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalInterconnectLocationName.java @@ -0,0 +1,166 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalInterconnectLocationName implements ResourceName { + private final String interconnectLocation; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/interconnectLocations/{interconnectLocation}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalInterconnectLocationName(Builder builder) { + interconnectLocation = Preconditions.checkNotNull(builder.getInterconnectLocation()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalInterconnectLocationName of( + String interconnectLocation, String project) { + return newBuilder().setInterconnectLocation(interconnectLocation).setProject(project).build(); + } + + public static String format(String interconnectLocation, String project) { + return of(interconnectLocation, project).toString(); + } + + public String getInterconnectLocation() { + return interconnectLocation; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("interconnectLocation", interconnectLocation); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalInterconnectLocationName parse(String formattedString) { + return ProjectGlobalInterconnectLocationName.parse(formattedString); + } + }; + } + + public static ProjectGlobalInterconnectLocationName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalInterconnectLocationName.parse: formattedString not in valid format"); + return of(matchMap.get("interconnectLocation"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String interconnectLocation; + private String project; + + public String getInterconnectLocation() { + return interconnectLocation; + } + + public String getProject() { + return project; + } + + public Builder setInterconnectLocation(String interconnectLocation) { + this.interconnectLocation = interconnectLocation; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalInterconnectLocationName projectGlobalInterconnectLocationName) { + interconnectLocation = projectGlobalInterconnectLocationName.interconnectLocation; + project = projectGlobalInterconnectLocationName.project; + } + + public ProjectGlobalInterconnectLocationName build() { + return new ProjectGlobalInterconnectLocationName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "interconnectLocation", interconnectLocation, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalInterconnectLocationName) { + ProjectGlobalInterconnectLocationName that = (ProjectGlobalInterconnectLocationName) o; + return Objects.equals(this.interconnectLocation, that.getInterconnectLocation()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(interconnectLocation, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalInterconnectName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalInterconnectName.java new file mode 100644 index 000000000000..acda5565c9bc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalInterconnectName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalInterconnectName implements ResourceName { + private final String interconnect; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/interconnects/{interconnect}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalInterconnectName(Builder builder) { + interconnect = Preconditions.checkNotNull(builder.getInterconnect()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalInterconnectName of(String interconnect, String project) { + return newBuilder().setInterconnect(interconnect).setProject(project).build(); + } + + public static String format(String interconnect, String project) { + return of(interconnect, project).toString(); + } + + public String getInterconnect() { + return interconnect; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("interconnect", interconnect); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalInterconnectName parse(String formattedString) { + return ProjectGlobalInterconnectName.parse(formattedString); + } + }; + } + + public static ProjectGlobalInterconnectName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalInterconnectName.parse: formattedString not in valid format"); + return of(matchMap.get("interconnect"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String interconnect; + private String project; + + public String getInterconnect() { + return interconnect; + } + + public String getProject() { + return project; + } + + public Builder setInterconnect(String interconnect) { + this.interconnect = interconnect; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalInterconnectName projectGlobalInterconnectName) { + interconnect = projectGlobalInterconnectName.interconnect; + project = projectGlobalInterconnectName.project; + } + + public ProjectGlobalInterconnectName build() { + return new ProjectGlobalInterconnectName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "interconnect", interconnect, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalInterconnectName) { + ProjectGlobalInterconnectName that = (ProjectGlobalInterconnectName) o; + return Objects.equals(this.interconnect, that.getInterconnect()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(interconnect, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseCodeName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseCodeName.java new file mode 100644 index 000000000000..252347a647d3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseCodeName.java @@ -0,0 +1,164 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalLicenseCodeName implements ResourceName { + private final String licenseCode; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/licenseCodes/{licenseCode}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalLicenseCodeName(Builder builder) { + licenseCode = Preconditions.checkNotNull(builder.getLicenseCode()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalLicenseCodeName of(String licenseCode, String project) { + return newBuilder().setLicenseCode(licenseCode).setProject(project).build(); + } + + public static String format(String licenseCode, String project) { + return of(licenseCode, project).toString(); + } + + public String getLicenseCode() { + return licenseCode; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("licenseCode", licenseCode); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalLicenseCodeName parse(String formattedString) { + return ProjectGlobalLicenseCodeName.parse(formattedString); + } + }; + } + + public static ProjectGlobalLicenseCodeName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalLicenseCodeName.parse: formattedString not in valid format"); + return of(matchMap.get("licenseCode"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String licenseCode; + private String project; + + public String getLicenseCode() { + return licenseCode; + } + + public String getProject() { + return project; + } + + public Builder setLicenseCode(String licenseCode) { + this.licenseCode = licenseCode; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalLicenseCodeName projectGlobalLicenseCodeName) { + licenseCode = projectGlobalLicenseCodeName.licenseCode; + project = projectGlobalLicenseCodeName.project; + } + + public ProjectGlobalLicenseCodeName build() { + return new ProjectGlobalLicenseCodeName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "licenseCode", licenseCode, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalLicenseCodeName) { + ProjectGlobalLicenseCodeName that = (ProjectGlobalLicenseCodeName) o; + return Objects.equals(this.licenseCode, that.getLicenseCode()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(licenseCode, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseCodeResourceName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseCodeResourceName.java new file mode 100644 index 000000000000..50c6aac69f29 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseCodeResourceName.java @@ -0,0 +1,164 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalLicenseCodeResourceName implements ResourceName { + private final String project; + private final String resource; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/licenseCodes/{resource}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalLicenseCodeResourceName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + resource = Preconditions.checkNotNull(builder.getResource()); + } + + public static ProjectGlobalLicenseCodeResourceName of(String project, String resource) { + return newBuilder().setProject(project).setResource(resource).build(); + } + + public static String format(String project, String resource) { + return of(project, resource).toString(); + } + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("resource", resource); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalLicenseCodeResourceName parse(String formattedString) { + return ProjectGlobalLicenseCodeResourceName.parse(formattedString); + } + }; + } + + public static ProjectGlobalLicenseCodeResourceName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalLicenseCodeResourceName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("resource")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String resource; + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalLicenseCodeResourceName projectGlobalLicenseCodeResourceName) { + project = projectGlobalLicenseCodeResourceName.project; + resource = projectGlobalLicenseCodeResourceName.resource; + } + + public ProjectGlobalLicenseCodeResourceName build() { + return new ProjectGlobalLicenseCodeResourceName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "resource", resource); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalLicenseCodeResourceName) { + ProjectGlobalLicenseCodeResourceName that = (ProjectGlobalLicenseCodeResourceName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.resource, that.getResource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, resource); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseName.java new file mode 100644 index 000000000000..f88ce1ced806 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseName.java @@ -0,0 +1,163 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalLicenseName implements ResourceName { + private final String license; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/licenses/{license}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalLicenseName(Builder builder) { + license = Preconditions.checkNotNull(builder.getLicense()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalLicenseName of(String license, String project) { + return newBuilder().setLicense(license).setProject(project).build(); + } + + public static String format(String license, String project) { + return of(license, project).toString(); + } + + public String getLicense() { + return license; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("license", license); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalLicenseName parse(String formattedString) { + return ProjectGlobalLicenseName.parse(formattedString); + } + }; + } + + public static ProjectGlobalLicenseName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectGlobalLicenseName.parse: formattedString not in valid format"); + return of(matchMap.get("license"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String license; + private String project; + + public String getLicense() { + return license; + } + + public String getProject() { + return project; + } + + public Builder setLicense(String license) { + this.license = license; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalLicenseName projectGlobalLicenseName) { + license = projectGlobalLicenseName.license; + project = projectGlobalLicenseName.project; + } + + public ProjectGlobalLicenseName build() { + return new ProjectGlobalLicenseName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "license", license, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalLicenseName) { + ProjectGlobalLicenseName that = (ProjectGlobalLicenseName) o; + return Objects.equals(this.license, that.getLicense()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(license, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseResourceName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseResourceName.java new file mode 100644 index 000000000000..5682cc0d24b0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalLicenseResourceName.java @@ -0,0 +1,164 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalLicenseResourceName implements ResourceName { + private final String project; + private final String resource; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/licenses/{resource}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalLicenseResourceName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + resource = Preconditions.checkNotNull(builder.getResource()); + } + + public static ProjectGlobalLicenseResourceName of(String project, String resource) { + return newBuilder().setProject(project).setResource(resource).build(); + } + + public static String format(String project, String resource) { + return of(project, resource).toString(); + } + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("resource", resource); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalLicenseResourceName parse(String formattedString) { + return ProjectGlobalLicenseResourceName.parse(formattedString); + } + }; + } + + public static ProjectGlobalLicenseResourceName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalLicenseResourceName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("resource")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String resource; + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalLicenseResourceName projectGlobalLicenseResourceName) { + project = projectGlobalLicenseResourceName.project; + resource = projectGlobalLicenseResourceName.resource; + } + + public ProjectGlobalLicenseResourceName build() { + return new ProjectGlobalLicenseResourceName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "resource", resource); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalLicenseResourceName) { + ProjectGlobalLicenseResourceName that = (ProjectGlobalLicenseResourceName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.resource, that.getResource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, resource); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalNetworkName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalNetworkName.java new file mode 100644 index 000000000000..805e1e5ba77d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalNetworkName.java @@ -0,0 +1,163 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalNetworkName implements ResourceName { + private final String network; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/networks/{network}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalNetworkName(Builder builder) { + network = Preconditions.checkNotNull(builder.getNetwork()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalNetworkName of(String network, String project) { + return newBuilder().setNetwork(network).setProject(project).build(); + } + + public static String format(String network, String project) { + return of(network, project).toString(); + } + + public String getNetwork() { + return network; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("network", network); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalNetworkName parse(String formattedString) { + return ProjectGlobalNetworkName.parse(formattedString); + } + }; + } + + public static ProjectGlobalNetworkName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectGlobalNetworkName.parse: formattedString not in valid format"); + return of(matchMap.get("network"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String network; + private String project; + + public String getNetwork() { + return network; + } + + public String getProject() { + return project; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalNetworkName projectGlobalNetworkName) { + network = projectGlobalNetworkName.network; + project = projectGlobalNetworkName.project; + } + + public ProjectGlobalNetworkName build() { + return new ProjectGlobalNetworkName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "network", network, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalNetworkName) { + ProjectGlobalNetworkName that = (ProjectGlobalNetworkName) o; + return Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(network, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalOperationName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalOperationName.java new file mode 100644 index 000000000000..dac90d0c2d0d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalOperationName.java @@ -0,0 +1,164 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalOperationName implements ResourceName { + private final String operation; + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/operations/{operation}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalOperationName(Builder builder) { + operation = Preconditions.checkNotNull(builder.getOperation()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectGlobalOperationName of(String operation, String project) { + return newBuilder().setOperation(operation).setProject(project).build(); + } + + public static String format(String operation, String project) { + return of(operation, project).toString(); + } + + public String getOperation() { + return operation; + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("operation", operation); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalOperationName parse(String formattedString) { + return ProjectGlobalOperationName.parse(formattedString); + } + }; + } + + public static ProjectGlobalOperationName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalOperationName.parse: formattedString not in valid format"); + return of(matchMap.get("operation"), matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String operation; + private String project; + + public String getOperation() { + return operation; + } + + public String getProject() { + return project; + } + + public Builder setOperation(String operation) { + this.operation = operation; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalOperationName projectGlobalOperationName) { + operation = projectGlobalOperationName.operation; + project = projectGlobalOperationName.project; + } + + public ProjectGlobalOperationName build() { + return new ProjectGlobalOperationName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "operation", operation, + "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalOperationName) { + ProjectGlobalOperationName that = (ProjectGlobalOperationName) o; + return Objects.equals(this.operation, that.getOperation()) + && Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(operation, project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalRouteName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalRouteName.java new file mode 100644 index 000000000000..f0f855ce083f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalRouteName.java @@ -0,0 +1,163 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalRouteName implements ResourceName { + private final String project; + private final String route; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/routes/{route}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalRouteName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + route = Preconditions.checkNotNull(builder.getRoute()); + } + + public static ProjectGlobalRouteName of(String project, String route) { + return newBuilder().setProject(project).setRoute(route).build(); + } + + public static String format(String project, String route) { + return of(project, route).toString(); + } + + public String getProject() { + return project; + } + + public String getRoute() { + return route; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("route", route); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalRouteName parse(String formattedString) { + return ProjectGlobalRouteName.parse(formattedString); + } + }; + } + + public static ProjectGlobalRouteName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectGlobalRouteName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("route")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String route; + + public String getProject() { + return project; + } + + public String getRoute() { + return route; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRoute(String route) { + this.route = route; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalRouteName projectGlobalRouteName) { + project = projectGlobalRouteName.project; + route = projectGlobalRouteName.route; + } + + public ProjectGlobalRouteName build() { + return new ProjectGlobalRouteName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "route", route); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalRouteName) { + ProjectGlobalRouteName that = (ProjectGlobalRouteName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.route, that.getRoute()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, route); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSnapshotName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSnapshotName.java new file mode 100644 index 000000000000..760421374402 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSnapshotName.java @@ -0,0 +1,164 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalSnapshotName implements ResourceName { + private final String project; + private final String snapshot; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/snapshots/{snapshot}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalSnapshotName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + snapshot = Preconditions.checkNotNull(builder.getSnapshot()); + } + + public static ProjectGlobalSnapshotName of(String project, String snapshot) { + return newBuilder().setProject(project).setSnapshot(snapshot).build(); + } + + public static String format(String project, String snapshot) { + return of(project, snapshot).toString(); + } + + public String getProject() { + return project; + } + + public String getSnapshot() { + return snapshot; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("snapshot", snapshot); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalSnapshotName parse(String formattedString) { + return ProjectGlobalSnapshotName.parse(formattedString); + } + }; + } + + public static ProjectGlobalSnapshotName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalSnapshotName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("snapshot")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String snapshot; + + public String getProject() { + return project; + } + + public String getSnapshot() { + return snapshot; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setSnapshot(String snapshot) { + this.snapshot = snapshot; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalSnapshotName projectGlobalSnapshotName) { + project = projectGlobalSnapshotName.project; + snapshot = projectGlobalSnapshotName.snapshot; + } + + public ProjectGlobalSnapshotName build() { + return new ProjectGlobalSnapshotName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "snapshot", snapshot); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalSnapshotName) { + ProjectGlobalSnapshotName that = (ProjectGlobalSnapshotName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.snapshot, that.getSnapshot()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, snapshot); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSnapshotResourceName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSnapshotResourceName.java new file mode 100644 index 000000000000..08f60e758c27 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSnapshotResourceName.java @@ -0,0 +1,164 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalSnapshotResourceName implements ResourceName { + private final String project; + private final String resource; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/snapshots/{resource}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalSnapshotResourceName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + resource = Preconditions.checkNotNull(builder.getResource()); + } + + public static ProjectGlobalSnapshotResourceName of(String project, String resource) { + return newBuilder().setProject(project).setResource(resource).build(); + } + + public static String format(String project, String resource) { + return of(project, resource).toString(); + } + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("resource", resource); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalSnapshotResourceName parse(String formattedString) { + return ProjectGlobalSnapshotResourceName.parse(formattedString); + } + }; + } + + public static ProjectGlobalSnapshotResourceName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalSnapshotResourceName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("resource")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String resource; + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalSnapshotResourceName projectGlobalSnapshotResourceName) { + project = projectGlobalSnapshotResourceName.project; + resource = projectGlobalSnapshotResourceName.resource; + } + + public ProjectGlobalSnapshotResourceName build() { + return new ProjectGlobalSnapshotResourceName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "resource", resource); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalSnapshotResourceName) { + ProjectGlobalSnapshotResourceName that = (ProjectGlobalSnapshotResourceName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.resource, that.getResource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, resource); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSslCertificateName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSslCertificateName.java new file mode 100644 index 000000000000..a04a3956ff02 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSslCertificateName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalSslCertificateName implements ResourceName { + private final String project; + private final String sslCertificate; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/sslCertificates/{sslCertificate}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalSslCertificateName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + sslCertificate = Preconditions.checkNotNull(builder.getSslCertificate()); + } + + public static ProjectGlobalSslCertificateName of(String project, String sslCertificate) { + return newBuilder().setProject(project).setSslCertificate(sslCertificate).build(); + } + + public static String format(String project, String sslCertificate) { + return of(project, sslCertificate).toString(); + } + + public String getProject() { + return project; + } + + public String getSslCertificate() { + return sslCertificate; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("sslCertificate", sslCertificate); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalSslCertificateName parse(String formattedString) { + return ProjectGlobalSslCertificateName.parse(formattedString); + } + }; + } + + public static ProjectGlobalSslCertificateName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalSslCertificateName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("sslCertificate")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String sslCertificate; + + public String getProject() { + return project; + } + + public String getSslCertificate() { + return sslCertificate; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setSslCertificate(String sslCertificate) { + this.sslCertificate = sslCertificate; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalSslCertificateName projectGlobalSslCertificateName) { + project = projectGlobalSslCertificateName.project; + sslCertificate = projectGlobalSslCertificateName.sslCertificate; + } + + public ProjectGlobalSslCertificateName build() { + return new ProjectGlobalSslCertificateName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "sslCertificate", sslCertificate); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalSslCertificateName) { + ProjectGlobalSslCertificateName that = (ProjectGlobalSslCertificateName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.sslCertificate, that.getSslCertificate()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, sslCertificate); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSslPolicyName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSslPolicyName.java new file mode 100644 index 000000000000..ed5f7b2fc474 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalSslPolicyName.java @@ -0,0 +1,164 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalSslPolicyName implements ResourceName { + private final String project; + private final String sslPolicy; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/sslPolicies/{sslPolicy}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalSslPolicyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + sslPolicy = Preconditions.checkNotNull(builder.getSslPolicy()); + } + + public static ProjectGlobalSslPolicyName of(String project, String sslPolicy) { + return newBuilder().setProject(project).setSslPolicy(sslPolicy).build(); + } + + public static String format(String project, String sslPolicy) { + return of(project, sslPolicy).toString(); + } + + public String getProject() { + return project; + } + + public String getSslPolicy() { + return sslPolicy; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("sslPolicy", sslPolicy); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalSslPolicyName parse(String formattedString) { + return ProjectGlobalSslPolicyName.parse(formattedString); + } + }; + } + + public static ProjectGlobalSslPolicyName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalSslPolicyName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("sslPolicy")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String sslPolicy; + + public String getProject() { + return project; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setSslPolicy(String sslPolicy) { + this.sslPolicy = sslPolicy; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalSslPolicyName projectGlobalSslPolicyName) { + project = projectGlobalSslPolicyName.project; + sslPolicy = projectGlobalSslPolicyName.sslPolicy; + } + + public ProjectGlobalSslPolicyName build() { + return new ProjectGlobalSslPolicyName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "sslPolicy", sslPolicy); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalSslPolicyName) { + ProjectGlobalSslPolicyName that = (ProjectGlobalSslPolicyName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.sslPolicy, that.getSslPolicy()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, sslPolicy); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetHttpProxyName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetHttpProxyName.java new file mode 100644 index 000000000000..aae231fe38c9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetHttpProxyName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalTargetHttpProxyName implements ResourceName { + private final String project; + private final String targetHttpProxy; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/targetHttpProxies/{targetHttpProxy}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalTargetHttpProxyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + targetHttpProxy = Preconditions.checkNotNull(builder.getTargetHttpProxy()); + } + + public static ProjectGlobalTargetHttpProxyName of(String project, String targetHttpProxy) { + return newBuilder().setProject(project).setTargetHttpProxy(targetHttpProxy).build(); + } + + public static String format(String project, String targetHttpProxy) { + return of(project, targetHttpProxy).toString(); + } + + public String getProject() { + return project; + } + + public String getTargetHttpProxy() { + return targetHttpProxy; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("targetHttpProxy", targetHttpProxy); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalTargetHttpProxyName parse(String formattedString) { + return ProjectGlobalTargetHttpProxyName.parse(formattedString); + } + }; + } + + public static ProjectGlobalTargetHttpProxyName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalTargetHttpProxyName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("targetHttpProxy")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String targetHttpProxy; + + public String getProject() { + return project; + } + + public String getTargetHttpProxy() { + return targetHttpProxy; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setTargetHttpProxy(String targetHttpProxy) { + this.targetHttpProxy = targetHttpProxy; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalTargetHttpProxyName projectGlobalTargetHttpProxyName) { + project = projectGlobalTargetHttpProxyName.project; + targetHttpProxy = projectGlobalTargetHttpProxyName.targetHttpProxy; + } + + public ProjectGlobalTargetHttpProxyName build() { + return new ProjectGlobalTargetHttpProxyName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "targetHttpProxy", targetHttpProxy); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalTargetHttpProxyName) { + ProjectGlobalTargetHttpProxyName that = (ProjectGlobalTargetHttpProxyName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.targetHttpProxy, that.getTargetHttpProxy()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, targetHttpProxy); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetHttpsProxyName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetHttpsProxyName.java new file mode 100644 index 000000000000..23608e827f62 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetHttpsProxyName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalTargetHttpsProxyName implements ResourceName { + private final String project; + private final String targetHttpsProxy; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/targetHttpsProxies/{targetHttpsProxy}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalTargetHttpsProxyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + targetHttpsProxy = Preconditions.checkNotNull(builder.getTargetHttpsProxy()); + } + + public static ProjectGlobalTargetHttpsProxyName of(String project, String targetHttpsProxy) { + return newBuilder().setProject(project).setTargetHttpsProxy(targetHttpsProxy).build(); + } + + public static String format(String project, String targetHttpsProxy) { + return of(project, targetHttpsProxy).toString(); + } + + public String getProject() { + return project; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("targetHttpsProxy", targetHttpsProxy); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalTargetHttpsProxyName parse(String formattedString) { + return ProjectGlobalTargetHttpsProxyName.parse(formattedString); + } + }; + } + + public static ProjectGlobalTargetHttpsProxyName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalTargetHttpsProxyName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("targetHttpsProxy")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String targetHttpsProxy; + + public String getProject() { + return project; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setTargetHttpsProxy(String targetHttpsProxy) { + this.targetHttpsProxy = targetHttpsProxy; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalTargetHttpsProxyName projectGlobalTargetHttpsProxyName) { + project = projectGlobalTargetHttpsProxyName.project; + targetHttpsProxy = projectGlobalTargetHttpsProxyName.targetHttpsProxy; + } + + public ProjectGlobalTargetHttpsProxyName build() { + return new ProjectGlobalTargetHttpsProxyName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "targetHttpsProxy", targetHttpsProxy); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalTargetHttpsProxyName) { + ProjectGlobalTargetHttpsProxyName that = (ProjectGlobalTargetHttpsProxyName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.targetHttpsProxy, that.getTargetHttpsProxy()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, targetHttpsProxy); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetSslProxyName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetSslProxyName.java new file mode 100644 index 000000000000..834d4a5f3e59 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetSslProxyName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalTargetSslProxyName implements ResourceName { + private final String project; + private final String targetSslProxy; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/targetSslProxies/{targetSslProxy}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalTargetSslProxyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + targetSslProxy = Preconditions.checkNotNull(builder.getTargetSslProxy()); + } + + public static ProjectGlobalTargetSslProxyName of(String project, String targetSslProxy) { + return newBuilder().setProject(project).setTargetSslProxy(targetSslProxy).build(); + } + + public static String format(String project, String targetSslProxy) { + return of(project, targetSslProxy).toString(); + } + + public String getProject() { + return project; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("targetSslProxy", targetSslProxy); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalTargetSslProxyName parse(String formattedString) { + return ProjectGlobalTargetSslProxyName.parse(formattedString); + } + }; + } + + public static ProjectGlobalTargetSslProxyName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalTargetSslProxyName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("targetSslProxy")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String targetSslProxy; + + public String getProject() { + return project; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setTargetSslProxy(String targetSslProxy) { + this.targetSslProxy = targetSslProxy; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalTargetSslProxyName projectGlobalTargetSslProxyName) { + project = projectGlobalTargetSslProxyName.project; + targetSslProxy = projectGlobalTargetSslProxyName.targetSslProxy; + } + + public ProjectGlobalTargetSslProxyName build() { + return new ProjectGlobalTargetSslProxyName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "targetSslProxy", targetSslProxy); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalTargetSslProxyName) { + ProjectGlobalTargetSslProxyName that = (ProjectGlobalTargetSslProxyName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.targetSslProxy, that.getTargetSslProxy()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, targetSslProxy); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetTcpProxyName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetTcpProxyName.java new file mode 100644 index 000000000000..48fdf255fb01 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalTargetTcpProxyName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalTargetTcpProxyName implements ResourceName { + private final String project; + private final String targetTcpProxy; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/global/targetTcpProxies/{targetTcpProxy}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalTargetTcpProxyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + targetTcpProxy = Preconditions.checkNotNull(builder.getTargetTcpProxy()); + } + + public static ProjectGlobalTargetTcpProxyName of(String project, String targetTcpProxy) { + return newBuilder().setProject(project).setTargetTcpProxy(targetTcpProxy).build(); + } + + public static String format(String project, String targetTcpProxy) { + return of(project, targetTcpProxy).toString(); + } + + public String getProject() { + return project; + } + + public String getTargetTcpProxy() { + return targetTcpProxy; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("targetTcpProxy", targetTcpProxy); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalTargetTcpProxyName parse(String formattedString) { + return ProjectGlobalTargetTcpProxyName.parse(formattedString); + } + }; + } + + public static ProjectGlobalTargetTcpProxyName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectGlobalTargetTcpProxyName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("targetTcpProxy")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String targetTcpProxy; + + public String getProject() { + return project; + } + + public String getTargetTcpProxy() { + return targetTcpProxy; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setTargetTcpProxy(String targetTcpProxy) { + this.targetTcpProxy = targetTcpProxy; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalTargetTcpProxyName projectGlobalTargetTcpProxyName) { + project = projectGlobalTargetTcpProxyName.project; + targetTcpProxy = projectGlobalTargetTcpProxyName.targetTcpProxy; + } + + public ProjectGlobalTargetTcpProxyName build() { + return new ProjectGlobalTargetTcpProxyName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "targetTcpProxy", targetTcpProxy); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalTargetTcpProxyName) { + ProjectGlobalTargetTcpProxyName that = (ProjectGlobalTargetTcpProxyName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.targetTcpProxy, that.getTargetTcpProxy()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, targetTcpProxy); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalUrlMapName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalUrlMapName.java new file mode 100644 index 000000000000..dbfdfa721a57 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectGlobalUrlMapName.java @@ -0,0 +1,163 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectGlobalUrlMapName implements ResourceName { + private final String project; + private final String urlMap; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/global/urlMaps/{urlMap}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectGlobalUrlMapName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + urlMap = Preconditions.checkNotNull(builder.getUrlMap()); + } + + public static ProjectGlobalUrlMapName of(String project, String urlMap) { + return newBuilder().setProject(project).setUrlMap(urlMap).build(); + } + + public static String format(String project, String urlMap) { + return of(project, urlMap).toString(); + } + + public String getProject() { + return project; + } + + public String getUrlMap() { + return urlMap; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("urlMap", urlMap); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectGlobalUrlMapName parse(String formattedString) { + return ProjectGlobalUrlMapName.parse(formattedString); + } + }; + } + + public static ProjectGlobalUrlMapName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectGlobalUrlMapName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("urlMap")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String urlMap; + + public String getProject() { + return project; + } + + public String getUrlMap() { + return urlMap; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setUrlMap(String urlMap) { + this.urlMap = urlMap; + return this; + } + + private Builder() {} + + public Builder(ProjectGlobalUrlMapName projectGlobalUrlMapName) { + project = projectGlobalUrlMapName.project; + urlMap = projectGlobalUrlMapName.urlMap; + } + + public ProjectGlobalUrlMapName build() { + return new ProjectGlobalUrlMapName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "urlMap", urlMap); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectGlobalUrlMapName) { + ProjectGlobalUrlMapName that = (ProjectGlobalUrlMapName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.urlMap, that.getUrlMap()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, urlMap); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectName.java new file mode 100644 index 000000000000..7000e41a698b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectName.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectName implements ResourceName { + private final String project; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + } + + public static ProjectName of(String project) { + return newBuilder().setProject(project).build(); + } + + public static String format(String project) { + return of(project).toString(); + } + + public String getProject() { + return project; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectName parse(String formattedString) { + return ProjectName.parse(formattedString); + } + }; + } + + public static ProjectName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectName.parse: formattedString not in valid format"); + return of(matchMap.get("project")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder() {} + + public Builder(ProjectName projectName) { + project = projectName.project; + } + + public ProjectName build() { + return new ProjectName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectName) { + ProjectName that = (ProjectName) o; + return Objects.equals(this.project, that.getProject()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionAddressName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionAddressName.java new file mode 100644 index 000000000000..4cb6de0afb0e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionAddressName.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionAddressName implements ResourceName { + private final String address; + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/addresses/{address}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionAddressName(Builder builder) { + address = Preconditions.checkNotNull(builder.getAddress()); + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionAddressName of(String address, String project, String region) { + return newBuilder().setAddress(address).setProject(project).setRegion(region).build(); + } + + public static String format(String address, String project, String region) { + return of(address, project, region).toString(); + } + + public String getAddress() { + return address; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("address", address); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionAddressName parse(String formattedString) { + return ProjectRegionAddressName.parse(formattedString); + } + }; + } + + public static ProjectRegionAddressName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectRegionAddressName.parse: formattedString not in valid format"); + return of(matchMap.get("address"), matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String address; + private String project; + private String region; + + public String getAddress() { + return address; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setAddress(String address) { + this.address = address; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionAddressName projectRegionAddressName) { + address = projectRegionAddressName.address; + project = projectRegionAddressName.project; + region = projectRegionAddressName.region; + } + + public ProjectRegionAddressName build() { + return new ProjectRegionAddressName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "address", address, + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionAddressName) { + ProjectRegionAddressName that = (ProjectRegionAddressName) o; + return Objects.equals(this.address, that.getAddress()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(address, project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionAutoscalerName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionAutoscalerName.java new file mode 100644 index 000000000000..c7bc1b56787d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionAutoscalerName.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionAutoscalerName implements ResourceName { + private final String autoscaler; + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/autoscalers/{autoscaler}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionAutoscalerName(Builder builder) { + autoscaler = Preconditions.checkNotNull(builder.getAutoscaler()); + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionAutoscalerName of(String autoscaler, String project, String region) { + return newBuilder().setAutoscaler(autoscaler).setProject(project).setRegion(region).build(); + } + + public static String format(String autoscaler, String project, String region) { + return of(autoscaler, project, region).toString(); + } + + public String getAutoscaler() { + return autoscaler; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("autoscaler", autoscaler); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionAutoscalerName parse(String formattedString) { + return ProjectRegionAutoscalerName.parse(formattedString); + } + }; + } + + public static ProjectRegionAutoscalerName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionAutoscalerName.parse: formattedString not in valid format"); + return of(matchMap.get("autoscaler"), matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String autoscaler; + private String project; + private String region; + + public String getAutoscaler() { + return autoscaler; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setAutoscaler(String autoscaler) { + this.autoscaler = autoscaler; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionAutoscalerName projectRegionAutoscalerName) { + autoscaler = projectRegionAutoscalerName.autoscaler; + project = projectRegionAutoscalerName.project; + region = projectRegionAutoscalerName.region; + } + + public ProjectRegionAutoscalerName build() { + return new ProjectRegionAutoscalerName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "autoscaler", autoscaler, + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionAutoscalerName) { + ProjectRegionAutoscalerName that = (ProjectRegionAutoscalerName) o; + return Objects.equals(this.autoscaler, that.getAutoscaler()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(autoscaler, project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionBackendServiceName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionBackendServiceName.java new file mode 100644 index 000000000000..bc3a61a21492 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionBackendServiceName.java @@ -0,0 +1,190 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionBackendServiceName implements ResourceName { + private final String backendService; + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/backendServices/{backendService}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionBackendServiceName(Builder builder) { + backendService = Preconditions.checkNotNull(builder.getBackendService()); + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionBackendServiceName of( + String backendService, String project, String region) { + return newBuilder() + .setBackendService(backendService) + .setProject(project) + .setRegion(region) + .build(); + } + + public static String format(String backendService, String project, String region) { + return of(backendService, project, region).toString(); + } + + public String getBackendService() { + return backendService; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("backendService", backendService); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionBackendServiceName parse(String formattedString) { + return ProjectRegionBackendServiceName.parse(formattedString); + } + }; + } + + public static ProjectRegionBackendServiceName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionBackendServiceName.parse: formattedString not in valid format"); + return of(matchMap.get("backendService"), matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String backendService; + private String project; + private String region; + + public String getBackendService() { + return backendService; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionBackendServiceName projectRegionBackendServiceName) { + backendService = projectRegionBackendServiceName.backendService; + project = projectRegionBackendServiceName.project; + region = projectRegionBackendServiceName.region; + } + + public ProjectRegionBackendServiceName build() { + return new ProjectRegionBackendServiceName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "backendService", backendService, + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionBackendServiceName) { + ProjectRegionBackendServiceName that = (ProjectRegionBackendServiceName) o; + return Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(backendService, project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionCommitmentName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionCommitmentName.java new file mode 100644 index 000000000000..b7695fdd9fd1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionCommitmentName.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionCommitmentName implements ResourceName { + private final String commitment; + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/commitments/{commitment}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionCommitmentName(Builder builder) { + commitment = Preconditions.checkNotNull(builder.getCommitment()); + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionCommitmentName of(String commitment, String project, String region) { + return newBuilder().setCommitment(commitment).setProject(project).setRegion(region).build(); + } + + public static String format(String commitment, String project, String region) { + return of(commitment, project, region).toString(); + } + + public String getCommitment() { + return commitment; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("commitment", commitment); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionCommitmentName parse(String formattedString) { + return ProjectRegionCommitmentName.parse(formattedString); + } + }; + } + + public static ProjectRegionCommitmentName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionCommitmentName.parse: formattedString not in valid format"); + return of(matchMap.get("commitment"), matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String commitment; + private String project; + private String region; + + public String getCommitment() { + return commitment; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setCommitment(String commitment) { + this.commitment = commitment; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionCommitmentName projectRegionCommitmentName) { + commitment = projectRegionCommitmentName.commitment; + project = projectRegionCommitmentName.project; + region = projectRegionCommitmentName.region; + } + + public ProjectRegionCommitmentName build() { + return new ProjectRegionCommitmentName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "commitment", commitment, + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionCommitmentName) { + ProjectRegionCommitmentName that = (ProjectRegionCommitmentName) o; + return Objects.equals(this.commitment, that.getCommitment()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(commitment, project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionDiskName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionDiskName.java new file mode 100644 index 000000000000..5243a8298f7d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionDiskName.java @@ -0,0 +1,183 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionDiskName implements ResourceName { + private final String disk; + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/regions/{region}/disks/{disk}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionDiskName(Builder builder) { + disk = Preconditions.checkNotNull(builder.getDisk()); + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionDiskName of(String disk, String project, String region) { + return newBuilder().setDisk(disk).setProject(project).setRegion(region).build(); + } + + public static String format(String disk, String project, String region) { + return of(disk, project, region).toString(); + } + + public String getDisk() { + return disk; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("disk", disk); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionDiskName parse(String formattedString) { + return ProjectRegionDiskName.parse(formattedString); + } + }; + } + + public static ProjectRegionDiskName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectRegionDiskName.parse: formattedString not in valid format"); + return of(matchMap.get("disk"), matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String disk; + private String project; + private String region; + + public String getDisk() { + return disk; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setDisk(String disk) { + this.disk = disk; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionDiskName projectRegionDiskName) { + disk = projectRegionDiskName.disk; + project = projectRegionDiskName.project; + region = projectRegionDiskName.region; + } + + public ProjectRegionDiskName build() { + return new ProjectRegionDiskName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "disk", disk, + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionDiskName) { + ProjectRegionDiskName that = (ProjectRegionDiskName) o; + return Objects.equals(this.disk, that.getDisk()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(disk, project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionDiskResourceName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionDiskResourceName.java new file mode 100644 index 000000000000..94e53ed3b681 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionDiskResourceName.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionDiskResourceName implements ResourceName { + private final String project; + private final String region; + private final String resource; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/regions/{region}/disks/{resource}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionDiskResourceName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + resource = Preconditions.checkNotNull(builder.getResource()); + } + + public static ProjectRegionDiskResourceName of(String project, String region, String resource) { + return newBuilder().setProject(project).setRegion(region).setResource(resource).build(); + } + + public static String format(String project, String region, String resource) { + return of(project, region, resource).toString(); + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getResource() { + return resource; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldMapBuilder.put("resource", resource); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionDiskResourceName parse(String formattedString) { + return ProjectRegionDiskResourceName.parse(formattedString); + } + }; + } + + public static ProjectRegionDiskResourceName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionDiskResourceName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("region"), matchMap.get("resource")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String region; + private String resource; + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getResource() { + return resource; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionDiskResourceName projectRegionDiskResourceName) { + project = projectRegionDiskResourceName.project; + region = projectRegionDiskResourceName.region; + resource = projectRegionDiskResourceName.resource; + } + + public ProjectRegionDiskResourceName build() { + return new ProjectRegionDiskResourceName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "region", region, + "resource", resource); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionDiskResourceName) { + ProjectRegionDiskResourceName that = (ProjectRegionDiskResourceName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.resource, that.getResource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, region, resource); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionDiskTypeName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionDiskTypeName.java new file mode 100644 index 000000000000..31e5971b3914 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionDiskTypeName.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionDiskTypeName implements ResourceName { + private final String diskType; + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/diskTypes/{diskType}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionDiskTypeName(Builder builder) { + diskType = Preconditions.checkNotNull(builder.getDiskType()); + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionDiskTypeName of(String diskType, String project, String region) { + return newBuilder().setDiskType(diskType).setProject(project).setRegion(region).build(); + } + + public static String format(String diskType, String project, String region) { + return of(diskType, project, region).toString(); + } + + public String getDiskType() { + return diskType; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("diskType", diskType); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionDiskTypeName parse(String formattedString) { + return ProjectRegionDiskTypeName.parse(formattedString); + } + }; + } + + public static ProjectRegionDiskTypeName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionDiskTypeName.parse: formattedString not in valid format"); + return of(matchMap.get("diskType"), matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String diskType; + private String project; + private String region; + + public String getDiskType() { + return diskType; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setDiskType(String diskType) { + this.diskType = diskType; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionDiskTypeName projectRegionDiskTypeName) { + diskType = projectRegionDiskTypeName.diskType; + project = projectRegionDiskTypeName.project; + region = projectRegionDiskTypeName.region; + } + + public ProjectRegionDiskTypeName build() { + return new ProjectRegionDiskTypeName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "diskType", diskType, + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionDiskTypeName) { + ProjectRegionDiskTypeName that = (ProjectRegionDiskTypeName) o; + return Objects.equals(this.diskType, that.getDiskType()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(diskType, project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionForwardingRuleName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionForwardingRuleName.java new file mode 100644 index 000000000000..8b5c85991c16 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionForwardingRuleName.java @@ -0,0 +1,190 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionForwardingRuleName implements ResourceName { + private final String forwardingRule; + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/forwardingRules/{forwardingRule}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionForwardingRuleName(Builder builder) { + forwardingRule = Preconditions.checkNotNull(builder.getForwardingRule()); + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionForwardingRuleName of( + String forwardingRule, String project, String region) { + return newBuilder() + .setForwardingRule(forwardingRule) + .setProject(project) + .setRegion(region) + .build(); + } + + public static String format(String forwardingRule, String project, String region) { + return of(forwardingRule, project, region).toString(); + } + + public String getForwardingRule() { + return forwardingRule; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("forwardingRule", forwardingRule); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionForwardingRuleName parse(String formattedString) { + return ProjectRegionForwardingRuleName.parse(formattedString); + } + }; + } + + public static ProjectRegionForwardingRuleName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionForwardingRuleName.parse: formattedString not in valid format"); + return of(matchMap.get("forwardingRule"), matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String forwardingRule; + private String project; + private String region; + + public String getForwardingRule() { + return forwardingRule; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setForwardingRule(String forwardingRule) { + this.forwardingRule = forwardingRule; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionForwardingRuleName projectRegionForwardingRuleName) { + forwardingRule = projectRegionForwardingRuleName.forwardingRule; + project = projectRegionForwardingRuleName.project; + region = projectRegionForwardingRuleName.region; + } + + public ProjectRegionForwardingRuleName build() { + return new ProjectRegionForwardingRuleName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "forwardingRule", forwardingRule, + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionForwardingRuleName) { + ProjectRegionForwardingRuleName that = (ProjectRegionForwardingRuleName) o; + return Objects.equals(this.forwardingRule, that.getForwardingRule()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(forwardingRule, project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionInstanceGroupManagerName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionInstanceGroupManagerName.java new file mode 100644 index 000000000000..ca1649753d03 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionInstanceGroupManagerName.java @@ -0,0 +1,191 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionInstanceGroupManagerName implements ResourceName { + private final String instanceGroupManager; + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionInstanceGroupManagerName(Builder builder) { + instanceGroupManager = Preconditions.checkNotNull(builder.getInstanceGroupManager()); + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionInstanceGroupManagerName of( + String instanceGroupManager, String project, String region) { + return newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setProject(project) + .setRegion(region) + .build(); + } + + public static String format(String instanceGroupManager, String project, String region) { + return of(instanceGroupManager, project, region).toString(); + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("instanceGroupManager", instanceGroupManager); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionInstanceGroupManagerName parse(String formattedString) { + return ProjectRegionInstanceGroupManagerName.parse(formattedString); + } + }; + } + + public static ProjectRegionInstanceGroupManagerName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionInstanceGroupManagerName.parse: formattedString not in valid format"); + return of( + matchMap.get("instanceGroupManager"), matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String instanceGroupManager; + private String project; + private String region; + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionInstanceGroupManagerName projectRegionInstanceGroupManagerName) { + instanceGroupManager = projectRegionInstanceGroupManagerName.instanceGroupManager; + project = projectRegionInstanceGroupManagerName.project; + region = projectRegionInstanceGroupManagerName.region; + } + + public ProjectRegionInstanceGroupManagerName build() { + return new ProjectRegionInstanceGroupManagerName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "instanceGroupManager", instanceGroupManager, + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionInstanceGroupManagerName) { + ProjectRegionInstanceGroupManagerName that = (ProjectRegionInstanceGroupManagerName) o; + return Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instanceGroupManager, project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionInstanceGroupName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionInstanceGroupName.java new file mode 100644 index 000000000000..e09951b5afce --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionInstanceGroupName.java @@ -0,0 +1,190 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionInstanceGroupName implements ResourceName { + private final String instanceGroup; + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/instanceGroups/{instanceGroup}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionInstanceGroupName(Builder builder) { + instanceGroup = Preconditions.checkNotNull(builder.getInstanceGroup()); + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionInstanceGroupName of( + String instanceGroup, String project, String region) { + return newBuilder() + .setInstanceGroup(instanceGroup) + .setProject(project) + .setRegion(region) + .build(); + } + + public static String format(String instanceGroup, String project, String region) { + return of(instanceGroup, project, region).toString(); + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("instanceGroup", instanceGroup); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionInstanceGroupName parse(String formattedString) { + return ProjectRegionInstanceGroupName.parse(formattedString); + } + }; + } + + public static ProjectRegionInstanceGroupName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionInstanceGroupName.parse: formattedString not in valid format"); + return of(matchMap.get("instanceGroup"), matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String instanceGroup; + private String project; + private String region; + + public String getInstanceGroup() { + return instanceGroup; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionInstanceGroupName projectRegionInstanceGroupName) { + instanceGroup = projectRegionInstanceGroupName.instanceGroup; + project = projectRegionInstanceGroupName.project; + region = projectRegionInstanceGroupName.region; + } + + public ProjectRegionInstanceGroupName build() { + return new ProjectRegionInstanceGroupName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "instanceGroup", instanceGroup, + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionInstanceGroupName) { + ProjectRegionInstanceGroupName that = (ProjectRegionInstanceGroupName) o; + return Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instanceGroup, project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionInterconnectAttachmentName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionInterconnectAttachmentName.java new file mode 100644 index 000000000000..300557c1bef4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionInterconnectAttachmentName.java @@ -0,0 +1,192 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionInterconnectAttachmentName implements ResourceName { + private final String interconnectAttachment; + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/interconnectAttachments/{interconnectAttachment}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionInterconnectAttachmentName(Builder builder) { + interconnectAttachment = Preconditions.checkNotNull(builder.getInterconnectAttachment()); + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionInterconnectAttachmentName of( + String interconnectAttachment, String project, String region) { + return newBuilder() + .setInterconnectAttachment(interconnectAttachment) + .setProject(project) + .setRegion(region) + .build(); + } + + public static String format(String interconnectAttachment, String project, String region) { + return of(interconnectAttachment, project, region).toString(); + } + + public String getInterconnectAttachment() { + return interconnectAttachment; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("interconnectAttachment", interconnectAttachment); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionInterconnectAttachmentName parse(String formattedString) { + return ProjectRegionInterconnectAttachmentName.parse(formattedString); + } + }; + } + + public static ProjectRegionInterconnectAttachmentName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionInterconnectAttachmentName.parse: formattedString not in valid format"); + return of( + matchMap.get("interconnectAttachment"), matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String interconnectAttachment; + private String project; + private String region; + + public String getInterconnectAttachment() { + return interconnectAttachment; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setInterconnectAttachment(String interconnectAttachment) { + this.interconnectAttachment = interconnectAttachment; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder( + ProjectRegionInterconnectAttachmentName projectRegionInterconnectAttachmentName) { + interconnectAttachment = projectRegionInterconnectAttachmentName.interconnectAttachment; + project = projectRegionInterconnectAttachmentName.project; + region = projectRegionInterconnectAttachmentName.region; + } + + public ProjectRegionInterconnectAttachmentName build() { + return new ProjectRegionInterconnectAttachmentName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "interconnectAttachment", interconnectAttachment, + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionInterconnectAttachmentName) { + ProjectRegionInterconnectAttachmentName that = (ProjectRegionInterconnectAttachmentName) o; + return Objects.equals(this.interconnectAttachment, that.getInterconnectAttachment()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(interconnectAttachment, project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionName.java new file mode 100644 index 000000000000..9c0b0c49530e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionName.java @@ -0,0 +1,163 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionName implements ResourceName { + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/regions/{region}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionName of(String project, String region) { + return newBuilder().setProject(project).setRegion(region).build(); + } + + public static String format(String project, String region) { + return of(project, region).toString(); + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionName parse(String formattedString) { + return ProjectRegionName.parse(formattedString); + } + }; + } + + public static ProjectRegionName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectRegionName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String region; + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionName projectRegionName) { + project = projectRegionName.project; + region = projectRegionName.region; + } + + public ProjectRegionName build() { + return new ProjectRegionName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionName) { + ProjectRegionName that = (ProjectRegionName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionOperationName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionOperationName.java new file mode 100644 index 000000000000..29d5ddab60f3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionOperationName.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionOperationName implements ResourceName { + private final String operation; + private final String project; + private final String region; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/operations/{operation}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionOperationName(Builder builder) { + operation = Preconditions.checkNotNull(builder.getOperation()); + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + } + + public static ProjectRegionOperationName of(String operation, String project, String region) { + return newBuilder().setOperation(operation).setProject(project).setRegion(region).build(); + } + + public static String format(String operation, String project, String region) { + return of(operation, project, region).toString(); + } + + public String getOperation() { + return operation; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("operation", operation); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionOperationName parse(String formattedString) { + return ProjectRegionOperationName.parse(formattedString); + } + }; + } + + public static ProjectRegionOperationName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionOperationName.parse: formattedString not in valid format"); + return of(matchMap.get("operation"), matchMap.get("project"), matchMap.get("region")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String operation; + private String project; + private String region; + + public String getOperation() { + return operation; + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public Builder setOperation(String operation) { + this.operation = operation; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionOperationName projectRegionOperationName) { + operation = projectRegionOperationName.operation; + project = projectRegionOperationName.project; + region = projectRegionOperationName.region; + } + + public ProjectRegionOperationName build() { + return new ProjectRegionOperationName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "operation", operation, + "project", project, + "region", region); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionOperationName) { + ProjectRegionOperationName that = (ProjectRegionOperationName) o; + return Objects.equals(this.operation, that.getOperation()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(operation, project, region); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionRouterName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionRouterName.java new file mode 100644 index 000000000000..bbba1af582e7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionRouterName.java @@ -0,0 +1,183 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionRouterName implements ResourceName { + private final String project; + private final String region; + private final String router; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/regions/{region}/routers/{router}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionRouterName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + router = Preconditions.checkNotNull(builder.getRouter()); + } + + public static ProjectRegionRouterName of(String project, String region, String router) { + return newBuilder().setProject(project).setRegion(region).setRouter(router).build(); + } + + public static String format(String project, String region, String router) { + return of(project, region, router).toString(); + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getRouter() { + return router; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldMapBuilder.put("router", router); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionRouterName parse(String formattedString) { + return ProjectRegionRouterName.parse(formattedString); + } + }; + } + + public static ProjectRegionRouterName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectRegionRouterName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("region"), matchMap.get("router")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String region; + private String router; + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getRouter() { + return router; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public Builder setRouter(String router) { + this.router = router; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionRouterName projectRegionRouterName) { + project = projectRegionRouterName.project; + region = projectRegionRouterName.region; + router = projectRegionRouterName.router; + } + + public ProjectRegionRouterName build() { + return new ProjectRegionRouterName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "region", region, + "router", router); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionRouterName) { + ProjectRegionRouterName that = (ProjectRegionRouterName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.router, that.getRouter()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, region, router); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionSubnetworkName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionSubnetworkName.java new file mode 100644 index 000000000000..08d411226067 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionSubnetworkName.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionSubnetworkName implements ResourceName { + private final String project; + private final String region; + private final String subnetwork; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/subnetworks/{subnetwork}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionSubnetworkName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + subnetwork = Preconditions.checkNotNull(builder.getSubnetwork()); + } + + public static ProjectRegionSubnetworkName of(String project, String region, String subnetwork) { + return newBuilder().setProject(project).setRegion(region).setSubnetwork(subnetwork).build(); + } + + public static String format(String project, String region, String subnetwork) { + return of(project, region, subnetwork).toString(); + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getSubnetwork() { + return subnetwork; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldMapBuilder.put("subnetwork", subnetwork); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionSubnetworkName parse(String formattedString) { + return ProjectRegionSubnetworkName.parse(formattedString); + } + }; + } + + public static ProjectRegionSubnetworkName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionSubnetworkName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("region"), matchMap.get("subnetwork")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String region; + private String subnetwork; + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getSubnetwork() { + return subnetwork; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public Builder setSubnetwork(String subnetwork) { + this.subnetwork = subnetwork; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionSubnetworkName projectRegionSubnetworkName) { + project = projectRegionSubnetworkName.project; + region = projectRegionSubnetworkName.region; + subnetwork = projectRegionSubnetworkName.subnetwork; + } + + public ProjectRegionSubnetworkName build() { + return new ProjectRegionSubnetworkName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "region", region, + "subnetwork", subnetwork); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionSubnetworkName) { + ProjectRegionSubnetworkName that = (ProjectRegionSubnetworkName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.subnetwork, that.getSubnetwork()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, region, subnetwork); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionTargetPoolName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionTargetPoolName.java new file mode 100644 index 000000000000..99b49c4ece16 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionTargetPoolName.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionTargetPoolName implements ResourceName { + private final String project; + private final String region; + private final String targetPool; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/targetPools/{targetPool}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionTargetPoolName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + targetPool = Preconditions.checkNotNull(builder.getTargetPool()); + } + + public static ProjectRegionTargetPoolName of(String project, String region, String targetPool) { + return newBuilder().setProject(project).setRegion(region).setTargetPool(targetPool).build(); + } + + public static String format(String project, String region, String targetPool) { + return of(project, region, targetPool).toString(); + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getTargetPool() { + return targetPool; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldMapBuilder.put("targetPool", targetPool); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionTargetPoolName parse(String formattedString) { + return ProjectRegionTargetPoolName.parse(formattedString); + } + }; + } + + public static ProjectRegionTargetPoolName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionTargetPoolName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("region"), matchMap.get("targetPool")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String region; + private String targetPool; + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getTargetPool() { + return targetPool; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public Builder setTargetPool(String targetPool) { + this.targetPool = targetPool; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionTargetPoolName projectRegionTargetPoolName) { + project = projectRegionTargetPoolName.project; + region = projectRegionTargetPoolName.region; + targetPool = projectRegionTargetPoolName.targetPool; + } + + public ProjectRegionTargetPoolName build() { + return new ProjectRegionTargetPoolName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "region", region, + "targetPool", targetPool); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionTargetPoolName) { + ProjectRegionTargetPoolName that = (ProjectRegionTargetPoolName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.targetPool, that.getTargetPool()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, region, targetPool); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionTargetVpnGatewayName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionTargetVpnGatewayName.java new file mode 100644 index 000000000000..d08277e8cb00 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionTargetVpnGatewayName.java @@ -0,0 +1,190 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionTargetVpnGatewayName implements ResourceName { + private final String project; + private final String region; + private final String targetVpnGateway; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/targetVpnGateways/{targetVpnGateway}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionTargetVpnGatewayName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + targetVpnGateway = Preconditions.checkNotNull(builder.getTargetVpnGateway()); + } + + public static ProjectRegionTargetVpnGatewayName of( + String project, String region, String targetVpnGateway) { + return newBuilder() + .setProject(project) + .setRegion(region) + .setTargetVpnGateway(targetVpnGateway) + .build(); + } + + public static String format(String project, String region, String targetVpnGateway) { + return of(project, region, targetVpnGateway).toString(); + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getTargetVpnGateway() { + return targetVpnGateway; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldMapBuilder.put("targetVpnGateway", targetVpnGateway); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionTargetVpnGatewayName parse(String formattedString) { + return ProjectRegionTargetVpnGatewayName.parse(formattedString); + } + }; + } + + public static ProjectRegionTargetVpnGatewayName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionTargetVpnGatewayName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("region"), matchMap.get("targetVpnGateway")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String region; + private String targetVpnGateway; + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getTargetVpnGateway() { + return targetVpnGateway; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public Builder setTargetVpnGateway(String targetVpnGateway) { + this.targetVpnGateway = targetVpnGateway; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionTargetVpnGatewayName projectRegionTargetVpnGatewayName) { + project = projectRegionTargetVpnGatewayName.project; + region = projectRegionTargetVpnGatewayName.region; + targetVpnGateway = projectRegionTargetVpnGatewayName.targetVpnGateway; + } + + public ProjectRegionTargetVpnGatewayName build() { + return new ProjectRegionTargetVpnGatewayName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "region", region, + "targetVpnGateway", targetVpnGateway); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionTargetVpnGatewayName) { + ProjectRegionTargetVpnGatewayName that = (ProjectRegionTargetVpnGatewayName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.targetVpnGateway, that.getTargetVpnGateway()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, region, targetVpnGateway); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionVpnTunnelName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionVpnTunnelName.java new file mode 100644 index 000000000000..bde366102f22 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectRegionVpnTunnelName.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectRegionVpnTunnelName implements ResourceName { + private final String project; + private final String region; + private final String vpnTunnel; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/regions/{region}/vpnTunnels/{vpnTunnel}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectRegionVpnTunnelName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + region = Preconditions.checkNotNull(builder.getRegion()); + vpnTunnel = Preconditions.checkNotNull(builder.getVpnTunnel()); + } + + public static ProjectRegionVpnTunnelName of(String project, String region, String vpnTunnel) { + return newBuilder().setProject(project).setRegion(region).setVpnTunnel(vpnTunnel).build(); + } + + public static String format(String project, String region, String vpnTunnel) { + return of(project, region, vpnTunnel).toString(); + } + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getVpnTunnel() { + return vpnTunnel; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("region", region); + fieldMapBuilder.put("vpnTunnel", vpnTunnel); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectRegionVpnTunnelName parse(String formattedString) { + return ProjectRegionVpnTunnelName.parse(formattedString); + } + }; + } + + public static ProjectRegionVpnTunnelName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectRegionVpnTunnelName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("region"), matchMap.get("vpnTunnel")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String region; + private String vpnTunnel; + + public String getProject() { + return project; + } + + public String getRegion() { + return region; + } + + public String getVpnTunnel() { + return vpnTunnel; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public Builder setVpnTunnel(String vpnTunnel) { + this.vpnTunnel = vpnTunnel; + return this; + } + + private Builder() {} + + public Builder(ProjectRegionVpnTunnelName projectRegionVpnTunnelName) { + project = projectRegionVpnTunnelName.project; + region = projectRegionVpnTunnelName.region; + vpnTunnel = projectRegionVpnTunnelName.vpnTunnel; + } + + public ProjectRegionVpnTunnelName build() { + return new ProjectRegionVpnTunnelName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "region", region, + "vpnTunnel", vpnTunnel); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectRegionVpnTunnelName) { + ProjectRegionVpnTunnelName that = (ProjectRegionVpnTunnelName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.vpnTunnel, that.getVpnTunnel()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, region, vpnTunnel); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectSettings.java new file mode 100644 index 000000000000..6a4ef22a9f2e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectSettings.java @@ -0,0 +1,319 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.ProjectClient.GetXpnResourcesProjectsPagedResponse; +import static com.google.cloud.compute.v1.ProjectClient.ListXpnHostsProjectsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.ProjectStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link ProjectClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of disableXpnHostProject to 30 seconds: + * + *

+ * 
+ * ProjectSettings.Builder projectSettingsBuilder =
+ *     ProjectSettings.newBuilder();
+ * projectSettingsBuilder.disableXpnHostProjectSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * ProjectSettings projectSettings = projectSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ProjectSettings extends ClientSettings { + /** Returns the object with the settings used for calls to disableXpnHostProject. */ + public UnaryCallSettings + disableXpnHostProjectSettings() { + return ((ProjectStubSettings) getStubSettings()).disableXpnHostProjectSettings(); + } + + /** Returns the object with the settings used for calls to disableXpnResourceProject. */ + public UnaryCallSettings + disableXpnResourceProjectSettings() { + return ((ProjectStubSettings) getStubSettings()).disableXpnResourceProjectSettings(); + } + + /** Returns the object with the settings used for calls to enableXpnHostProject. */ + public UnaryCallSettings + enableXpnHostProjectSettings() { + return ((ProjectStubSettings) getStubSettings()).enableXpnHostProjectSettings(); + } + + /** Returns the object with the settings used for calls to enableXpnResourceProject. */ + public UnaryCallSettings + enableXpnResourceProjectSettings() { + return ((ProjectStubSettings) getStubSettings()).enableXpnResourceProjectSettings(); + } + + /** Returns the object with the settings used for calls to getProject. */ + public UnaryCallSettings getProjectSettings() { + return ((ProjectStubSettings) getStubSettings()).getProjectSettings(); + } + + /** Returns the object with the settings used for calls to getXpnHostProject. */ + public UnaryCallSettings getXpnHostProjectSettings() { + return ((ProjectStubSettings) getStubSettings()).getXpnHostProjectSettings(); + } + + /** Returns the object with the settings used for calls to getXpnResourcesProjects. */ + public PagedCallSettings< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, + GetXpnResourcesProjectsPagedResponse> + getXpnResourcesProjectsSettings() { + return ((ProjectStubSettings) getStubSettings()).getXpnResourcesProjectsSettings(); + } + + /** Returns the object with the settings used for calls to listXpnHostsProjects. */ + public PagedCallSettings< + ListXpnHostsProjectsHttpRequest, XpnHostList, ListXpnHostsProjectsPagedResponse> + listXpnHostsProjectsSettings() { + return ((ProjectStubSettings) getStubSettings()).listXpnHostsProjectsSettings(); + } + + /** Returns the object with the settings used for calls to moveDiskProject. */ + public UnaryCallSettings moveDiskProjectSettings() { + return ((ProjectStubSettings) getStubSettings()).moveDiskProjectSettings(); + } + + /** Returns the object with the settings used for calls to moveInstanceProject. */ + public UnaryCallSettings + moveInstanceProjectSettings() { + return ((ProjectStubSettings) getStubSettings()).moveInstanceProjectSettings(); + } + + /** Returns the object with the settings used for calls to setCommonInstanceMetadataProject. */ + public UnaryCallSettings + setCommonInstanceMetadataProjectSettings() { + return ((ProjectStubSettings) getStubSettings()).setCommonInstanceMetadataProjectSettings(); + } + + /** Returns the object with the settings used for calls to setUsageExportBucketProject. */ + public UnaryCallSettings + setUsageExportBucketProjectSettings() { + return ((ProjectStubSettings) getStubSettings()).setUsageExportBucketProjectSettings(); + } + + public static final ProjectSettings create(ProjectStubSettings stub) throws IOException { + return new ProjectSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ProjectStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ProjectStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return ProjectStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ProjectStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ProjectStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ProjectStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ProjectStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ProjectStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ProjectSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ProjectSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(ProjectStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(ProjectStubSettings.newBuilder()); + } + + protected Builder(ProjectSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ProjectStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public ProjectStubSettings.Builder getStubSettingsBuilder() { + return ((ProjectStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to disableXpnHostProject. */ + public UnaryCallSettings.Builder + disableXpnHostProjectSettings() { + return getStubSettingsBuilder().disableXpnHostProjectSettings(); + } + + /** Returns the builder for the settings used for calls to disableXpnResourceProject. */ + public UnaryCallSettings.Builder + disableXpnResourceProjectSettings() { + return getStubSettingsBuilder().disableXpnResourceProjectSettings(); + } + + /** Returns the builder for the settings used for calls to enableXpnHostProject. */ + public UnaryCallSettings.Builder + enableXpnHostProjectSettings() { + return getStubSettingsBuilder().enableXpnHostProjectSettings(); + } + + /** Returns the builder for the settings used for calls to enableXpnResourceProject. */ + public UnaryCallSettings.Builder + enableXpnResourceProjectSettings() { + return getStubSettingsBuilder().enableXpnResourceProjectSettings(); + } + + /** Returns the builder for the settings used for calls to getProject. */ + public UnaryCallSettings.Builder getProjectSettings() { + return getStubSettingsBuilder().getProjectSettings(); + } + + /** Returns the builder for the settings used for calls to getXpnHostProject. */ + public UnaryCallSettings.Builder + getXpnHostProjectSettings() { + return getStubSettingsBuilder().getXpnHostProjectSettings(); + } + + /** Returns the builder for the settings used for calls to getXpnResourcesProjects. */ + public PagedCallSettings.Builder< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, + GetXpnResourcesProjectsPagedResponse> + getXpnResourcesProjectsSettings() { + return getStubSettingsBuilder().getXpnResourcesProjectsSettings(); + } + + /** Returns the builder for the settings used for calls to listXpnHostsProjects. */ + public PagedCallSettings.Builder< + ListXpnHostsProjectsHttpRequest, XpnHostList, ListXpnHostsProjectsPagedResponse> + listXpnHostsProjectsSettings() { + return getStubSettingsBuilder().listXpnHostsProjectsSettings(); + } + + /** Returns the builder for the settings used for calls to moveDiskProject. */ + public UnaryCallSettings.Builder + moveDiskProjectSettings() { + return getStubSettingsBuilder().moveDiskProjectSettings(); + } + + /** Returns the builder for the settings used for calls to moveInstanceProject. */ + public UnaryCallSettings.Builder + moveInstanceProjectSettings() { + return getStubSettingsBuilder().moveInstanceProjectSettings(); + } + + /** Returns the builder for the settings used for calls to setCommonInstanceMetadataProject. */ + public UnaryCallSettings.Builder + setCommonInstanceMetadataProjectSettings() { + return getStubSettingsBuilder().setCommonInstanceMetadataProjectSettings(); + } + + /** Returns the builder for the settings used for calls to setUsageExportBucketProject. */ + public UnaryCallSettings.Builder + setUsageExportBucketProjectSettings() { + return getStubSettingsBuilder().setUsageExportBucketProjectSettings(); + } + + @Override + public ProjectSettings build() throws IOException { + return new ProjectSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectTargetHttpProxyName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectTargetHttpProxyName.java new file mode 100644 index 000000000000..e5be5d2b4024 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectTargetHttpProxyName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectTargetHttpProxyName implements ResourceName { + private final String project; + private final String targetHttpProxy; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/targetHttpProxies/{targetHttpProxy}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectTargetHttpProxyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + targetHttpProxy = Preconditions.checkNotNull(builder.getTargetHttpProxy()); + } + + public static ProjectTargetHttpProxyName of(String project, String targetHttpProxy) { + return newBuilder().setProject(project).setTargetHttpProxy(targetHttpProxy).build(); + } + + public static String format(String project, String targetHttpProxy) { + return of(project, targetHttpProxy).toString(); + } + + public String getProject() { + return project; + } + + public String getTargetHttpProxy() { + return targetHttpProxy; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("targetHttpProxy", targetHttpProxy); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectTargetHttpProxyName parse(String formattedString) { + return ProjectTargetHttpProxyName.parse(formattedString); + } + }; + } + + public static ProjectTargetHttpProxyName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectTargetHttpProxyName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("targetHttpProxy")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String targetHttpProxy; + + public String getProject() { + return project; + } + + public String getTargetHttpProxy() { + return targetHttpProxy; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setTargetHttpProxy(String targetHttpProxy) { + this.targetHttpProxy = targetHttpProxy; + return this; + } + + private Builder() {} + + public Builder(ProjectTargetHttpProxyName projectTargetHttpProxyName) { + project = projectTargetHttpProxyName.project; + targetHttpProxy = projectTargetHttpProxyName.targetHttpProxy; + } + + public ProjectTargetHttpProxyName build() { + return new ProjectTargetHttpProxyName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "targetHttpProxy", targetHttpProxy); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectTargetHttpProxyName) { + ProjectTargetHttpProxyName that = (ProjectTargetHttpProxyName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.targetHttpProxy, that.getTargetHttpProxy()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, targetHttpProxy); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectTargetHttpsProxyName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectTargetHttpsProxyName.java new file mode 100644 index 000000000000..d44dfb7fc890 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectTargetHttpsProxyName.java @@ -0,0 +1,165 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectTargetHttpsProxyName implements ResourceName { + private final String project; + private final String targetHttpsProxy; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/targetHttpsProxies/{targetHttpsProxy}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectTargetHttpsProxyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + targetHttpsProxy = Preconditions.checkNotNull(builder.getTargetHttpsProxy()); + } + + public static ProjectTargetHttpsProxyName of(String project, String targetHttpsProxy) { + return newBuilder().setProject(project).setTargetHttpsProxy(targetHttpsProxy).build(); + } + + public static String format(String project, String targetHttpsProxy) { + return of(project, targetHttpsProxy).toString(); + } + + public String getProject() { + return project; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("targetHttpsProxy", targetHttpsProxy); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectTargetHttpsProxyName parse(String formattedString) { + return ProjectTargetHttpsProxyName.parse(formattedString); + } + }; + } + + public static ProjectTargetHttpsProxyName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectTargetHttpsProxyName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("targetHttpsProxy")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String targetHttpsProxy; + + public String getProject() { + return project; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setTargetHttpsProxy(String targetHttpsProxy) { + this.targetHttpsProxy = targetHttpsProxy; + return this; + } + + private Builder() {} + + public Builder(ProjectTargetHttpsProxyName projectTargetHttpsProxyName) { + project = projectTargetHttpsProxyName.project; + targetHttpsProxy = projectTargetHttpsProxyName.targetHttpsProxy; + } + + public ProjectTargetHttpsProxyName build() { + return new ProjectTargetHttpsProxyName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "targetHttpsProxy", targetHttpsProxy); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectTargetHttpsProxyName) { + ProjectTargetHttpsProxyName that = (ProjectTargetHttpsProxyName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.targetHttpsProxy, that.getTargetHttpsProxy()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, targetHttpsProxy); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneAcceleratorTypeName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneAcceleratorTypeName.java new file mode 100644 index 000000000000..77961f185427 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneAcceleratorTypeName.java @@ -0,0 +1,190 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneAcceleratorTypeName implements ResourceName { + private final String acceleratorType; + private final String project; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/zones/{zone}/acceleratorTypes/{acceleratorType}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneAcceleratorTypeName(Builder builder) { + acceleratorType = Preconditions.checkNotNull(builder.getAcceleratorType()); + project = Preconditions.checkNotNull(builder.getProject()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneAcceleratorTypeName of( + String acceleratorType, String project, String zone) { + return newBuilder() + .setAcceleratorType(acceleratorType) + .setProject(project) + .setZone(zone) + .build(); + } + + public static String format(String acceleratorType, String project, String zone) { + return of(acceleratorType, project, zone).toString(); + } + + public String getAcceleratorType() { + return acceleratorType; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("acceleratorType", acceleratorType); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneAcceleratorTypeName parse(String formattedString) { + return ProjectZoneAcceleratorTypeName.parse(formattedString); + } + }; + } + + public static ProjectZoneAcceleratorTypeName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectZoneAcceleratorTypeName.parse: formattedString not in valid format"); + return of(matchMap.get("acceleratorType"), matchMap.get("project"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String acceleratorType; + private String project; + private String zone; + + public String getAcceleratorType() { + return acceleratorType; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + public Builder setAcceleratorType(String acceleratorType) { + this.acceleratorType = acceleratorType; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneAcceleratorTypeName projectZoneAcceleratorTypeName) { + acceleratorType = projectZoneAcceleratorTypeName.acceleratorType; + project = projectZoneAcceleratorTypeName.project; + zone = projectZoneAcceleratorTypeName.zone; + } + + public ProjectZoneAcceleratorTypeName build() { + return new ProjectZoneAcceleratorTypeName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "acceleratorType", acceleratorType, + "project", project, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneAcceleratorTypeName) { + ProjectZoneAcceleratorTypeName that = (ProjectZoneAcceleratorTypeName) o; + return Objects.equals(this.acceleratorType, that.getAcceleratorType()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(acceleratorType, project, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneAutoscalerName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneAutoscalerName.java new file mode 100644 index 000000000000..844036b94c7b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneAutoscalerName.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneAutoscalerName implements ResourceName { + private final String autoscaler; + private final String project; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/zones/{zone}/autoscalers/{autoscaler}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneAutoscalerName(Builder builder) { + autoscaler = Preconditions.checkNotNull(builder.getAutoscaler()); + project = Preconditions.checkNotNull(builder.getProject()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneAutoscalerName of(String autoscaler, String project, String zone) { + return newBuilder().setAutoscaler(autoscaler).setProject(project).setZone(zone).build(); + } + + public static String format(String autoscaler, String project, String zone) { + return of(autoscaler, project, zone).toString(); + } + + public String getAutoscaler() { + return autoscaler; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("autoscaler", autoscaler); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneAutoscalerName parse(String formattedString) { + return ProjectZoneAutoscalerName.parse(formattedString); + } + }; + } + + public static ProjectZoneAutoscalerName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectZoneAutoscalerName.parse: formattedString not in valid format"); + return of(matchMap.get("autoscaler"), matchMap.get("project"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String autoscaler; + private String project; + private String zone; + + public String getAutoscaler() { + return autoscaler; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + public Builder setAutoscaler(String autoscaler) { + this.autoscaler = autoscaler; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneAutoscalerName projectZoneAutoscalerName) { + autoscaler = projectZoneAutoscalerName.autoscaler; + project = projectZoneAutoscalerName.project; + zone = projectZoneAutoscalerName.zone; + } + + public ProjectZoneAutoscalerName build() { + return new ProjectZoneAutoscalerName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "autoscaler", autoscaler, + "project", project, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneAutoscalerName) { + ProjectZoneAutoscalerName that = (ProjectZoneAutoscalerName) o; + return Objects.equals(this.autoscaler, that.getAutoscaler()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(autoscaler, project, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneDiskName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneDiskName.java new file mode 100644 index 000000000000..02b80985090e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneDiskName.java @@ -0,0 +1,183 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneDiskName implements ResourceName { + private final String disk; + private final String project; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/zones/{zone}/disks/{disk}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneDiskName(Builder builder) { + disk = Preconditions.checkNotNull(builder.getDisk()); + project = Preconditions.checkNotNull(builder.getProject()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneDiskName of(String disk, String project, String zone) { + return newBuilder().setDisk(disk).setProject(project).setZone(zone).build(); + } + + public static String format(String disk, String project, String zone) { + return of(disk, project, zone).toString(); + } + + public String getDisk() { + return disk; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("disk", disk); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneDiskName parse(String formattedString) { + return ProjectZoneDiskName.parse(formattedString); + } + }; + } + + public static ProjectZoneDiskName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectZoneDiskName.parse: formattedString not in valid format"); + return of(matchMap.get("disk"), matchMap.get("project"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String disk; + private String project; + private String zone; + + public String getDisk() { + return disk; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + public Builder setDisk(String disk) { + this.disk = disk; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneDiskName projectZoneDiskName) { + disk = projectZoneDiskName.disk; + project = projectZoneDiskName.project; + zone = projectZoneDiskName.zone; + } + + public ProjectZoneDiskName build() { + return new ProjectZoneDiskName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "disk", disk, + "project", project, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneDiskName) { + ProjectZoneDiskName that = (ProjectZoneDiskName) o; + return Objects.equals(this.disk, that.getDisk()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(disk, project, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneDiskResourceName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneDiskResourceName.java new file mode 100644 index 000000000000..6f359423c07b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneDiskResourceName.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneDiskResourceName implements ResourceName { + private final String project; + private final String resource; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/zones/{zone}/disks/{resource}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneDiskResourceName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + resource = Preconditions.checkNotNull(builder.getResource()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneDiskResourceName of(String project, String resource, String zone) { + return newBuilder().setProject(project).setResource(resource).setZone(zone).build(); + } + + public static String format(String project, String resource, String zone) { + return of(project, resource, zone).toString(); + } + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("resource", resource); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneDiskResourceName parse(String formattedString) { + return ProjectZoneDiskResourceName.parse(formattedString); + } + }; + } + + public static ProjectZoneDiskResourceName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectZoneDiskResourceName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("resource"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String resource; + private String zone; + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + public String getZone() { + return zone; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneDiskResourceName projectZoneDiskResourceName) { + project = projectZoneDiskResourceName.project; + resource = projectZoneDiskResourceName.resource; + zone = projectZoneDiskResourceName.zone; + } + + public ProjectZoneDiskResourceName build() { + return new ProjectZoneDiskResourceName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "resource", resource, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneDiskResourceName) { + ProjectZoneDiskResourceName that = (ProjectZoneDiskResourceName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.resource, that.getResource()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, resource, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneDiskTypeName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneDiskTypeName.java new file mode 100644 index 000000000000..d230dd0b4f1a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneDiskTypeName.java @@ -0,0 +1,183 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneDiskTypeName implements ResourceName { + private final String diskType; + private final String project; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/zones/{zone}/diskTypes/{diskType}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneDiskTypeName(Builder builder) { + diskType = Preconditions.checkNotNull(builder.getDiskType()); + project = Preconditions.checkNotNull(builder.getProject()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneDiskTypeName of(String diskType, String project, String zone) { + return newBuilder().setDiskType(diskType).setProject(project).setZone(zone).build(); + } + + public static String format(String diskType, String project, String zone) { + return of(diskType, project, zone).toString(); + } + + public String getDiskType() { + return diskType; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("diskType", diskType); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneDiskTypeName parse(String formattedString) { + return ProjectZoneDiskTypeName.parse(formattedString); + } + }; + } + + public static ProjectZoneDiskTypeName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectZoneDiskTypeName.parse: formattedString not in valid format"); + return of(matchMap.get("diskType"), matchMap.get("project"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String diskType; + private String project; + private String zone; + + public String getDiskType() { + return diskType; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + public Builder setDiskType(String diskType) { + this.diskType = diskType; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneDiskTypeName projectZoneDiskTypeName) { + diskType = projectZoneDiskTypeName.diskType; + project = projectZoneDiskTypeName.project; + zone = projectZoneDiskTypeName.zone; + } + + public ProjectZoneDiskTypeName build() { + return new ProjectZoneDiskTypeName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "diskType", diskType, + "project", project, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneDiskTypeName) { + ProjectZoneDiskTypeName that = (ProjectZoneDiskTypeName) o; + return Objects.equals(this.diskType, that.getDiskType()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(diskType, project, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceGroupManagerName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceGroupManagerName.java new file mode 100644 index 000000000000..51be0e7b6809 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceGroupManagerName.java @@ -0,0 +1,190 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneInstanceGroupManagerName implements ResourceName { + private final String instanceGroupManager; + private final String project; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneInstanceGroupManagerName(Builder builder) { + instanceGroupManager = Preconditions.checkNotNull(builder.getInstanceGroupManager()); + project = Preconditions.checkNotNull(builder.getProject()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneInstanceGroupManagerName of( + String instanceGroupManager, String project, String zone) { + return newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setProject(project) + .setZone(zone) + .build(); + } + + public static String format(String instanceGroupManager, String project, String zone) { + return of(instanceGroupManager, project, zone).toString(); + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("instanceGroupManager", instanceGroupManager); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneInstanceGroupManagerName parse(String formattedString) { + return ProjectZoneInstanceGroupManagerName.parse(formattedString); + } + }; + } + + public static ProjectZoneInstanceGroupManagerName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectZoneInstanceGroupManagerName.parse: formattedString not in valid format"); + return of(matchMap.get("instanceGroupManager"), matchMap.get("project"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String instanceGroupManager; + private String project; + private String zone; + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneInstanceGroupManagerName projectZoneInstanceGroupManagerName) { + instanceGroupManager = projectZoneInstanceGroupManagerName.instanceGroupManager; + project = projectZoneInstanceGroupManagerName.project; + zone = projectZoneInstanceGroupManagerName.zone; + } + + public ProjectZoneInstanceGroupManagerName build() { + return new ProjectZoneInstanceGroupManagerName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "instanceGroupManager", instanceGroupManager, + "project", project, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneInstanceGroupManagerName) { + ProjectZoneInstanceGroupManagerName that = (ProjectZoneInstanceGroupManagerName) o; + return Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instanceGroupManager, project, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceGroupName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceGroupName.java new file mode 100644 index 000000000000..9a6fea50f40f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceGroupName.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneInstanceGroupName implements ResourceName { + private final String instanceGroup; + private final String project; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/zones/{zone}/instanceGroups/{instanceGroup}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneInstanceGroupName(Builder builder) { + instanceGroup = Preconditions.checkNotNull(builder.getInstanceGroup()); + project = Preconditions.checkNotNull(builder.getProject()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneInstanceGroupName of(String instanceGroup, String project, String zone) { + return newBuilder().setInstanceGroup(instanceGroup).setProject(project).setZone(zone).build(); + } + + public static String format(String instanceGroup, String project, String zone) { + return of(instanceGroup, project, zone).toString(); + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("instanceGroup", instanceGroup); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneInstanceGroupName parse(String formattedString) { + return ProjectZoneInstanceGroupName.parse(formattedString); + } + }; + } + + public static ProjectZoneInstanceGroupName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectZoneInstanceGroupName.parse: formattedString not in valid format"); + return of(matchMap.get("instanceGroup"), matchMap.get("project"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String instanceGroup; + private String project; + private String zone; + + public String getInstanceGroup() { + return instanceGroup; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneInstanceGroupName projectZoneInstanceGroupName) { + instanceGroup = projectZoneInstanceGroupName.instanceGroup; + project = projectZoneInstanceGroupName.project; + zone = projectZoneInstanceGroupName.zone; + } + + public ProjectZoneInstanceGroupName build() { + return new ProjectZoneInstanceGroupName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "instanceGroup", instanceGroup, + "project", project, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneInstanceGroupName) { + ProjectZoneInstanceGroupName that = (ProjectZoneInstanceGroupName) o; + return Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instanceGroup, project, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceName.java new file mode 100644 index 000000000000..4fca6509e6b3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceName.java @@ -0,0 +1,183 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneInstanceName implements ResourceName { + private final String instance; + private final String project; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/zones/{zone}/instances/{instance}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneInstanceName(Builder builder) { + instance = Preconditions.checkNotNull(builder.getInstance()); + project = Preconditions.checkNotNull(builder.getProject()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneInstanceName of(String instance, String project, String zone) { + return newBuilder().setInstance(instance).setProject(project).setZone(zone).build(); + } + + public static String format(String instance, String project, String zone) { + return of(instance, project, zone).toString(); + } + + public String getInstance() { + return instance; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("instance", instance); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneInstanceName parse(String formattedString) { + return ProjectZoneInstanceName.parse(formattedString); + } + }; + } + + public static ProjectZoneInstanceName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectZoneInstanceName.parse: formattedString not in valid format"); + return of(matchMap.get("instance"), matchMap.get("project"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String instance; + private String project; + private String zone; + + public String getInstance() { + return instance; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneInstanceName projectZoneInstanceName) { + instance = projectZoneInstanceName.instance; + project = projectZoneInstanceName.project; + zone = projectZoneInstanceName.zone; + } + + public ProjectZoneInstanceName build() { + return new ProjectZoneInstanceName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "instance", instance, + "project", project, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneInstanceName) { + ProjectZoneInstanceName that = (ProjectZoneInstanceName) o; + return Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instance, project, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceResourceName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceResourceName.java new file mode 100644 index 000000000000..1d449695937d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneInstanceResourceName.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneInstanceResourceName implements ResourceName { + private final String project; + private final String resource; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/zones/{zone}/instances/{resource}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneInstanceResourceName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + resource = Preconditions.checkNotNull(builder.getResource()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneInstanceResourceName of(String project, String resource, String zone) { + return newBuilder().setProject(project).setResource(resource).setZone(zone).build(); + } + + public static String format(String project, String resource, String zone) { + return of(project, resource, zone).toString(); + } + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("resource", resource); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneInstanceResourceName parse(String formattedString) { + return ProjectZoneInstanceResourceName.parse(formattedString); + } + }; + } + + public static ProjectZoneInstanceResourceName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectZoneInstanceResourceName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("resource"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String resource; + private String zone; + + public String getProject() { + return project; + } + + public String getResource() { + return resource; + } + + public String getZone() { + return zone; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneInstanceResourceName projectZoneInstanceResourceName) { + project = projectZoneInstanceResourceName.project; + resource = projectZoneInstanceResourceName.resource; + zone = projectZoneInstanceResourceName.zone; + } + + public ProjectZoneInstanceResourceName build() { + return new ProjectZoneInstanceResourceName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "resource", resource, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneInstanceResourceName) { + ProjectZoneInstanceResourceName that = (ProjectZoneInstanceResourceName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.resource, that.getResource()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, resource, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneMachineTypeName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneMachineTypeName.java new file mode 100644 index 000000000000..12c3210fc2dd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneMachineTypeName.java @@ -0,0 +1,185 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneMachineTypeName implements ResourceName { + private final String machineType; + private final String project; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/zones/{zone}/machineTypes/{machineType}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneMachineTypeName(Builder builder) { + machineType = Preconditions.checkNotNull(builder.getMachineType()); + project = Preconditions.checkNotNull(builder.getProject()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneMachineTypeName of(String machineType, String project, String zone) { + return newBuilder().setMachineType(machineType).setProject(project).setZone(zone).build(); + } + + public static String format(String machineType, String project, String zone) { + return of(machineType, project, zone).toString(); + } + + public String getMachineType() { + return machineType; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("machineType", machineType); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneMachineTypeName parse(String formattedString) { + return ProjectZoneMachineTypeName.parse(formattedString); + } + }; + } + + public static ProjectZoneMachineTypeName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectZoneMachineTypeName.parse: formattedString not in valid format"); + return of(matchMap.get("machineType"), matchMap.get("project"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String machineType; + private String project; + private String zone; + + public String getMachineType() { + return machineType; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + public Builder setMachineType(String machineType) { + this.machineType = machineType; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneMachineTypeName projectZoneMachineTypeName) { + machineType = projectZoneMachineTypeName.machineType; + project = projectZoneMachineTypeName.project; + zone = projectZoneMachineTypeName.zone; + } + + public ProjectZoneMachineTypeName build() { + return new ProjectZoneMachineTypeName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "machineType", machineType, + "project", project, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneMachineTypeName) { + ProjectZoneMachineTypeName that = (ProjectZoneMachineTypeName) o; + return Objects.equals(this.machineType, that.getMachineType()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(machineType, project, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneName.java new file mode 100644 index 000000000000..ee24baa1290b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneName.java @@ -0,0 +1,163 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneName implements ResourceName { + private final String project; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/zones/{zone}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneName of(String project, String zone) { + return newBuilder().setProject(project).setZone(zone).build(); + } + + public static String format(String project, String zone) { + return of(project, zone).toString(); + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneName parse(String formattedString) { + return ProjectZoneName.parse(formattedString); + } + }; + } + + public static ProjectZoneName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectZoneName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String zone; + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneName projectZoneName) { + project = projectZoneName.project; + zone = projectZoneName.zone; + } + + public ProjectZoneName build() { + return new ProjectZoneName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneName) { + ProjectZoneName that = (ProjectZoneName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneOperationName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneOperationName.java new file mode 100644 index 000000000000..e74c23d3e1a9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneOperationName.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneOperationName implements ResourceName { + private final String operation; + private final String project; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/zones/{zone}/operations/{operation}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneOperationName(Builder builder) { + operation = Preconditions.checkNotNull(builder.getOperation()); + project = Preconditions.checkNotNull(builder.getProject()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneOperationName of(String operation, String project, String zone) { + return newBuilder().setOperation(operation).setProject(project).setZone(zone).build(); + } + + public static String format(String operation, String project, String zone) { + return of(operation, project, zone).toString(); + } + + public String getOperation() { + return operation; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("operation", operation); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneOperationName parse(String formattedString) { + return ProjectZoneOperationName.parse(formattedString); + } + }; + } + + public static ProjectZoneOperationName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ProjectZoneOperationName.parse: formattedString not in valid format"); + return of(matchMap.get("operation"), matchMap.get("project"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String operation; + private String project; + private String zone; + + public String getOperation() { + return operation; + } + + public String getProject() { + return project; + } + + public String getZone() { + return zone; + } + + public Builder setOperation(String operation) { + this.operation = operation; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneOperationName projectZoneOperationName) { + operation = projectZoneOperationName.operation; + project = projectZoneOperationName.project; + zone = projectZoneOperationName.zone; + } + + public ProjectZoneOperationName build() { + return new ProjectZoneOperationName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "operation", operation, + "project", project, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneOperationName) { + ProjectZoneOperationName that = (ProjectZoneOperationName) o; + return Objects.equals(this.operation, that.getOperation()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(operation, project, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneTargetInstanceName.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneTargetInstanceName.java new file mode 100644 index 000000000000..29ec279246f8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectZoneTargetInstanceName.java @@ -0,0 +1,186 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.api.resourcenames.ResourceNameFactory; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectZoneTargetInstanceName implements ResourceName { + private final String project; + private final String targetInstance; + private final String zone; + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/zones/{zone}/targetInstances/{targetInstance}"); + + private volatile Map fieldValuesMap; + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectZoneTargetInstanceName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + targetInstance = Preconditions.checkNotNull(builder.getTargetInstance()); + zone = Preconditions.checkNotNull(builder.getZone()); + } + + public static ProjectZoneTargetInstanceName of( + String project, String targetInstance, String zone) { + return newBuilder().setProject(project).setTargetInstance(targetInstance).setZone(zone).build(); + } + + public static String format(String project, String targetInstance, String zone) { + return of(project, targetInstance, zone).toString(); + } + + public String getProject() { + return project; + } + + public String getTargetInstance() { + return targetInstance; + } + + public String getZone() { + return zone; + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("targetInstance", targetInstance); + fieldMapBuilder.put("zone", zone); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + public static ResourceNameFactory newFactory() { + return new ResourceNameFactory() { + public ProjectZoneTargetInstanceName parse(String formattedString) { + return ProjectZoneTargetInstanceName.parse(formattedString); + } + }; + } + + public static ProjectZoneTargetInstanceName parse(String formattedString) { + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, + "ProjectZoneTargetInstanceName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("targetInstance"), matchMap.get("zone")); + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public static class Builder { + private String project; + private String targetInstance; + private String zone; + + public String getProject() { + return project; + } + + public String getTargetInstance() { + return targetInstance; + } + + public String getZone() { + return zone; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setTargetInstance(String targetInstance) { + this.targetInstance = targetInstance; + return this; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + private Builder() {} + + public Builder(ProjectZoneTargetInstanceName projectZoneTargetInstanceName) { + project = projectZoneTargetInstanceName.project; + targetInstance = projectZoneTargetInstanceName.targetInstance; + zone = projectZoneTargetInstanceName.zone; + } + + public ProjectZoneTargetInstanceName build() { + return new ProjectZoneTargetInstanceName(this); + } + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, + "targetInstance", targetInstance, + "zone", zone); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectZoneTargetInstanceName) { + ProjectZoneTargetInstanceName that = (ProjectZoneTargetInstanceName) o; + return Objects.equals(this.project, that.getProject()) + && Objects.equals(this.targetInstance, that.getTargetInstance()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(project, targetInstance, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsDisableXpnResourceRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsDisableXpnResourceRequest.java new file mode 100644 index 000000000000..cfdf2021f2d7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsDisableXpnResourceRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectsDisableXpnResourceRequest implements ApiMessage { + private final XpnResourceId xpnResource; + + private ProjectsDisableXpnResourceRequest() { + this.xpnResource = null; + } + + private ProjectsDisableXpnResourceRequest(XpnResourceId xpnResource) { + this.xpnResource = xpnResource; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("xpnResource")) { + return xpnResource; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public XpnResourceId getXpnResource() { + return xpnResource; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ProjectsDisableXpnResourceRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ProjectsDisableXpnResourceRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ProjectsDisableXpnResourceRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ProjectsDisableXpnResourceRequest(); + } + + public static class Builder { + private XpnResourceId xpnResource; + + Builder() {} + + public Builder mergeFrom(ProjectsDisableXpnResourceRequest other) { + if (other == ProjectsDisableXpnResourceRequest.getDefaultInstance()) return this; + if (other.getXpnResource() != null) { + this.xpnResource = other.xpnResource; + } + return this; + } + + Builder(ProjectsDisableXpnResourceRequest source) { + this.xpnResource = source.xpnResource; + } + + public XpnResourceId getXpnResource() { + return xpnResource; + } + + public Builder setXpnResource(XpnResourceId xpnResource) { + this.xpnResource = xpnResource; + return this; + } + + public ProjectsDisableXpnResourceRequest build() { + return new ProjectsDisableXpnResourceRequest(xpnResource); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setXpnResource(this.xpnResource); + return newBuilder; + } + } + + @Override + public String toString() { + return "ProjectsDisableXpnResourceRequest{" + "xpnResource=" + xpnResource + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectsDisableXpnResourceRequest) { + ProjectsDisableXpnResourceRequest that = (ProjectsDisableXpnResourceRequest) o; + return Objects.equals(this.xpnResource, that.getXpnResource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(xpnResource); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsEnableXpnResourceRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsEnableXpnResourceRequest.java new file mode 100644 index 000000000000..6711dcfed506 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsEnableXpnResourceRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectsEnableXpnResourceRequest implements ApiMessage { + private final XpnResourceId xpnResource; + + private ProjectsEnableXpnResourceRequest() { + this.xpnResource = null; + } + + private ProjectsEnableXpnResourceRequest(XpnResourceId xpnResource) { + this.xpnResource = xpnResource; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("xpnResource")) { + return xpnResource; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public XpnResourceId getXpnResource() { + return xpnResource; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ProjectsEnableXpnResourceRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ProjectsEnableXpnResourceRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ProjectsEnableXpnResourceRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ProjectsEnableXpnResourceRequest(); + } + + public static class Builder { + private XpnResourceId xpnResource; + + Builder() {} + + public Builder mergeFrom(ProjectsEnableXpnResourceRequest other) { + if (other == ProjectsEnableXpnResourceRequest.getDefaultInstance()) return this; + if (other.getXpnResource() != null) { + this.xpnResource = other.xpnResource; + } + return this; + } + + Builder(ProjectsEnableXpnResourceRequest source) { + this.xpnResource = source.xpnResource; + } + + public XpnResourceId getXpnResource() { + return xpnResource; + } + + public Builder setXpnResource(XpnResourceId xpnResource) { + this.xpnResource = xpnResource; + return this; + } + + public ProjectsEnableXpnResourceRequest build() { + return new ProjectsEnableXpnResourceRequest(xpnResource); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setXpnResource(this.xpnResource); + return newBuilder; + } + } + + @Override + public String toString() { + return "ProjectsEnableXpnResourceRequest{" + "xpnResource=" + xpnResource + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectsEnableXpnResourceRequest) { + ProjectsEnableXpnResourceRequest that = (ProjectsEnableXpnResourceRequest) o; + return Objects.equals(this.xpnResource, that.getXpnResource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(xpnResource); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsGetXpnResources.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsGetXpnResources.java new file mode 100644 index 000000000000..3a9c24aaf12d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsGetXpnResources.java @@ -0,0 +1,214 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectsGetXpnResources implements ApiMessage { + private final String kind; + private final String nextPageToken; + private final List resources; + + private ProjectsGetXpnResources() { + this.kind = null; + this.nextPageToken = null; + this.resources = null; + } + + private ProjectsGetXpnResources( + String kind, String nextPageToken, List resources) { + this.kind = kind; + this.nextPageToken = nextPageToken; + this.resources = resources; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("resources")) { + return resources; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public List getResourcesList() { + return resources; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ProjectsGetXpnResources prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ProjectsGetXpnResources getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ProjectsGetXpnResources DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ProjectsGetXpnResources(); + } + + public static class Builder { + private String kind; + private String nextPageToken; + private List resources; + + Builder() {} + + public Builder mergeFrom(ProjectsGetXpnResources other) { + if (other == ProjectsGetXpnResources.getDefaultInstance()) return this; + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getResourcesList() != null) { + this.resources = other.resources; + } + return this; + } + + Builder(ProjectsGetXpnResources source) { + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.resources = source.resources; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public List getResourcesList() { + return resources; + } + + public Builder addAllResources(List resources) { + if (this.resources == null) { + this.resources = new ArrayList<>(resources.size()); + } + this.resources.addAll(resources); + return this; + } + + public Builder addResources(XpnResourceId resources) { + this.resources.add(resources); + return this; + } + + public ProjectsGetXpnResources build() { + + return new ProjectsGetXpnResources(kind, nextPageToken, resources); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.addAllResources(this.resources); + return newBuilder; + } + } + + @Override + public String toString() { + return "ProjectsGetXpnResources{" + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "resources=" + + resources + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectsGetXpnResources) { + ProjectsGetXpnResources that = (ProjectsGetXpnResources) o; + return Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.resources, that.getResourcesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(kind, nextPageToken, resources); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsListXpnHostsRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsListXpnHostsRequest.java new file mode 100644 index 000000000000..9f5602b43fc6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectsListXpnHostsRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ProjectsListXpnHostsRequest implements ApiMessage { + private final String organization; + + private ProjectsListXpnHostsRequest() { + this.organization = null; + } + + private ProjectsListXpnHostsRequest(String organization) { + this.organization = organization; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("organization")) { + return organization; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getOrganization() { + return organization; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ProjectsListXpnHostsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ProjectsListXpnHostsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ProjectsListXpnHostsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ProjectsListXpnHostsRequest(); + } + + public static class Builder { + private String organization; + + Builder() {} + + public Builder mergeFrom(ProjectsListXpnHostsRequest other) { + if (other == ProjectsListXpnHostsRequest.getDefaultInstance()) return this; + if (other.getOrganization() != null) { + this.organization = other.organization; + } + return this; + } + + Builder(ProjectsListXpnHostsRequest source) { + this.organization = source.organization; + } + + public String getOrganization() { + return organization; + } + + public Builder setOrganization(String organization) { + this.organization = organization; + return this; + } + + public ProjectsListXpnHostsRequest build() { + return new ProjectsListXpnHostsRequest(organization); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setOrganization(this.organization); + return newBuilder; + } + } + + @Override + public String toString() { + return "ProjectsListXpnHostsRequest{" + "organization=" + organization + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectsListXpnHostsRequest) { + ProjectsListXpnHostsRequest that = (ProjectsListXpnHostsRequest) o; + return Objects.equals(this.organization, that.getOrganization()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(organization); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Quota.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Quota.java new file mode 100644 index 000000000000..0001cdcba466 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Quota.java @@ -0,0 +1,195 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Quota implements ApiMessage { + private final Double limit; + private final String metric; + private final Double usage; + + private Quota() { + this.limit = null; + this.metric = null; + this.usage = null; + } + + private Quota(Double limit, String metric, Double usage) { + this.limit = limit; + this.metric = metric; + this.usage = usage; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("limit")) { + return limit; + } + if (fieldName.equals("metric")) { + return metric; + } + if (fieldName.equals("usage")) { + return usage; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Double getLimit() { + return limit; + } + + public String getMetric() { + return metric; + } + + public Double getUsage() { + return usage; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Quota prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Quota getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Quota DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Quota(); + } + + public static class Builder { + private Double limit; + private String metric; + private Double usage; + + Builder() {} + + public Builder mergeFrom(Quota other) { + if (other == Quota.getDefaultInstance()) return this; + if (other.getLimit() != null) { + this.limit = other.limit; + } + if (other.getMetric() != null) { + this.metric = other.metric; + } + if (other.getUsage() != null) { + this.usage = other.usage; + } + return this; + } + + Builder(Quota source) { + this.limit = source.limit; + this.metric = source.metric; + this.usage = source.usage; + } + + public Double getLimit() { + return limit; + } + + public Builder setLimit(Double limit) { + this.limit = limit; + return this; + } + + public String getMetric() { + return metric; + } + + public Builder setMetric(String metric) { + this.metric = metric; + return this; + } + + public Double getUsage() { + return usage; + } + + public Builder setUsage(Double usage) { + this.usage = usage; + return this; + } + + public Quota build() { + + return new Quota(limit, metric, usage); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setLimit(this.limit); + newBuilder.setMetric(this.metric); + newBuilder.setUsage(this.usage); + return newBuilder; + } + } + + @Override + public String toString() { + return "Quota{" + "limit=" + limit + ", " + "metric=" + metric + ", " + "usage=" + usage + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Quota) { + Quota that = (Quota) o; + return Objects.equals(this.limit, that.getLimit()) + && Objects.equals(this.metric, that.getMetric()) + && Objects.equals(this.usage, that.getUsage()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(limit, metric, usage); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RawDisk.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RawDisk.java new file mode 100644 index 000000000000..e32d17996fb1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RawDisk.java @@ -0,0 +1,204 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RawDisk implements ApiMessage { + private final String containerType; + private final String sha1Checksum; + private final String source; + + private RawDisk() { + this.containerType = null; + this.sha1Checksum = null; + this.source = null; + } + + private RawDisk(String containerType, String sha1Checksum, String source) { + this.containerType = containerType; + this.sha1Checksum = sha1Checksum; + this.source = source; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("containerType")) { + return containerType; + } + if (fieldName.equals("sha1Checksum")) { + return sha1Checksum; + } + if (fieldName.equals("source")) { + return source; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getContainerType() { + return containerType; + } + + public String getSha1Checksum() { + return sha1Checksum; + } + + public String getSource() { + return source; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RawDisk prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RawDisk getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RawDisk DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RawDisk(); + } + + public static class Builder { + private String containerType; + private String sha1Checksum; + private String source; + + Builder() {} + + public Builder mergeFrom(RawDisk other) { + if (other == RawDisk.getDefaultInstance()) return this; + if (other.getContainerType() != null) { + this.containerType = other.containerType; + } + if (other.getSha1Checksum() != null) { + this.sha1Checksum = other.sha1Checksum; + } + if (other.getSource() != null) { + this.source = other.source; + } + return this; + } + + Builder(RawDisk source) { + this.containerType = source.containerType; + this.sha1Checksum = source.sha1Checksum; + this.source = source.source; + } + + public String getContainerType() { + return containerType; + } + + public Builder setContainerType(String containerType) { + this.containerType = containerType; + return this; + } + + public String getSha1Checksum() { + return sha1Checksum; + } + + public Builder setSha1Checksum(String sha1Checksum) { + this.sha1Checksum = sha1Checksum; + return this; + } + + public String getSource() { + return source; + } + + public Builder setSource(String source) { + this.source = source; + return this; + } + + public RawDisk build() { + + return new RawDisk(containerType, sha1Checksum, source); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setContainerType(this.containerType); + newBuilder.setSha1Checksum(this.sha1Checksum); + newBuilder.setSource(this.source); + return newBuilder; + } + } + + @Override + public String toString() { + return "RawDisk{" + + "containerType=" + + containerType + + ", " + + "sha1Checksum=" + + sha1Checksum + + ", " + + "source=" + + source + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RawDisk) { + RawDisk that = (RawDisk) o; + return Objects.equals(this.containerType, that.getContainerType()) + && Objects.equals(this.sha1Checksum, that.getSha1Checksum()) + && Objects.equals(this.source, that.getSource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(containerType, sha1Checksum, source); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RecreateInstancesInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RecreateInstancesInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..938f45cd1449 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RecreateInstancesInstanceGroupManagerHttpRequest.java @@ -0,0 +1,461 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RecreateInstancesInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final InstanceGroupManagersRecreateInstancesRequest + instanceGroupManagersRecreateInstancesRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private RecreateInstancesInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.instanceGroupManagersRecreateInstancesRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private RecreateInstancesInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + InstanceGroupManagersRecreateInstancesRequest + instanceGroupManagersRecreateInstancesRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.instanceGroupManagersRecreateInstancesRequestResource = + instanceGroupManagersRecreateInstancesRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("instanceGroupManagersRecreateInstancesRequestResource")) { + return instanceGroupManagersRecreateInstancesRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceGroupManagersRecreateInstancesRequest getApiMessageRequestBody() { + return instanceGroupManagersRecreateInstancesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public InstanceGroupManagersRecreateInstancesRequest + getInstanceGroupManagersRecreateInstancesRequestResource() { + return instanceGroupManagersRecreateInstancesRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RecreateInstancesInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RecreateInstancesInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RecreateInstancesInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RecreateInstancesInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private InstanceGroupManagersRecreateInstancesRequest + instanceGroupManagersRecreateInstancesRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(RecreateInstancesInstanceGroupManagerHttpRequest other) { + if (other == RecreateInstancesInstanceGroupManagerHttpRequest.getDefaultInstance()) + return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getInstanceGroupManagersRecreateInstancesRequestResource() != null) { + this.instanceGroupManagersRecreateInstancesRequestResource = + other.instanceGroupManagersRecreateInstancesRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(RecreateInstancesInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.instanceGroupManagersRecreateInstancesRequestResource = + source.instanceGroupManagersRecreateInstancesRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public InstanceGroupManagersRecreateInstancesRequest + getInstanceGroupManagersRecreateInstancesRequestResource() { + return instanceGroupManagersRecreateInstancesRequestResource; + } + + public Builder setInstanceGroupManagersRecreateInstancesRequestResource( + InstanceGroupManagersRecreateInstancesRequest + instanceGroupManagersRecreateInstancesRequestResource) { + this.instanceGroupManagersRecreateInstancesRequestResource = + instanceGroupManagersRecreateInstancesRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public RecreateInstancesInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new RecreateInstancesInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + instanceGroupManagersRecreateInstancesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setInstanceGroupManagersRecreateInstancesRequestResource( + this.instanceGroupManagersRecreateInstancesRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "RecreateInstancesInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "instanceGroupManagersRecreateInstancesRequestResource=" + + instanceGroupManagersRecreateInstancesRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RecreateInstancesInstanceGroupManagerHttpRequest) { + RecreateInstancesInstanceGroupManagerHttpRequest that = + (RecreateInstancesInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals( + this.instanceGroupManagersRecreateInstancesRequestResource, + that.getInstanceGroupManagersRecreateInstancesRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + instanceGroupManagersRecreateInstancesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RecreateInstancesRegionInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RecreateInstancesRegionInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..5d8fc03ea2c8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RecreateInstancesRegionInstanceGroupManagerHttpRequest.java @@ -0,0 +1,461 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RecreateInstancesRegionInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final RegionInstanceGroupManagersRecreateRequest + regionInstanceGroupManagersRecreateRequestResource; + private final String requestId; + private final String userIp; + + private RecreateInstancesRegionInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.regionInstanceGroupManagersRecreateRequestResource = null; + this.requestId = null; + this.userIp = null; + } + + private RecreateInstancesRegionInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + String key, + String prettyPrint, + String quotaUser, + RegionInstanceGroupManagersRecreateRequest regionInstanceGroupManagersRecreateRequestResource, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.regionInstanceGroupManagersRecreateRequestResource = + regionInstanceGroupManagersRecreateRequestResource; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("regionInstanceGroupManagersRecreateRequestResource")) { + return regionInstanceGroupManagersRecreateRequestResource; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public RegionInstanceGroupManagersRecreateRequest getApiMessageRequestBody() { + return regionInstanceGroupManagersRecreateRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public RegionInstanceGroupManagersRecreateRequest + getRegionInstanceGroupManagersRecreateRequestResource() { + return regionInstanceGroupManagersRecreateRequestResource; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + RecreateInstancesRegionInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RecreateInstancesRegionInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RecreateInstancesRegionInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RecreateInstancesRegionInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private String key; + private String prettyPrint; + private String quotaUser; + private RegionInstanceGroupManagersRecreateRequest + regionInstanceGroupManagersRecreateRequestResource; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(RecreateInstancesRegionInstanceGroupManagerHttpRequest other) { + if (other == RecreateInstancesRegionInstanceGroupManagerHttpRequest.getDefaultInstance()) + return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegionInstanceGroupManagersRecreateRequestResource() != null) { + this.regionInstanceGroupManagersRecreateRequestResource = + other.regionInstanceGroupManagersRecreateRequestResource; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(RecreateInstancesRegionInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.regionInstanceGroupManagersRecreateRequestResource = + source.regionInstanceGroupManagersRecreateRequestResource; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public RegionInstanceGroupManagersRecreateRequest + getRegionInstanceGroupManagersRecreateRequestResource() { + return regionInstanceGroupManagersRecreateRequestResource; + } + + public Builder setRegionInstanceGroupManagersRecreateRequestResource( + RegionInstanceGroupManagersRecreateRequest + regionInstanceGroupManagersRecreateRequestResource) { + this.regionInstanceGroupManagersRecreateRequestResource = + regionInstanceGroupManagersRecreateRequestResource; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public RecreateInstancesRegionInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new RecreateInstancesRegionInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + regionInstanceGroupManagersRecreateRequestResource, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegionInstanceGroupManagersRecreateRequestResource( + this.regionInstanceGroupManagersRecreateRequestResource); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "RecreateInstancesRegionInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "regionInstanceGroupManagersRecreateRequestResource=" + + regionInstanceGroupManagersRecreateRequestResource + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RecreateInstancesRegionInstanceGroupManagerHttpRequest) { + RecreateInstancesRegionInstanceGroupManagerHttpRequest that = + (RecreateInstancesRegionInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals( + this.regionInstanceGroupManagersRecreateRequestResource, + that.getRegionInstanceGroupManagersRecreateRequestResource()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + regionInstanceGroupManagersRecreateRequestResource, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Reference.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Reference.java new file mode 100644 index 000000000000..3628a6bda60c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Reference.java @@ -0,0 +1,233 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Reference implements ApiMessage { + private final String kind; + private final String referenceType; + private final String referrer; + private final String target; + + private Reference() { + this.kind = null; + this.referenceType = null; + this.referrer = null; + this.target = null; + } + + private Reference(String kind, String referenceType, String referrer, String target) { + this.kind = kind; + this.referenceType = referenceType; + this.referrer = referrer; + this.target = target; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("referenceType")) { + return referenceType; + } + if (fieldName.equals("referrer")) { + return referrer; + } + if (fieldName.equals("target")) { + return target; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getKind() { + return kind; + } + + public String getReferenceType() { + return referenceType; + } + + public String getReferrer() { + return referrer; + } + + public String getTarget() { + return target; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Reference prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Reference getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Reference DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Reference(); + } + + public static class Builder { + private String kind; + private String referenceType; + private String referrer; + private String target; + + Builder() {} + + public Builder mergeFrom(Reference other) { + if (other == Reference.getDefaultInstance()) return this; + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getReferenceType() != null) { + this.referenceType = other.referenceType; + } + if (other.getReferrer() != null) { + this.referrer = other.referrer; + } + if (other.getTarget() != null) { + this.target = other.target; + } + return this; + } + + Builder(Reference source) { + this.kind = source.kind; + this.referenceType = source.referenceType; + this.referrer = source.referrer; + this.target = source.target; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getReferenceType() { + return referenceType; + } + + public Builder setReferenceType(String referenceType) { + this.referenceType = referenceType; + return this; + } + + public String getReferrer() { + return referrer; + } + + public Builder setReferrer(String referrer) { + this.referrer = referrer; + return this; + } + + public String getTarget() { + return target; + } + + public Builder setTarget(String target) { + this.target = target; + return this; + } + + public Reference build() { + + return new Reference(kind, referenceType, referrer, target); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setKind(this.kind); + newBuilder.setReferenceType(this.referenceType); + newBuilder.setReferrer(this.referrer); + newBuilder.setTarget(this.target); + return newBuilder; + } + } + + @Override + public String toString() { + return "Reference{" + + "kind=" + + kind + + ", " + + "referenceType=" + + referenceType + + ", " + + "referrer=" + + referrer + + ", " + + "target=" + + target + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Reference) { + Reference that = (Reference) o; + return Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.referenceType, that.getReferenceType()) + && Objects.equals(this.referrer, that.getReferrer()) + && Objects.equals(this.target, that.getTarget()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(kind, referenceType, referrer, target); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Region.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Region.java new file mode 100644 index 000000000000..0d3c8cba1ae1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Region.java @@ -0,0 +1,454 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Region implements ApiMessage { + private final String creationTimestamp; + private final DeprecationStatus deprecated; + private final String description; + private final String id; + private final String kind; + private final String name; + private final List quotas; + private final String selfLink; + private final String status; + private final List zones; + + private Region() { + this.creationTimestamp = null; + this.deprecated = null; + this.description = null; + this.id = null; + this.kind = null; + this.name = null; + this.quotas = null; + this.selfLink = null; + this.status = null; + this.zones = null; + } + + private Region( + String creationTimestamp, + DeprecationStatus deprecated, + String description, + String id, + String kind, + String name, + List quotas, + String selfLink, + String status, + List zones) { + this.creationTimestamp = creationTimestamp; + this.deprecated = deprecated; + this.description = description; + this.id = id; + this.kind = kind; + this.name = name; + this.quotas = quotas; + this.selfLink = selfLink; + this.status = status; + this.zones = zones; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("deprecated")) { + return deprecated; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("quotas")) { + return quotas; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("status")) { + return status; + } + if (fieldName.equals("zones")) { + return zones; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public List getQuotasList() { + return quotas; + } + + public String getSelfLink() { + return selfLink; + } + + public String getStatus() { + return status; + } + + public List getZonesList() { + return zones; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Region prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Region getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Region DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Region(); + } + + public static class Builder { + private String creationTimestamp; + private DeprecationStatus deprecated; + private String description; + private String id; + private String kind; + private String name; + private List quotas; + private String selfLink; + private String status; + private List zones; + + Builder() {} + + public Builder mergeFrom(Region other) { + if (other == Region.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDeprecated() != null) { + this.deprecated = other.deprecated; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getQuotasList() != null) { + this.quotas = other.quotas; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getStatus() != null) { + this.status = other.status; + } + if (other.getZonesList() != null) { + this.zones = other.zones; + } + return this; + } + + Builder(Region source) { + this.creationTimestamp = source.creationTimestamp; + this.deprecated = source.deprecated; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.quotas = source.quotas; + this.selfLink = source.selfLink; + this.status = source.status; + this.zones = source.zones; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public Builder setDeprecated(DeprecationStatus deprecated) { + this.deprecated = deprecated; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public List getQuotasList() { + return quotas; + } + + public Builder addAllQuotas(List quotas) { + if (this.quotas == null) { + this.quotas = new ArrayList<>(quotas.size()); + } + this.quotas.addAll(quotas); + return this; + } + + public Builder addQuotas(Quota quotas) { + this.quotas.add(quotas); + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public List getZonesList() { + return zones; + } + + public Builder addAllZones(List zones) { + if (this.zones == null) { + this.zones = new ArrayList<>(zones.size()); + } + this.zones.addAll(zones); + return this; + } + + public Builder addZones(String zones) { + this.zones.add(zones); + return this; + } + + public Region build() { + + return new Region( + creationTimestamp, + deprecated, + description, + id, + kind, + name, + quotas, + selfLink, + status, + zones); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDeprecated(this.deprecated); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.addAllQuotas(this.quotas); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setStatus(this.status); + newBuilder.addAllZones(this.zones); + return newBuilder; + } + } + + @Override + public String toString() { + return "Region{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "deprecated=" + + deprecated + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "quotas=" + + quotas + + ", " + + "selfLink=" + + selfLink + + ", " + + "status=" + + status + + ", " + + "zones=" + + zones + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Region) { + Region that = (Region) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.deprecated, that.getDeprecated()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.quotas, that.getQuotasList()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.status, that.getStatus()) + && Objects.equals(this.zones, that.getZonesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + deprecated, + description, + id, + kind, + name, + quotas, + selfLink, + status, + zones); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionAutoscalerClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionAutoscalerClient.java new file mode 100644 index 000000000000..bd85152c9d4f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionAutoscalerClient.java @@ -0,0 +1,978 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.RegionAutoscalerStub; +import com.google.cloud.compute.v1.stub.RegionAutoscalerStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+ *   ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
+ *   Operation response = regionAutoscalerClient.deleteRegionAutoscaler(autoscaler);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the regionAutoscalerClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of RegionAutoscalerSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * RegionAutoscalerSettings regionAutoscalerSettings =
+ *     RegionAutoscalerSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * RegionAutoscalerClient regionAutoscalerClient =
+ *     RegionAutoscalerClient.create(regionAutoscalerSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * RegionAutoscalerSettings regionAutoscalerSettings =
+ *     RegionAutoscalerSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RegionAutoscalerClient regionAutoscalerClient =
+ *     RegionAutoscalerClient.create(regionAutoscalerSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionAutoscalerClient implements BackgroundResource { + private final RegionAutoscalerSettings settings; + private final RegionAutoscalerStub stub; + + /** Constructs an instance of RegionAutoscalerClient with default settings. */ + public static final RegionAutoscalerClient create() throws IOException { + return create(RegionAutoscalerSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RegionAutoscalerClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final RegionAutoscalerClient create(RegionAutoscalerSettings settings) + throws IOException { + return new RegionAutoscalerClient(settings); + } + + /** + * Constructs an instance of RegionAutoscalerClient, using the given stub for making calls. This + * is for advanced usage - prefer to use RegionAutoscalerSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final RegionAutoscalerClient create(RegionAutoscalerStub stub) { + return new RegionAutoscalerClient(stub); + } + + /** + * Constructs an instance of RegionAutoscalerClient, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected RegionAutoscalerClient(RegionAutoscalerSettings settings) throws IOException { + this.settings = settings; + this.stub = ((RegionAutoscalerStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected RegionAutoscalerClient(RegionAutoscalerStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RegionAutoscalerSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionAutoscalerStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified autoscaler. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
+   *   Operation response = regionAutoscalerClient.deleteRegionAutoscaler(autoscaler);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionAutoscaler(ProjectRegionAutoscalerName autoscaler) { + + DeleteRegionAutoscalerHttpRequest request = + DeleteRegionAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler == null ? null : autoscaler.toString()) + .build(); + return deleteRegionAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified autoscaler. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
+   *   Operation response = regionAutoscalerClient.deleteRegionAutoscaler(autoscaler.toString());
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionAutoscaler(String autoscaler) { + + DeleteRegionAutoscalerHttpRequest request = + DeleteRegionAutoscalerHttpRequest.newBuilder().setAutoscaler(autoscaler).build(); + return deleteRegionAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified autoscaler. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
+   *   DeleteRegionAutoscalerHttpRequest request = DeleteRegionAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler.toString())
+   *     .build();
+   *   Operation response = regionAutoscalerClient.deleteRegionAutoscaler(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionAutoscaler(DeleteRegionAutoscalerHttpRequest request) { + return deleteRegionAutoscalerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified autoscaler. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
+   *   DeleteRegionAutoscalerHttpRequest request = DeleteRegionAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = regionAutoscalerClient.deleteRegionAutoscalerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteRegionAutoscalerCallable() { + return stub.deleteRegionAutoscalerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified autoscaler. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
+   *   Autoscaler response = regionAutoscalerClient.getRegionAutoscaler(autoscaler);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Autoscaler getRegionAutoscaler(ProjectRegionAutoscalerName autoscaler) { + + GetRegionAutoscalerHttpRequest request = + GetRegionAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler == null ? null : autoscaler.toString()) + .build(); + return getRegionAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified autoscaler. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
+   *   Autoscaler response = regionAutoscalerClient.getRegionAutoscaler(autoscaler.toString());
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Autoscaler getRegionAutoscaler(String autoscaler) { + + GetRegionAutoscalerHttpRequest request = + GetRegionAutoscalerHttpRequest.newBuilder().setAutoscaler(autoscaler).build(); + return getRegionAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified autoscaler. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
+   *   GetRegionAutoscalerHttpRequest request = GetRegionAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler.toString())
+   *     .build();
+   *   Autoscaler response = regionAutoscalerClient.getRegionAutoscaler(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Autoscaler getRegionAutoscaler(GetRegionAutoscalerHttpRequest request) { + return getRegionAutoscalerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified autoscaler. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
+   *   GetRegionAutoscalerHttpRequest request = GetRegionAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler.toString())
+   *     .build();
+   *   ApiFuture<Autoscaler> future = regionAutoscalerClient.getRegionAutoscalerCallable().futureCall(request);
+   *   // Do something
+   *   Autoscaler response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getRegionAutoscalerCallable() { + return stub.getRegionAutoscalerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = regionAutoscalerClient.insertRegionAutoscaler(region, autoscalerResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionAutoscaler( + ProjectRegionName region, Autoscaler autoscalerResource) { + + InsertRegionAutoscalerHttpRequest request = + InsertRegionAutoscalerHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setAutoscalerResource(autoscalerResource) + .build(); + return insertRegionAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = regionAutoscalerClient.insertRegionAutoscaler(region.toString(), autoscalerResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionAutoscaler(String region, Autoscaler autoscalerResource) { + + InsertRegionAutoscalerHttpRequest request = + InsertRegionAutoscalerHttpRequest.newBuilder() + .setRegion(region) + .setAutoscalerResource(autoscalerResource) + .build(); + return insertRegionAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   InsertRegionAutoscalerHttpRequest request = InsertRegionAutoscalerHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   Operation response = regionAutoscalerClient.insertRegionAutoscaler(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionAutoscaler(InsertRegionAutoscalerHttpRequest request) { + return insertRegionAutoscalerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   InsertRegionAutoscalerHttpRequest request = InsertRegionAutoscalerHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionAutoscalerClient.insertRegionAutoscalerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertRegionAutoscalerCallable() { + return stub.insertRegionAutoscalerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of autoscalers contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Autoscaler element : regionAutoscalerClient.listRegionAutoscalers(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionAutoscalersPagedResponse listRegionAutoscalers(ProjectRegionName region) { + ListRegionAutoscalersHttpRequest request = + ListRegionAutoscalersHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listRegionAutoscalers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of autoscalers contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Autoscaler element : regionAutoscalerClient.listRegionAutoscalers(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionAutoscalersPagedResponse listRegionAutoscalers(String region) { + ListRegionAutoscalersHttpRequest request = + ListRegionAutoscalersHttpRequest.newBuilder().setRegion(region).build(); + return listRegionAutoscalers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of autoscalers contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionAutoscalersHttpRequest request = ListRegionAutoscalersHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (Autoscaler element : regionAutoscalerClient.listRegionAutoscalers(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionAutoscalersPagedResponse listRegionAutoscalers( + ListRegionAutoscalersHttpRequest request) { + return listRegionAutoscalersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of autoscalers contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionAutoscalersHttpRequest request = ListRegionAutoscalersHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListRegionAutoscalersPagedResponse> future = regionAutoscalerClient.listRegionAutoscalersPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Autoscaler element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionAutoscalersPagedCallable() { + return stub.listRegionAutoscalersPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of autoscalers contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionAutoscalersHttpRequest request = ListRegionAutoscalersHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     RegionAutoscalerList response = regionAutoscalerClient.listRegionAutoscalersCallable().call(request);
+   *     for (Autoscaler element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionAutoscalersCallable() { + return stub.listRegionAutoscalersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. This + * method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = regionAutoscalerClient.patchRegionAutoscaler(autoscaler, region, autoscalerResource);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to patch. + * @param region Name of the region scoping this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchRegionAutoscaler( + String autoscaler, ProjectRegionName region, Autoscaler autoscalerResource) { + + PatchRegionAutoscalerHttpRequest request = + PatchRegionAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler) + .setRegion(region == null ? null : region.toString()) + .setAutoscalerResource(autoscalerResource) + .build(); + return patchRegionAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. This + * method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = regionAutoscalerClient.patchRegionAutoscaler(autoscaler, region.toString(), autoscalerResource);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to patch. + * @param region Name of the region scoping this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchRegionAutoscaler( + String autoscaler, String region, Autoscaler autoscalerResource) { + + PatchRegionAutoscalerHttpRequest request = + PatchRegionAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler) + .setRegion(region) + .setAutoscalerResource(autoscalerResource) + .build(); + return patchRegionAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. This + * method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   PatchRegionAutoscalerHttpRequest request = PatchRegionAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler)
+   *     .setRegion(region.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   Operation response = regionAutoscalerClient.patchRegionAutoscaler(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchRegionAutoscaler(PatchRegionAutoscalerHttpRequest request) { + return patchRegionAutoscalerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. This + * method supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   PatchRegionAutoscalerHttpRequest request = PatchRegionAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler)
+   *     .setRegion(region.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionAutoscalerClient.patchRegionAutoscalerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + patchRegionAutoscalerCallable() { + return stub.patchRegionAutoscalerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = regionAutoscalerClient.updateRegionAutoscaler(autoscaler, region, autoscalerResource);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to update. + * @param region Name of the region scoping this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateRegionAutoscaler( + String autoscaler, ProjectRegionName region, Autoscaler autoscalerResource) { + + UpdateRegionAutoscalerHttpRequest request = + UpdateRegionAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler) + .setRegion(region == null ? null : region.toString()) + .setAutoscalerResource(autoscalerResource) + .build(); + return updateRegionAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   Operation response = regionAutoscalerClient.updateRegionAutoscaler(autoscaler, region.toString(), autoscalerResource);
+   * }
+   * 
+ * + * @param autoscaler Name of the autoscaler to update. + * @param region Name of the region scoping this request. + * @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to + * automatically scale virtual machine instances in managed instance groups according to an + * autoscaling policy that you define. For more information, read Autoscaling Groups of + * Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== + * resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateRegionAutoscaler( + String autoscaler, String region, Autoscaler autoscalerResource) { + + UpdateRegionAutoscalerHttpRequest request = + UpdateRegionAutoscalerHttpRequest.newBuilder() + .setAutoscaler(autoscaler) + .setRegion(region) + .setAutoscalerResource(autoscalerResource) + .build(); + return updateRegionAutoscaler(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   UpdateRegionAutoscalerHttpRequest request = UpdateRegionAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler)
+   *     .setRegion(region.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   Operation response = regionAutoscalerClient.updateRegionAutoscaler(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateRegionAutoscaler(UpdateRegionAutoscalerHttpRequest request) { + return updateRegionAutoscalerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an autoscaler in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+   *   String autoscaler = "";
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
+   *   UpdateRegionAutoscalerHttpRequest request = UpdateRegionAutoscalerHttpRequest.newBuilder()
+   *     .setAutoscaler(autoscaler)
+   *     .setRegion(region.toString())
+   *     .setAutoscalerResource(autoscalerResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionAutoscalerClient.updateRegionAutoscalerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + updateRegionAutoscalerCallable() { + return stub.updateRegionAutoscalerCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListRegionAutoscalersPagedResponse + extends AbstractPagedListResponse< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, Autoscaler, + ListRegionAutoscalersPage, ListRegionAutoscalersFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRegionAutoscalersPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListRegionAutoscalersPagedResponse apply(ListRegionAutoscalersPage input) { + return new ListRegionAutoscalersPagedResponse(input); + } + }); + } + + private ListRegionAutoscalersPagedResponse(ListRegionAutoscalersPage page) { + super(page, ListRegionAutoscalersFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRegionAutoscalersPage + extends AbstractPage< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, Autoscaler, + ListRegionAutoscalersPage> { + + private ListRegionAutoscalersPage( + PageContext context, + RegionAutoscalerList response) { + super(context, response); + } + + private static ListRegionAutoscalersPage createEmptyPage() { + return new ListRegionAutoscalersPage(null, null); + } + + @Override + protected ListRegionAutoscalersPage createPage( + PageContext context, + RegionAutoscalerList response) { + return new ListRegionAutoscalersPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRegionAutoscalersFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, Autoscaler, + ListRegionAutoscalersPage, ListRegionAutoscalersFixedSizeCollection> { + + private ListRegionAutoscalersFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRegionAutoscalersFixedSizeCollection createEmptyCollection() { + return new ListRegionAutoscalersFixedSizeCollection(null, 0); + } + + @Override + protected ListRegionAutoscalersFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRegionAutoscalersFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionAutoscalerList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionAutoscalerList.java new file mode 100644 index 000000000000..09562b3cbb11 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionAutoscalerList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionAutoscalerList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private RegionAutoscalerList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private RegionAutoscalerList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionAutoscalerList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionAutoscalerList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionAutoscalerList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionAutoscalerList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(RegionAutoscalerList other) { + if (other == RegionAutoscalerList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(RegionAutoscalerList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Autoscaler items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public RegionAutoscalerList build() { + + return new RegionAutoscalerList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionAutoscalerList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionAutoscalerList) { + RegionAutoscalerList that = (RegionAutoscalerList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionAutoscalerSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionAutoscalerSettings.java new file mode 100644 index 000000000000..3963b95b92aa --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionAutoscalerSettings.java @@ -0,0 +1,249 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionAutoscalerClient.ListRegionAutoscalersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.RegionAutoscalerStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionAutoscalerClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteRegionAutoscaler to 30 seconds: + * + *

+ * 
+ * RegionAutoscalerSettings.Builder regionAutoscalerSettingsBuilder =
+ *     RegionAutoscalerSettings.newBuilder();
+ * regionAutoscalerSettingsBuilder.deleteRegionAutoscalerSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionAutoscalerSettings regionAutoscalerSettings = regionAutoscalerSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionAutoscalerSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteRegionAutoscaler. */ + public UnaryCallSettings + deleteRegionAutoscalerSettings() { + return ((RegionAutoscalerStubSettings) getStubSettings()).deleteRegionAutoscalerSettings(); + } + + /** Returns the object with the settings used for calls to getRegionAutoscaler. */ + public UnaryCallSettings + getRegionAutoscalerSettings() { + return ((RegionAutoscalerStubSettings) getStubSettings()).getRegionAutoscalerSettings(); + } + + /** Returns the object with the settings used for calls to insertRegionAutoscaler. */ + public UnaryCallSettings + insertRegionAutoscalerSettings() { + return ((RegionAutoscalerStubSettings) getStubSettings()).insertRegionAutoscalerSettings(); + } + + /** Returns the object with the settings used for calls to listRegionAutoscalers. */ + public PagedCallSettings< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, + ListRegionAutoscalersPagedResponse> + listRegionAutoscalersSettings() { + return ((RegionAutoscalerStubSettings) getStubSettings()).listRegionAutoscalersSettings(); + } + + /** Returns the object with the settings used for calls to patchRegionAutoscaler. */ + public UnaryCallSettings + patchRegionAutoscalerSettings() { + return ((RegionAutoscalerStubSettings) getStubSettings()).patchRegionAutoscalerSettings(); + } + + /** Returns the object with the settings used for calls to updateRegionAutoscaler. */ + public UnaryCallSettings + updateRegionAutoscalerSettings() { + return ((RegionAutoscalerStubSettings) getStubSettings()).updateRegionAutoscalerSettings(); + } + + public static final RegionAutoscalerSettings create(RegionAutoscalerStubSettings stub) + throws IOException { + return new RegionAutoscalerSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return RegionAutoscalerStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return RegionAutoscalerStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return RegionAutoscalerStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return RegionAutoscalerStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return RegionAutoscalerStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return RegionAutoscalerStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return RegionAutoscalerStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return RegionAutoscalerStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionAutoscalerSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for RegionAutoscalerSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(RegionAutoscalerStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(RegionAutoscalerStubSettings.newBuilder()); + } + + protected Builder(RegionAutoscalerSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(RegionAutoscalerStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public RegionAutoscalerStubSettings.Builder getStubSettingsBuilder() { + return ((RegionAutoscalerStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteRegionAutoscaler. */ + public UnaryCallSettings.Builder + deleteRegionAutoscalerSettings() { + return getStubSettingsBuilder().deleteRegionAutoscalerSettings(); + } + + /** Returns the builder for the settings used for calls to getRegionAutoscaler. */ + public UnaryCallSettings.Builder + getRegionAutoscalerSettings() { + return getStubSettingsBuilder().getRegionAutoscalerSettings(); + } + + /** Returns the builder for the settings used for calls to insertRegionAutoscaler. */ + public UnaryCallSettings.Builder + insertRegionAutoscalerSettings() { + return getStubSettingsBuilder().insertRegionAutoscalerSettings(); + } + + /** Returns the builder for the settings used for calls to listRegionAutoscalers. */ + public PagedCallSettings.Builder< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, + ListRegionAutoscalersPagedResponse> + listRegionAutoscalersSettings() { + return getStubSettingsBuilder().listRegionAutoscalersSettings(); + } + + /** Returns the builder for the settings used for calls to patchRegionAutoscaler. */ + public UnaryCallSettings.Builder + patchRegionAutoscalerSettings() { + return getStubSettingsBuilder().patchRegionAutoscalerSettings(); + } + + /** Returns the builder for the settings used for calls to updateRegionAutoscaler. */ + public UnaryCallSettings.Builder + updateRegionAutoscalerSettings() { + return getStubSettingsBuilder().updateRegionAutoscalerSettings(); + } + + @Override + public RegionAutoscalerSettings build() throws IOException { + return new RegionAutoscalerSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionBackendServiceClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionBackendServiceClient.java new file mode 100644 index 000000000000..ab17b311941f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionBackendServiceClient.java @@ -0,0 +1,1101 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.RegionBackendServiceStub; +import com.google.cloud.compute.v1.stub.RegionBackendServiceStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+ *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+ *   Operation response = regionBackendServiceClient.deleteRegionBackendService(backendService);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the regionBackendServiceClient object to clean up + * resources such as threads. In the example above, try-with-resources is used, which automatically + * calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of RegionBackendServiceSettings + * to create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * RegionBackendServiceSettings regionBackendServiceSettings =
+ *     RegionBackendServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * RegionBackendServiceClient regionBackendServiceClient =
+ *     RegionBackendServiceClient.create(regionBackendServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * RegionBackendServiceSettings regionBackendServiceSettings =
+ *     RegionBackendServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RegionBackendServiceClient regionBackendServiceClient =
+ *     RegionBackendServiceClient.create(regionBackendServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionBackendServiceClient implements BackgroundResource { + private final RegionBackendServiceSettings settings; + private final RegionBackendServiceStub stub; + + /** Constructs an instance of RegionBackendServiceClient with default settings. */ + public static final RegionBackendServiceClient create() throws IOException { + return create(RegionBackendServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RegionBackendServiceClient, using the given settings. The channels + * are created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final RegionBackendServiceClient create(RegionBackendServiceSettings settings) + throws IOException { + return new RegionBackendServiceClient(settings); + } + + /** + * Constructs an instance of RegionBackendServiceClient, using the given stub for making calls. + * This is for advanced usage - prefer to use RegionBackendServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final RegionBackendServiceClient create(RegionBackendServiceStub stub) { + return new RegionBackendServiceClient(stub); + } + + /** + * Constructs an instance of RegionBackendServiceClient, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected RegionBackendServiceClient(RegionBackendServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((RegionBackendServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected RegionBackendServiceClient(RegionBackendServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RegionBackendServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionBackendServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified regional BackendService resource. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   Operation response = regionBackendServiceClient.deleteRegionBackendService(backendService);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionBackendService( + ProjectRegionBackendServiceName backendService) { + + DeleteRegionBackendServiceHttpRequest request = + DeleteRegionBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService == null ? null : backendService.toString()) + .build(); + return deleteRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified regional BackendService resource. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   Operation response = regionBackendServiceClient.deleteRegionBackendService(backendService.toString());
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionBackendService(String backendService) { + + DeleteRegionBackendServiceHttpRequest request = + DeleteRegionBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService) + .build(); + return deleteRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified regional BackendService resource. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   DeleteRegionBackendServiceHttpRequest request = DeleteRegionBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .build();
+   *   Operation response = regionBackendServiceClient.deleteRegionBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionBackendService(DeleteRegionBackendServiceHttpRequest request) { + return deleteRegionBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified regional BackendService resource. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   DeleteRegionBackendServiceHttpRequest request = DeleteRegionBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = regionBackendServiceClient.deleteRegionBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteRegionBackendServiceCallable() { + return stub.deleteRegionBackendServiceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified regional BackendService resource. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   BackendService response = regionBackendServiceClient.getRegionBackendService(backendService);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendService getRegionBackendService( + ProjectRegionBackendServiceName backendService) { + + GetRegionBackendServiceHttpRequest request = + GetRegionBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService == null ? null : backendService.toString()) + .build(); + return getRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified regional BackendService resource. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   BackendService response = regionBackendServiceClient.getRegionBackendService(backendService.toString());
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendService getRegionBackendService(String backendService) { + + GetRegionBackendServiceHttpRequest request = + GetRegionBackendServiceHttpRequest.newBuilder().setBackendService(backendService).build(); + return getRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified regional BackendService resource. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   GetRegionBackendServiceHttpRequest request = GetRegionBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .build();
+   *   BackendService response = regionBackendServiceClient.getRegionBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendService getRegionBackendService(GetRegionBackendServiceHttpRequest request) { + return getRegionBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified regional BackendService resource. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   GetRegionBackendServiceHttpRequest request = GetRegionBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .build();
+   *   ApiFuture<BackendService> future = regionBackendServiceClient.getRegionBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   BackendService response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getRegionBackendServiceCallable() { + return stub.getRegionBackendServiceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for this regional BackendService. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
+   *   BackendServiceGroupHealth response = regionBackendServiceClient.getHealthRegionBackendService(backendService, resourceGroupReferenceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource for which to get health. + * @param resourceGroupReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendServiceGroupHealth getHealthRegionBackendService( + ProjectRegionBackendServiceName backendService, + ResourceGroupReference resourceGroupReferenceResource) { + + GetHealthRegionBackendServiceHttpRequest request = + GetHealthRegionBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService == null ? null : backendService.toString()) + .setResourceGroupReferenceResource(resourceGroupReferenceResource) + .build(); + return getHealthRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for this regional BackendService. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
+   *   BackendServiceGroupHealth response = regionBackendServiceClient.getHealthRegionBackendService(backendService.toString(), resourceGroupReferenceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource for which to get health. + * @param resourceGroupReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendServiceGroupHealth getHealthRegionBackendService( + String backendService, ResourceGroupReference resourceGroupReferenceResource) { + + GetHealthRegionBackendServiceHttpRequest request = + GetHealthRegionBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService) + .setResourceGroupReferenceResource(resourceGroupReferenceResource) + .build(); + return getHealthRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for this regional BackendService. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
+   *   GetHealthRegionBackendServiceHttpRequest request = GetHealthRegionBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setResourceGroupReferenceResource(resourceGroupReferenceResource)
+   *     .build();
+   *   BackendServiceGroupHealth response = regionBackendServiceClient.getHealthRegionBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final BackendServiceGroupHealth getHealthRegionBackendService( + GetHealthRegionBackendServiceHttpRequest request) { + return getHealthRegionBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for this regional BackendService. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
+   *   GetHealthRegionBackendServiceHttpRequest request = GetHealthRegionBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setResourceGroupReferenceResource(resourceGroupReferenceResource)
+   *     .build();
+   *   ApiFuture<BackendServiceGroupHealth> future = regionBackendServiceClient.getHealthRegionBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   BackendServiceGroupHealth response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getHealthRegionBackendServiceCallable() { + return stub.getHealthRegionBackendServiceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a regional BackendService resource in the specified project using the data included in + * the request. There are several restrictions and guidelines to keep in mind when creating a + * regional backend service. Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = regionBackendServiceClient.insertRegionBackendService(region, backendServiceResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionBackendService( + ProjectRegionName region, BackendService backendServiceResource) { + + InsertRegionBackendServiceHttpRequest request = + InsertRegionBackendServiceHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setBackendServiceResource(backendServiceResource) + .build(); + return insertRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a regional BackendService resource in the specified project using the data included in + * the request. There are several restrictions and guidelines to keep in mind when creating a + * regional backend service. Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = regionBackendServiceClient.insertRegionBackendService(region.toString(), backendServiceResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionBackendService( + String region, BackendService backendServiceResource) { + + InsertRegionBackendServiceHttpRequest request = + InsertRegionBackendServiceHttpRequest.newBuilder() + .setRegion(region) + .setBackendServiceResource(backendServiceResource) + .build(); + return insertRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a regional BackendService resource in the specified project using the data included in + * the request. There are several restrictions and guidelines to keep in mind when creating a + * regional backend service. Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   InsertRegionBackendServiceHttpRequest request = InsertRegionBackendServiceHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   Operation response = regionBackendServiceClient.insertRegionBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionBackendService(InsertRegionBackendServiceHttpRequest request) { + return insertRegionBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a regional BackendService resource in the specified project using the data included in + * the request. There are several restrictions and guidelines to keep in mind when creating a + * regional backend service. Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   InsertRegionBackendServiceHttpRequest request = InsertRegionBackendServiceHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionBackendServiceClient.insertRegionBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertRegionBackendServiceCallable() { + return stub.insertRegionBackendServiceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of regional BackendService resources available to the specified project in + * the given region. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (BackendService element : regionBackendServiceClient.listRegionBackendServices(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionBackendServicesPagedResponse listRegionBackendServices( + ProjectRegionName region) { + ListRegionBackendServicesHttpRequest request = + ListRegionBackendServicesHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listRegionBackendServices(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of regional BackendService resources available to the specified project in + * the given region. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (BackendService element : regionBackendServiceClient.listRegionBackendServices(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionBackendServicesPagedResponse listRegionBackendServices(String region) { + ListRegionBackendServicesHttpRequest request = + ListRegionBackendServicesHttpRequest.newBuilder().setRegion(region).build(); + return listRegionBackendServices(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of regional BackendService resources available to the specified project in + * the given region. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionBackendServicesHttpRequest request = ListRegionBackendServicesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (BackendService element : regionBackendServiceClient.listRegionBackendServices(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionBackendServicesPagedResponse listRegionBackendServices( + ListRegionBackendServicesHttpRequest request) { + return listRegionBackendServicesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of regional BackendService resources available to the specified project in + * the given region. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionBackendServicesHttpRequest request = ListRegionBackendServicesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListRegionBackendServicesPagedResponse> future = regionBackendServiceClient.listRegionBackendServicesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (BackendService element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListRegionBackendServicesHttpRequest, ListRegionBackendServicesPagedResponse> + listRegionBackendServicesPagedCallable() { + return stub.listRegionBackendServicesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of regional BackendService resources available to the specified project in + * the given region. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionBackendServicesHttpRequest request = ListRegionBackendServicesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     BackendServiceList response = regionBackendServiceClient.listRegionBackendServicesCallable().call(request);
+   *     for (BackendService element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionBackendServicesCallable() { + return stub.listRegionBackendServicesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified regional BackendService resource with the data included in the request. + * There are several restrictions and guidelines to keep in mind when updating a backend service. + * Read Restrictions and Guidelines for more information. This method supports PATCH semantics and + * uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = regionBackendServiceClient.patchRegionBackendService(backendService, backendServiceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to patch. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchRegionBackendService( + ProjectRegionBackendServiceName backendService, BackendService backendServiceResource) { + + PatchRegionBackendServiceHttpRequest request = + PatchRegionBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService == null ? null : backendService.toString()) + .setBackendServiceResource(backendServiceResource) + .build(); + return patchRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified regional BackendService resource with the data included in the request. + * There are several restrictions and guidelines to keep in mind when updating a backend service. + * Read Restrictions and Guidelines for more information. This method supports PATCH semantics and + * uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = regionBackendServiceClient.patchRegionBackendService(backendService.toString(), backendServiceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to patch. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchRegionBackendService( + String backendService, BackendService backendServiceResource) { + + PatchRegionBackendServiceHttpRequest request = + PatchRegionBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService) + .setBackendServiceResource(backendServiceResource) + .build(); + return patchRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified regional BackendService resource with the data included in the request. + * There are several restrictions and guidelines to keep in mind when updating a backend service. + * Read Restrictions and Guidelines for more information. This method supports PATCH semantics and + * uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   PatchRegionBackendServiceHttpRequest request = PatchRegionBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   Operation response = regionBackendServiceClient.patchRegionBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchRegionBackendService(PatchRegionBackendServiceHttpRequest request) { + return patchRegionBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified regional BackendService resource with the data included in the request. + * There are several restrictions and guidelines to keep in mind when updating a backend service. + * Read Restrictions and Guidelines for more information. This method supports PATCH semantics and + * uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   PatchRegionBackendServiceHttpRequest request = PatchRegionBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionBackendServiceClient.patchRegionBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + patchRegionBackendServiceCallable() { + return stub.patchRegionBackendServiceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified regional BackendService resource with the data included in the request. + * There are several restrictions and guidelines to keep in mind when updating a backend service. + * Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = regionBackendServiceClient.updateRegionBackendService(backendService, backendServiceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to update. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateRegionBackendService( + ProjectRegionBackendServiceName backendService, BackendService backendServiceResource) { + + UpdateRegionBackendServiceHttpRequest request = + UpdateRegionBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService == null ? null : backendService.toString()) + .setBackendServiceResource(backendServiceResource) + .build(); + return updateRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified regional BackendService resource with the data included in the request. + * There are several restrictions and guidelines to keep in mind when updating a backend service. + * Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   Operation response = regionBackendServiceClient.updateRegionBackendService(backendService.toString(), backendServiceResource);
+   * }
+   * 
+ * + * @param backendService Name of the BackendService resource to update. + * @param backendServiceResource A BackendService resource. This resource defines a group of + * backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) + * (== resource_for beta.backendService ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateRegionBackendService( + String backendService, BackendService backendServiceResource) { + + UpdateRegionBackendServiceHttpRequest request = + UpdateRegionBackendServiceHttpRequest.newBuilder() + .setBackendService(backendService) + .setBackendServiceResource(backendServiceResource) + .build(); + return updateRegionBackendService(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified regional BackendService resource with the data included in the request. + * There are several restrictions and guidelines to keep in mind when updating a backend service. + * Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   UpdateRegionBackendServiceHttpRequest request = UpdateRegionBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   Operation response = regionBackendServiceClient.updateRegionBackendService(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateRegionBackendService(UpdateRegionBackendServiceHttpRequest request) { + return updateRegionBackendServiceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified regional BackendService resource with the data included in the request. + * There are several restrictions and guidelines to keep in mind when updating a backend service. + * Read Restrictions and Guidelines for more information. + * + *

Sample code: + * + *


+   * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+   *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+   *   BackendService backendServiceResource = BackendService.newBuilder().build();
+   *   UpdateRegionBackendServiceHttpRequest request = UpdateRegionBackendServiceHttpRequest.newBuilder()
+   *     .setBackendService(backendService.toString())
+   *     .setBackendServiceResource(backendServiceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionBackendServiceClient.updateRegionBackendServiceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + updateRegionBackendServiceCallable() { + return stub.updateRegionBackendServiceCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListRegionBackendServicesPagedResponse + extends AbstractPagedListResponse< + ListRegionBackendServicesHttpRequest, BackendServiceList, BackendService, + ListRegionBackendServicesPage, ListRegionBackendServicesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRegionBackendServicesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListRegionBackendServicesPagedResponse apply( + ListRegionBackendServicesPage input) { + return new ListRegionBackendServicesPagedResponse(input); + } + }); + } + + private ListRegionBackendServicesPagedResponse(ListRegionBackendServicesPage page) { + super(page, ListRegionBackendServicesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRegionBackendServicesPage + extends AbstractPage< + ListRegionBackendServicesHttpRequest, BackendServiceList, BackendService, + ListRegionBackendServicesPage> { + + private ListRegionBackendServicesPage( + PageContext + context, + BackendServiceList response) { + super(context, response); + } + + private static ListRegionBackendServicesPage createEmptyPage() { + return new ListRegionBackendServicesPage(null, null); + } + + @Override + protected ListRegionBackendServicesPage createPage( + PageContext + context, + BackendServiceList response) { + return new ListRegionBackendServicesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRegionBackendServicesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRegionBackendServicesHttpRequest, BackendServiceList, BackendService, + ListRegionBackendServicesPage, ListRegionBackendServicesFixedSizeCollection> { + + private ListRegionBackendServicesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRegionBackendServicesFixedSizeCollection createEmptyCollection() { + return new ListRegionBackendServicesFixedSizeCollection(null, 0); + } + + @Override + protected ListRegionBackendServicesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRegionBackendServicesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionBackendServiceSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionBackendServiceSettings.java new file mode 100644 index 000000000000..42dfc4b91654 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionBackendServiceSettings.java @@ -0,0 +1,269 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionBackendServiceClient.ListRegionBackendServicesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.RegionBackendServiceStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionBackendServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteRegionBackendService to 30 seconds: + * + *

+ * 
+ * RegionBackendServiceSettings.Builder regionBackendServiceSettingsBuilder =
+ *     RegionBackendServiceSettings.newBuilder();
+ * regionBackendServiceSettingsBuilder.deleteRegionBackendServiceSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionBackendServiceSettings regionBackendServiceSettings = regionBackendServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionBackendServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteRegionBackendService. */ + public UnaryCallSettings + deleteRegionBackendServiceSettings() { + return ((RegionBackendServiceStubSettings) getStubSettings()) + .deleteRegionBackendServiceSettings(); + } + + /** Returns the object with the settings used for calls to getRegionBackendService. */ + public UnaryCallSettings + getRegionBackendServiceSettings() { + return ((RegionBackendServiceStubSettings) getStubSettings()).getRegionBackendServiceSettings(); + } + + /** Returns the object with the settings used for calls to getHealthRegionBackendService. */ + public UnaryCallSettings + getHealthRegionBackendServiceSettings() { + return ((RegionBackendServiceStubSettings) getStubSettings()) + .getHealthRegionBackendServiceSettings(); + } + + /** Returns the object with the settings used for calls to insertRegionBackendService. */ + public UnaryCallSettings + insertRegionBackendServiceSettings() { + return ((RegionBackendServiceStubSettings) getStubSettings()) + .insertRegionBackendServiceSettings(); + } + + /** Returns the object with the settings used for calls to listRegionBackendServices. */ + public PagedCallSettings< + ListRegionBackendServicesHttpRequest, BackendServiceList, + ListRegionBackendServicesPagedResponse> + listRegionBackendServicesSettings() { + return ((RegionBackendServiceStubSettings) getStubSettings()) + .listRegionBackendServicesSettings(); + } + + /** Returns the object with the settings used for calls to patchRegionBackendService. */ + public UnaryCallSettings + patchRegionBackendServiceSettings() { + return ((RegionBackendServiceStubSettings) getStubSettings()) + .patchRegionBackendServiceSettings(); + } + + /** Returns the object with the settings used for calls to updateRegionBackendService. */ + public UnaryCallSettings + updateRegionBackendServiceSettings() { + return ((RegionBackendServiceStubSettings) getStubSettings()) + .updateRegionBackendServiceSettings(); + } + + public static final RegionBackendServiceSettings create(RegionBackendServiceStubSettings stub) + throws IOException { + return new RegionBackendServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return RegionBackendServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return RegionBackendServiceStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return RegionBackendServiceStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return RegionBackendServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return RegionBackendServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return RegionBackendServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return RegionBackendServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return RegionBackendServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionBackendServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for RegionBackendServiceSettings. */ + public static class Builder + extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(RegionBackendServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(RegionBackendServiceStubSettings.newBuilder()); + } + + protected Builder(RegionBackendServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(RegionBackendServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public RegionBackendServiceStubSettings.Builder getStubSettingsBuilder() { + return ((RegionBackendServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteRegionBackendService. */ + public UnaryCallSettings.Builder + deleteRegionBackendServiceSettings() { + return getStubSettingsBuilder().deleteRegionBackendServiceSettings(); + } + + /** Returns the builder for the settings used for calls to getRegionBackendService. */ + public UnaryCallSettings.Builder + getRegionBackendServiceSettings() { + return getStubSettingsBuilder().getRegionBackendServiceSettings(); + } + + /** Returns the builder for the settings used for calls to getHealthRegionBackendService. */ + public UnaryCallSettings.Builder< + GetHealthRegionBackendServiceHttpRequest, BackendServiceGroupHealth> + getHealthRegionBackendServiceSettings() { + return getStubSettingsBuilder().getHealthRegionBackendServiceSettings(); + } + + /** Returns the builder for the settings used for calls to insertRegionBackendService. */ + public UnaryCallSettings.Builder + insertRegionBackendServiceSettings() { + return getStubSettingsBuilder().insertRegionBackendServiceSettings(); + } + + /** Returns the builder for the settings used for calls to listRegionBackendServices. */ + public PagedCallSettings.Builder< + ListRegionBackendServicesHttpRequest, BackendServiceList, + ListRegionBackendServicesPagedResponse> + listRegionBackendServicesSettings() { + return getStubSettingsBuilder().listRegionBackendServicesSettings(); + } + + /** Returns the builder for the settings used for calls to patchRegionBackendService. */ + public UnaryCallSettings.Builder + patchRegionBackendServiceSettings() { + return getStubSettingsBuilder().patchRegionBackendServiceSettings(); + } + + /** Returns the builder for the settings used for calls to updateRegionBackendService. */ + public UnaryCallSettings.Builder + updateRegionBackendServiceSettings() { + return getStubSettingsBuilder().updateRegionBackendServiceSettings(); + } + + @Override + public RegionBackendServiceSettings build() throws IOException { + return new RegionBackendServiceSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionClient.java new file mode 100644 index 000000000000..47b9fbaa9b8d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionClient.java @@ -0,0 +1,489 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.RegionStub; +import com.google.cloud.compute.v1.stub.RegionStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (RegionClient regionClient = RegionClient.create()) {
+ *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+ *   Region response = regionClient.getRegion(region);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the regionClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of RegionSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * RegionSettings regionSettings =
+ *     RegionSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * RegionClient regionClient =
+ *     RegionClient.create(regionSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * RegionSettings regionSettings =
+ *     RegionSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RegionClient regionClient =
+ *     RegionClient.create(regionSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionClient implements BackgroundResource { + private final RegionSettings settings; + private final RegionStub stub; + + /** Constructs an instance of RegionClient with default settings. */ + public static final RegionClient create() throws IOException { + return create(RegionSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RegionClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final RegionClient create(RegionSettings settings) throws IOException { + return new RegionClient(settings); + } + + /** + * Constructs an instance of RegionClient, using the given stub for making calls. This is for + * advanced usage - prefer to use RegionSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final RegionClient create(RegionStub stub) { + return new RegionClient(stub); + } + + /** + * Constructs an instance of RegionClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected RegionClient(RegionSettings settings) throws IOException { + this.settings = settings; + this.stub = ((RegionStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected RegionClient(RegionStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RegionSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Region resource. Gets a list of available regions by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RegionClient regionClient = RegionClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Region response = regionClient.getRegion(region);
+   * }
+   * 
+ * + * @param region Name of the region resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Region getRegion(ProjectRegionName region) { + + GetRegionHttpRequest request = + GetRegionHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return getRegion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Region resource. Gets a list of available regions by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RegionClient regionClient = RegionClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Region response = regionClient.getRegion(region.toString());
+   * }
+   * 
+ * + * @param region Name of the region resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Region getRegion(String region) { + + GetRegionHttpRequest request = GetRegionHttpRequest.newBuilder().setRegion(region).build(); + return getRegion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Region resource. Gets a list of available regions by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RegionClient regionClient = RegionClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   GetRegionHttpRequest request = GetRegionHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   Region response = regionClient.getRegion(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Region getRegion(GetRegionHttpRequest request) { + return getRegionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Region resource. Gets a list of available regions by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RegionClient regionClient = RegionClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   GetRegionHttpRequest request = GetRegionHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<Region> future = regionClient.getRegionCallable().futureCall(request);
+   *   // Do something
+   *   Region response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getRegionCallable() { + return stub.getRegionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of region resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RegionClient regionClient = RegionClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Region element : regionClient.listRegions(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionsPagedResponse listRegions(ProjectName project) { + ListRegionsHttpRequest request = + ListRegionsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listRegions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of region resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RegionClient regionClient = RegionClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Region element : regionClient.listRegions(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionsPagedResponse listRegions(String project) { + ListRegionsHttpRequest request = + ListRegionsHttpRequest.newBuilder().setProject(project).build(); + return listRegions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of region resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RegionClient regionClient = RegionClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListRegionsHttpRequest request = ListRegionsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (Region element : regionClient.listRegions(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionsPagedResponse listRegions(ListRegionsHttpRequest request) { + return listRegionsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of region resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RegionClient regionClient = RegionClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListRegionsHttpRequest request = ListRegionsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListRegionsPagedResponse> future = regionClient.listRegionsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Region element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionsPagedCallable() { + return stub.listRegionsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of region resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RegionClient regionClient = RegionClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListRegionsHttpRequest request = ListRegionsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     RegionList response = regionClient.listRegionsCallable().call(request);
+   *     for (Region element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listRegionsCallable() { + return stub.listRegionsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListRegionsPagedResponse + extends AbstractPagedListResponse< + ListRegionsHttpRequest, RegionList, Region, ListRegionsPage, + ListRegionsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRegionsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListRegionsPagedResponse apply(ListRegionsPage input) { + return new ListRegionsPagedResponse(input); + } + }); + } + + private ListRegionsPagedResponse(ListRegionsPage page) { + super(page, ListRegionsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRegionsPage + extends AbstractPage { + + private ListRegionsPage( + PageContext context, RegionList response) { + super(context, response); + } + + private static ListRegionsPage createEmptyPage() { + return new ListRegionsPage(null, null); + } + + @Override + protected ListRegionsPage createPage( + PageContext context, RegionList response) { + return new ListRegionsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRegionsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRegionsHttpRequest, RegionList, Region, ListRegionsPage, + ListRegionsFixedSizeCollection> { + + private ListRegionsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRegionsFixedSizeCollection createEmptyCollection() { + return new ListRegionsFixedSizeCollection(null, 0); + } + + @Override + protected ListRegionsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRegionsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionCommitmentClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionCommitmentClient.java new file mode 100644 index 000000000000..399aa2a169b6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionCommitmentClient.java @@ -0,0 +1,859 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.RegionCommitmentStub; +import com.google.cloud.compute.v1.stub.RegionCommitmentStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+ *   ProjectRegionCommitmentName commitment = ProjectRegionCommitmentName.of("[PROJECT]", "[REGION]", "[COMMITMENT]");
+ *   Commitment response = regionCommitmentClient.getRegionCommitment(commitment);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the regionCommitmentClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of RegionCommitmentSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * RegionCommitmentSettings regionCommitmentSettings =
+ *     RegionCommitmentSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * RegionCommitmentClient regionCommitmentClient =
+ *     RegionCommitmentClient.create(regionCommitmentSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * RegionCommitmentSettings regionCommitmentSettings =
+ *     RegionCommitmentSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RegionCommitmentClient regionCommitmentClient =
+ *     RegionCommitmentClient.create(regionCommitmentSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionCommitmentClient implements BackgroundResource { + private final RegionCommitmentSettings settings; + private final RegionCommitmentStub stub; + + /** Constructs an instance of RegionCommitmentClient with default settings. */ + public static final RegionCommitmentClient create() throws IOException { + return create(RegionCommitmentSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RegionCommitmentClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final RegionCommitmentClient create(RegionCommitmentSettings settings) + throws IOException { + return new RegionCommitmentClient(settings); + } + + /** + * Constructs an instance of RegionCommitmentClient, using the given stub for making calls. This + * is for advanced usage - prefer to use RegionCommitmentSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final RegionCommitmentClient create(RegionCommitmentStub stub) { + return new RegionCommitmentClient(stub); + } + + /** + * Constructs an instance of RegionCommitmentClient, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected RegionCommitmentClient(RegionCommitmentSettings settings) throws IOException { + this.settings = settings; + this.stub = ((RegionCommitmentStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected RegionCommitmentClient(RegionCommitmentStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RegionCommitmentSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionCommitmentStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of commitments. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (CommitmentsScopedList element : regionCommitmentClient.aggregatedListRegionCommitments(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListRegionCommitmentsPagedResponse aggregatedListRegionCommitments( + ProjectName project) { + AggregatedListRegionCommitmentsHttpRequest request = + AggregatedListRegionCommitmentsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListRegionCommitments(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of commitments. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (CommitmentsScopedList element : regionCommitmentClient.aggregatedListRegionCommitments(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListRegionCommitmentsPagedResponse aggregatedListRegionCommitments( + String project) { + AggregatedListRegionCommitmentsHttpRequest request = + AggregatedListRegionCommitmentsHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListRegionCommitments(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of commitments. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListRegionCommitmentsHttpRequest request = AggregatedListRegionCommitmentsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (CommitmentsScopedList element : regionCommitmentClient.aggregatedListRegionCommitments(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListRegionCommitmentsPagedResponse aggregatedListRegionCommitments( + AggregatedListRegionCommitmentsHttpRequest request) { + return aggregatedListRegionCommitmentsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of commitments. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListRegionCommitmentsHttpRequest request = AggregatedListRegionCommitmentsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListRegionCommitmentsPagedResponse> future = regionCommitmentClient.aggregatedListRegionCommitmentsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (CommitmentsScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListRegionCommitmentsHttpRequest, AggregatedListRegionCommitmentsPagedResponse> + aggregatedListRegionCommitmentsPagedCallable() { + return stub.aggregatedListRegionCommitmentsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of commitments. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListRegionCommitmentsHttpRequest request = AggregatedListRegionCommitmentsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     CommitmentAggregatedList response = regionCommitmentClient.aggregatedListRegionCommitmentsCallable().call(request);
+   *     for (CommitmentsScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListRegionCommitmentsCallable() { + return stub.aggregatedListRegionCommitmentsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified commitment resource. Gets a list of available commitments by making a + * list() request. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionCommitmentName commitment = ProjectRegionCommitmentName.of("[PROJECT]", "[REGION]", "[COMMITMENT]");
+   *   Commitment response = regionCommitmentClient.getRegionCommitment(commitment);
+   * }
+   * 
+ * + * @param commitment Name of the commitment to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Commitment getRegionCommitment(ProjectRegionCommitmentName commitment) { + + GetRegionCommitmentHttpRequest request = + GetRegionCommitmentHttpRequest.newBuilder() + .setCommitment(commitment == null ? null : commitment.toString()) + .build(); + return getRegionCommitment(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified commitment resource. Gets a list of available commitments by making a + * list() request. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionCommitmentName commitment = ProjectRegionCommitmentName.of("[PROJECT]", "[REGION]", "[COMMITMENT]");
+   *   Commitment response = regionCommitmentClient.getRegionCommitment(commitment.toString());
+   * }
+   * 
+ * + * @param commitment Name of the commitment to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Commitment getRegionCommitment(String commitment) { + + GetRegionCommitmentHttpRequest request = + GetRegionCommitmentHttpRequest.newBuilder().setCommitment(commitment).build(); + return getRegionCommitment(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified commitment resource. Gets a list of available commitments by making a + * list() request. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionCommitmentName commitment = ProjectRegionCommitmentName.of("[PROJECT]", "[REGION]", "[COMMITMENT]");
+   *   GetRegionCommitmentHttpRequest request = GetRegionCommitmentHttpRequest.newBuilder()
+   *     .setCommitment(commitment.toString())
+   *     .build();
+   *   Commitment response = regionCommitmentClient.getRegionCommitment(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Commitment getRegionCommitment(GetRegionCommitmentHttpRequest request) { + return getRegionCommitmentCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified commitment resource. Gets a list of available commitments by making a + * list() request. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionCommitmentName commitment = ProjectRegionCommitmentName.of("[PROJECT]", "[REGION]", "[COMMITMENT]");
+   *   GetRegionCommitmentHttpRequest request = GetRegionCommitmentHttpRequest.newBuilder()
+   *     .setCommitment(commitment.toString())
+   *     .build();
+   *   ApiFuture<Commitment> future = regionCommitmentClient.getRegionCommitmentCallable().futureCall(request);
+   *   // Do something
+   *   Commitment response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getRegionCommitmentCallable() { + return stub.getRegionCommitmentCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a commitment in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Commitment commitmentResource = Commitment.newBuilder().build();
+   *   Operation response = regionCommitmentClient.insertRegionCommitment(region, commitmentResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param commitmentResource Represents a Commitment resource. Creating a Commitment resource + * means that you are purchasing a committed use contract with an explicit start and end time. + * You can create commitments based on vCPUs and memory usage and receive discounted rates. + * For full details, read Signing Up for Committed Use Discounts. + *

Committed use discounts are subject to Google Cloud Platform's Service Specific Terms. + * By purchasing a committed use discount, you agree to these terms. Committed use discounts + * will not renew, so you must purchase a new commitment to continue receiving discounts. (== + * resource_for beta.commitments ==) (== resource_for v1.commitments ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionCommitment( + ProjectRegionName region, Commitment commitmentResource) { + + InsertRegionCommitmentHttpRequest request = + InsertRegionCommitmentHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setCommitmentResource(commitmentResource) + .build(); + return insertRegionCommitment(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a commitment in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Commitment commitmentResource = Commitment.newBuilder().build();
+   *   Operation response = regionCommitmentClient.insertRegionCommitment(region.toString(), commitmentResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param commitmentResource Represents a Commitment resource. Creating a Commitment resource + * means that you are purchasing a committed use contract with an explicit start and end time. + * You can create commitments based on vCPUs and memory usage and receive discounted rates. + * For full details, read Signing Up for Committed Use Discounts. + *

Committed use discounts are subject to Google Cloud Platform's Service Specific Terms. + * By purchasing a committed use discount, you agree to these terms. Committed use discounts + * will not renew, so you must purchase a new commitment to continue receiving discounts. (== + * resource_for beta.commitments ==) (== resource_for v1.commitments ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionCommitment(String region, Commitment commitmentResource) { + + InsertRegionCommitmentHttpRequest request = + InsertRegionCommitmentHttpRequest.newBuilder() + .setRegion(region) + .setCommitmentResource(commitmentResource) + .build(); + return insertRegionCommitment(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a commitment in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Commitment commitmentResource = Commitment.newBuilder().build();
+   *   InsertRegionCommitmentHttpRequest request = InsertRegionCommitmentHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setCommitmentResource(commitmentResource)
+   *     .build();
+   *   Operation response = regionCommitmentClient.insertRegionCommitment(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionCommitment(InsertRegionCommitmentHttpRequest request) { + return insertRegionCommitmentCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a commitment in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Commitment commitmentResource = Commitment.newBuilder().build();
+   *   InsertRegionCommitmentHttpRequest request = InsertRegionCommitmentHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setCommitmentResource(commitmentResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionCommitmentClient.insertRegionCommitmentCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertRegionCommitmentCallable() { + return stub.insertRegionCommitmentCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of commitments contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Commitment element : regionCommitmentClient.listRegionCommitments(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionCommitmentsPagedResponse listRegionCommitments(ProjectRegionName region) { + ListRegionCommitmentsHttpRequest request = + ListRegionCommitmentsHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listRegionCommitments(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of commitments contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Commitment element : regionCommitmentClient.listRegionCommitments(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionCommitmentsPagedResponse listRegionCommitments(String region) { + ListRegionCommitmentsHttpRequest request = + ListRegionCommitmentsHttpRequest.newBuilder().setRegion(region).build(); + return listRegionCommitments(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of commitments contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionCommitmentsHttpRequest request = ListRegionCommitmentsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (Commitment element : regionCommitmentClient.listRegionCommitments(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionCommitmentsPagedResponse listRegionCommitments( + ListRegionCommitmentsHttpRequest request) { + return listRegionCommitmentsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of commitments contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionCommitmentsHttpRequest request = ListRegionCommitmentsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListRegionCommitmentsPagedResponse> future = regionCommitmentClient.listRegionCommitmentsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Commitment element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionCommitmentsPagedCallable() { + return stub.listRegionCommitmentsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of commitments contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionCommitmentsHttpRequest request = ListRegionCommitmentsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     CommitmentList response = regionCommitmentClient.listRegionCommitmentsCallable().call(request);
+   *     for (Commitment element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionCommitmentsCallable() { + return stub.listRegionCommitmentsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListRegionCommitmentsPagedResponse + extends AbstractPagedListResponse< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + CommitmentsScopedList, AggregatedListRegionCommitmentsPage, + AggregatedListRegionCommitmentsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + CommitmentsScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListRegionCommitmentsPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + AggregatedListRegionCommitmentsPage, AggregatedListRegionCommitmentsPagedResponse>() { + @Override + public AggregatedListRegionCommitmentsPagedResponse apply( + AggregatedListRegionCommitmentsPage input) { + return new AggregatedListRegionCommitmentsPagedResponse(input); + } + }); + } + + private AggregatedListRegionCommitmentsPagedResponse(AggregatedListRegionCommitmentsPage page) { + super(page, AggregatedListRegionCommitmentsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListRegionCommitmentsPage + extends AbstractPage< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + CommitmentsScopedList, AggregatedListRegionCommitmentsPage> { + + private AggregatedListRegionCommitmentsPage( + PageContext< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + CommitmentsScopedList> + context, + CommitmentAggregatedList response) { + super(context, response); + } + + private static AggregatedListRegionCommitmentsPage createEmptyPage() { + return new AggregatedListRegionCommitmentsPage(null, null); + } + + @Override + protected AggregatedListRegionCommitmentsPage createPage( + PageContext< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + CommitmentsScopedList> + context, + CommitmentAggregatedList response) { + return new AggregatedListRegionCommitmentsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + CommitmentsScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListRegionCommitmentsFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + CommitmentsScopedList, AggregatedListRegionCommitmentsPage, + AggregatedListRegionCommitmentsFixedSizeCollection> { + + private AggregatedListRegionCommitmentsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListRegionCommitmentsFixedSizeCollection createEmptyCollection() { + return new AggregatedListRegionCommitmentsFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListRegionCommitmentsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListRegionCommitmentsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListRegionCommitmentsPagedResponse + extends AbstractPagedListResponse< + ListRegionCommitmentsHttpRequest, CommitmentList, Commitment, ListRegionCommitmentsPage, + ListRegionCommitmentsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRegionCommitmentsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListRegionCommitmentsPagedResponse apply(ListRegionCommitmentsPage input) { + return new ListRegionCommitmentsPagedResponse(input); + } + }); + } + + private ListRegionCommitmentsPagedResponse(ListRegionCommitmentsPage page) { + super(page, ListRegionCommitmentsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRegionCommitmentsPage + extends AbstractPage< + ListRegionCommitmentsHttpRequest, CommitmentList, Commitment, ListRegionCommitmentsPage> { + + private ListRegionCommitmentsPage( + PageContext context, + CommitmentList response) { + super(context, response); + } + + private static ListRegionCommitmentsPage createEmptyPage() { + return new ListRegionCommitmentsPage(null, null); + } + + @Override + protected ListRegionCommitmentsPage createPage( + PageContext context, + CommitmentList response) { + return new ListRegionCommitmentsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRegionCommitmentsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRegionCommitmentsHttpRequest, CommitmentList, Commitment, ListRegionCommitmentsPage, + ListRegionCommitmentsFixedSizeCollection> { + + private ListRegionCommitmentsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRegionCommitmentsFixedSizeCollection createEmptyCollection() { + return new ListRegionCommitmentsFixedSizeCollection(null, 0); + } + + @Override + protected ListRegionCommitmentsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRegionCommitmentsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionCommitmentSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionCommitmentSettings.java new file mode 100644 index 000000000000..0fc6cca0078b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionCommitmentSettings.java @@ -0,0 +1,229 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionCommitmentClient.AggregatedListRegionCommitmentsPagedResponse; +import static com.google.cloud.compute.v1.RegionCommitmentClient.ListRegionCommitmentsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.RegionCommitmentStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionCommitmentClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getRegionCommitment to 30 seconds: + * + *

+ * 
+ * RegionCommitmentSettings.Builder regionCommitmentSettingsBuilder =
+ *     RegionCommitmentSettings.newBuilder();
+ * regionCommitmentSettingsBuilder.getRegionCommitmentSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionCommitmentSettings regionCommitmentSettings = regionCommitmentSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionCommitmentSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListRegionCommitments. */ + public PagedCallSettings< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + AggregatedListRegionCommitmentsPagedResponse> + aggregatedListRegionCommitmentsSettings() { + return ((RegionCommitmentStubSettings) getStubSettings()) + .aggregatedListRegionCommitmentsSettings(); + } + + /** Returns the object with the settings used for calls to getRegionCommitment. */ + public UnaryCallSettings + getRegionCommitmentSettings() { + return ((RegionCommitmentStubSettings) getStubSettings()).getRegionCommitmentSettings(); + } + + /** Returns the object with the settings used for calls to insertRegionCommitment. */ + public UnaryCallSettings + insertRegionCommitmentSettings() { + return ((RegionCommitmentStubSettings) getStubSettings()).insertRegionCommitmentSettings(); + } + + /** Returns the object with the settings used for calls to listRegionCommitments. */ + public PagedCallSettings< + ListRegionCommitmentsHttpRequest, CommitmentList, ListRegionCommitmentsPagedResponse> + listRegionCommitmentsSettings() { + return ((RegionCommitmentStubSettings) getStubSettings()).listRegionCommitmentsSettings(); + } + + public static final RegionCommitmentSettings create(RegionCommitmentStubSettings stub) + throws IOException { + return new RegionCommitmentSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return RegionCommitmentStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return RegionCommitmentStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return RegionCommitmentStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return RegionCommitmentStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return RegionCommitmentStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return RegionCommitmentStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return RegionCommitmentStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return RegionCommitmentStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionCommitmentSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for RegionCommitmentSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(RegionCommitmentStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(RegionCommitmentStubSettings.newBuilder()); + } + + protected Builder(RegionCommitmentSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(RegionCommitmentStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public RegionCommitmentStubSettings.Builder getStubSettingsBuilder() { + return ((RegionCommitmentStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListRegionCommitments. */ + public PagedCallSettings.Builder< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + AggregatedListRegionCommitmentsPagedResponse> + aggregatedListRegionCommitmentsSettings() { + return getStubSettingsBuilder().aggregatedListRegionCommitmentsSettings(); + } + + /** Returns the builder for the settings used for calls to getRegionCommitment. */ + public UnaryCallSettings.Builder + getRegionCommitmentSettings() { + return getStubSettingsBuilder().getRegionCommitmentSettings(); + } + + /** Returns the builder for the settings used for calls to insertRegionCommitment. */ + public UnaryCallSettings.Builder + insertRegionCommitmentSettings() { + return getStubSettingsBuilder().insertRegionCommitmentSettings(); + } + + /** Returns the builder for the settings used for calls to listRegionCommitments. */ + public PagedCallSettings.Builder< + ListRegionCommitmentsHttpRequest, CommitmentList, ListRegionCommitmentsPagedResponse> + listRegionCommitmentsSettings() { + return getStubSettingsBuilder().listRegionCommitmentsSettings(); + } + + @Override + public RegionCommitmentSettings build() throws IOException { + return new RegionCommitmentSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskClient.java new file mode 100644 index 000000000000..65b229358925 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskClient.java @@ -0,0 +1,1158 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.RegionDiskStub; +import com.google.cloud.compute.v1.stub.RegionDiskStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+ *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+ *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+ *   Operation response = regionDiskClient.createSnapshotRegionDisk(disk, snapshotResource);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the regionDiskClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of RegionDiskSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * RegionDiskSettings regionDiskSettings =
+ *     RegionDiskSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * RegionDiskClient regionDiskClient =
+ *     RegionDiskClient.create(regionDiskSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * RegionDiskSettings regionDiskSettings =
+ *     RegionDiskSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RegionDiskClient regionDiskClient =
+ *     RegionDiskClient.create(regionDiskSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionDiskClient implements BackgroundResource { + private final RegionDiskSettings settings; + private final RegionDiskStub stub; + + /** Constructs an instance of RegionDiskClient with default settings. */ + public static final RegionDiskClient create() throws IOException { + return create(RegionDiskSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RegionDiskClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final RegionDiskClient create(RegionDiskSettings settings) throws IOException { + return new RegionDiskClient(settings); + } + + /** + * Constructs an instance of RegionDiskClient, using the given stub for making calls. This is for + * advanced usage - prefer to use RegionDiskSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final RegionDiskClient create(RegionDiskStub stub) { + return new RegionDiskClient(stub); + } + + /** + * Constructs an instance of RegionDiskClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected RegionDiskClient(RegionDiskSettings settings) throws IOException { + this.settings = settings; + this.stub = ((RegionDiskStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected RegionDiskClient(RegionDiskStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RegionDiskSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionDiskStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a snapshot of this regional disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+   *   Operation response = regionDiskClient.createSnapshotRegionDisk(disk, snapshotResource);
+   * }
+   * 
+ * + * @param disk Name of the regional persistent disk to snapshot. + * @param snapshotResource A persistent disk snapshot resource. (== resource_for beta.snapshots + * ==) (== resource_for v1.snapshots ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation createSnapshotRegionDisk( + ProjectRegionDiskName disk, Snapshot snapshotResource) { + + CreateSnapshotRegionDiskHttpRequest request = + CreateSnapshotRegionDiskHttpRequest.newBuilder() + .setDisk(disk == null ? null : disk.toString()) + .setSnapshotResource(snapshotResource) + .build(); + return createSnapshotRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a snapshot of this regional disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+   *   Operation response = regionDiskClient.createSnapshotRegionDisk(disk.toString(), snapshotResource);
+   * }
+   * 
+ * + * @param disk Name of the regional persistent disk to snapshot. + * @param snapshotResource A persistent disk snapshot resource. (== resource_for beta.snapshots + * ==) (== resource_for v1.snapshots ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation createSnapshotRegionDisk(String disk, Snapshot snapshotResource) { + + CreateSnapshotRegionDiskHttpRequest request = + CreateSnapshotRegionDiskHttpRequest.newBuilder() + .setDisk(disk) + .setSnapshotResource(snapshotResource) + .build(); + return createSnapshotRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a snapshot of this regional disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+   *   CreateSnapshotRegionDiskHttpRequest request = CreateSnapshotRegionDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .setSnapshotResource(snapshotResource)
+   *     .build();
+   *   Operation response = regionDiskClient.createSnapshotRegionDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation createSnapshotRegionDisk(CreateSnapshotRegionDiskHttpRequest request) { + return createSnapshotRegionDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a snapshot of this regional disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+   *   CreateSnapshotRegionDiskHttpRequest request = CreateSnapshotRegionDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .setSnapshotResource(snapshotResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionDiskClient.createSnapshotRegionDiskCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + createSnapshotRegionDiskCallable() { + return stub.createSnapshotRegionDiskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified regional persistent disk. Deleting a regional disk removes all the + * replicas of its data permanently and is irreversible. However, deleting a disk does not delete + * any snapshots previously made from the disk. You must separately delete snapshots. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   Operation response = regionDiskClient.deleteRegionDisk(disk);
+   * }
+   * 
+ * + * @param disk Name of the regional persistent disk to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionDisk(ProjectRegionDiskName disk) { + + DeleteRegionDiskHttpRequest request = + DeleteRegionDiskHttpRequest.newBuilder() + .setDisk(disk == null ? null : disk.toString()) + .build(); + return deleteRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified regional persistent disk. Deleting a regional disk removes all the + * replicas of its data permanently and is irreversible. However, deleting a disk does not delete + * any snapshots previously made from the disk. You must separately delete snapshots. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   Operation response = regionDiskClient.deleteRegionDisk(disk.toString());
+   * }
+   * 
+ * + * @param disk Name of the regional persistent disk to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionDisk(String disk) { + + DeleteRegionDiskHttpRequest request = + DeleteRegionDiskHttpRequest.newBuilder().setDisk(disk).build(); + return deleteRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified regional persistent disk. Deleting a regional disk removes all the + * replicas of its data permanently and is irreversible. However, deleting a disk does not delete + * any snapshots previously made from the disk. You must separately delete snapshots. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   DeleteRegionDiskHttpRequest request = DeleteRegionDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .build();
+   *   Operation response = regionDiskClient.deleteRegionDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionDisk(DeleteRegionDiskHttpRequest request) { + return deleteRegionDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified regional persistent disk. Deleting a regional disk removes all the + * replicas of its data permanently and is irreversible. However, deleting a disk does not delete + * any snapshots previously made from the disk. You must separately delete snapshots. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   DeleteRegionDiskHttpRequest request = DeleteRegionDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = regionDiskClient.deleteRegionDiskCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteRegionDiskCallable() { + return stub.deleteRegionDiskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a specified regional persistent disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   Disk response = regionDiskClient.getRegionDisk(disk);
+   * }
+   * 
+ * + * @param disk Name of the regional persistent disk to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Disk getRegionDisk(ProjectRegionDiskName disk) { + + GetRegionDiskHttpRequest request = + GetRegionDiskHttpRequest.newBuilder() + .setDisk(disk == null ? null : disk.toString()) + .build(); + return getRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a specified regional persistent disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   Disk response = regionDiskClient.getRegionDisk(disk.toString());
+   * }
+   * 
+ * + * @param disk Name of the regional persistent disk to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Disk getRegionDisk(String disk) { + + GetRegionDiskHttpRequest request = GetRegionDiskHttpRequest.newBuilder().setDisk(disk).build(); + return getRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a specified regional persistent disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   GetRegionDiskHttpRequest request = GetRegionDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .build();
+   *   Disk response = regionDiskClient.getRegionDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Disk getRegionDisk(GetRegionDiskHttpRequest request) { + return getRegionDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a specified regional persistent disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   GetRegionDiskHttpRequest request = GetRegionDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .build();
+   *   ApiFuture<Disk> future = regionDiskClient.getRegionDiskCallable().futureCall(request);
+   *   // Do something
+   *   Disk response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getRegionDiskCallable() { + return stub.getRegionDiskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a persistent regional disk in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Disk diskResource = Disk.newBuilder().build();
+   *   Operation response = regionDiskClient.insertRegionDisk(region, diskResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param diskResource A Disk resource. (== resource_for beta.disks ==) (== resource_for v1.disks + * ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionDisk(ProjectRegionName region, Disk diskResource) { + + InsertRegionDiskHttpRequest request = + InsertRegionDiskHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setDiskResource(diskResource) + .build(); + return insertRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a persistent regional disk in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Disk diskResource = Disk.newBuilder().build();
+   *   Operation response = regionDiskClient.insertRegionDisk(region.toString(), diskResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param diskResource A Disk resource. (== resource_for beta.disks ==) (== resource_for v1.disks + * ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionDisk(String region, Disk diskResource) { + + InsertRegionDiskHttpRequest request = + InsertRegionDiskHttpRequest.newBuilder() + .setRegion(region) + .setDiskResource(diskResource) + .build(); + return insertRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a persistent regional disk in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Disk diskResource = Disk.newBuilder().build();
+   *   InsertRegionDiskHttpRequest request = InsertRegionDiskHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setDiskResource(diskResource)
+   *     .build();
+   *   Operation response = regionDiskClient.insertRegionDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionDisk(InsertRegionDiskHttpRequest request) { + return insertRegionDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a persistent regional disk in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Disk diskResource = Disk.newBuilder().build();
+   *   InsertRegionDiskHttpRequest request = InsertRegionDiskHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setDiskResource(diskResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionDiskClient.insertRegionDiskCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertRegionDiskCallable() { + return stub.insertRegionDiskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of persistent disks contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Disk element : regionDiskClient.listRegionDisks(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionDisksPagedResponse listRegionDisks(ProjectRegionName region) { + ListRegionDisksHttpRequest request = + ListRegionDisksHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listRegionDisks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of persistent disks contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Disk element : regionDiskClient.listRegionDisks(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionDisksPagedResponse listRegionDisks(String region) { + ListRegionDisksHttpRequest request = + ListRegionDisksHttpRequest.newBuilder().setRegion(region).build(); + return listRegionDisks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of persistent disks contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionDisksHttpRequest request = ListRegionDisksHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (Disk element : regionDiskClient.listRegionDisks(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionDisksPagedResponse listRegionDisks(ListRegionDisksHttpRequest request) { + return listRegionDisksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of persistent disks contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionDisksHttpRequest request = ListRegionDisksHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListRegionDisksPagedResponse> future = regionDiskClient.listRegionDisksPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Disk element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionDisksPagedCallable() { + return stub.listRegionDisksPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of persistent disks contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionDisksHttpRequest request = ListRegionDisksHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     DiskList response = regionDiskClient.listRegionDisksCallable().call(request);
+   *     for (Disk element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listRegionDisksCallable() { + return stub.listRegionDisksCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the specified regional persistent disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   RegionDisksResizeRequest regionDisksResizeRequestResource = RegionDisksResizeRequest.newBuilder().build();
+   *   Operation response = regionDiskClient.resizeRegionDisk(disk, regionDisksResizeRequestResource);
+   * }
+   * 
+ * + * @param disk Name of the regional persistent disk. + * @param regionDisksResizeRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeRegionDisk( + ProjectRegionDiskName disk, RegionDisksResizeRequest regionDisksResizeRequestResource) { + + ResizeRegionDiskHttpRequest request = + ResizeRegionDiskHttpRequest.newBuilder() + .setDisk(disk == null ? null : disk.toString()) + .setRegionDisksResizeRequestResource(regionDisksResizeRequestResource) + .build(); + return resizeRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the specified regional persistent disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   RegionDisksResizeRequest regionDisksResizeRequestResource = RegionDisksResizeRequest.newBuilder().build();
+   *   Operation response = regionDiskClient.resizeRegionDisk(disk.toString(), regionDisksResizeRequestResource);
+   * }
+   * 
+ * + * @param disk Name of the regional persistent disk. + * @param regionDisksResizeRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeRegionDisk( + String disk, RegionDisksResizeRequest regionDisksResizeRequestResource) { + + ResizeRegionDiskHttpRequest request = + ResizeRegionDiskHttpRequest.newBuilder() + .setDisk(disk) + .setRegionDisksResizeRequestResource(regionDisksResizeRequestResource) + .build(); + return resizeRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the specified regional persistent disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   RegionDisksResizeRequest regionDisksResizeRequestResource = RegionDisksResizeRequest.newBuilder().build();
+   *   ResizeRegionDiskHttpRequest request = ResizeRegionDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .setRegionDisksResizeRequestResource(regionDisksResizeRequestResource)
+   *     .build();
+   *   Operation response = regionDiskClient.resizeRegionDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeRegionDisk(ResizeRegionDiskHttpRequest request) { + return resizeRegionDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Resizes the specified regional persistent disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+   *   RegionDisksResizeRequest regionDisksResizeRequestResource = RegionDisksResizeRequest.newBuilder().build();
+   *   ResizeRegionDiskHttpRequest request = ResizeRegionDiskHttpRequest.newBuilder()
+   *     .setDisk(disk.toString())
+   *     .setRegionDisksResizeRequestResource(regionDisksResizeRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionDiskClient.resizeRegionDiskCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable resizeRegionDiskCallable() { + return stub.resizeRegionDiskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on the target regional disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
+   *   RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
+   *   Operation response = regionDiskClient.setLabelsRegionDisk(resource, regionSetLabelsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param regionSetLabelsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsRegionDisk( + ProjectRegionDiskResourceName resource, + RegionSetLabelsRequest regionSetLabelsRequestResource) { + + SetLabelsRegionDiskHttpRequest request = + SetLabelsRegionDiskHttpRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setRegionSetLabelsRequestResource(regionSetLabelsRequestResource) + .build(); + return setLabelsRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on the target regional disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
+   *   RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
+   *   Operation response = regionDiskClient.setLabelsRegionDisk(resource.toString(), regionSetLabelsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param regionSetLabelsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsRegionDisk( + String resource, RegionSetLabelsRequest regionSetLabelsRequestResource) { + + SetLabelsRegionDiskHttpRequest request = + SetLabelsRegionDiskHttpRequest.newBuilder() + .setResource(resource) + .setRegionSetLabelsRequestResource(regionSetLabelsRequestResource) + .build(); + return setLabelsRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on the target regional disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
+   *   RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
+   *   SetLabelsRegionDiskHttpRequest request = SetLabelsRegionDiskHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setRegionSetLabelsRequestResource(regionSetLabelsRequestResource)
+   *     .build();
+   *   Operation response = regionDiskClient.setLabelsRegionDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsRegionDisk(SetLabelsRegionDiskHttpRequest request) { + return setLabelsRegionDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on the target regional disk. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
+   *   RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
+   *   SetLabelsRegionDiskHttpRequest request = SetLabelsRegionDiskHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setRegionSetLabelsRequestResource(regionSetLabelsRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionDiskClient.setLabelsRegionDiskCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setLabelsRegionDiskCallable() { + return stub.setLabelsRegionDiskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestPermissionsResponse response = regionDiskClient.testIamPermissionsRegionDisk(resource, testPermissionsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param testPermissionsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TestPermissionsResponse testIamPermissionsRegionDisk( + ProjectRegionDiskResourceName resource, + TestPermissionsRequest testPermissionsRequestResource) { + + TestIamPermissionsRegionDiskHttpRequest request = + TestIamPermissionsRegionDiskHttpRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setTestPermissionsRequestResource(testPermissionsRequestResource) + .build(); + return testIamPermissionsRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestPermissionsResponse response = regionDiskClient.testIamPermissionsRegionDisk(resource.toString(), testPermissionsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param testPermissionsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TestPermissionsResponse testIamPermissionsRegionDisk( + String resource, TestPermissionsRequest testPermissionsRequestResource) { + + TestIamPermissionsRegionDiskHttpRequest request = + TestIamPermissionsRegionDiskHttpRequest.newBuilder() + .setResource(resource) + .setTestPermissionsRequestResource(testPermissionsRequestResource) + .build(); + return testIamPermissionsRegionDisk(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestIamPermissionsRegionDiskHttpRequest request = TestIamPermissionsRegionDiskHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setTestPermissionsRequestResource(testPermissionsRequestResource)
+   *     .build();
+   *   TestPermissionsResponse response = regionDiskClient.testIamPermissionsRegionDisk(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TestPermissionsResponse testIamPermissionsRegionDisk( + TestIamPermissionsRegionDiskHttpRequest request) { + return testIamPermissionsRegionDiskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. + * + *

Sample code: + * + *


+   * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+   *   ProjectRegionDiskResourceName resource = ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
+   *   TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
+   *   TestIamPermissionsRegionDiskHttpRequest request = TestIamPermissionsRegionDiskHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setTestPermissionsRequestResource(testPermissionsRequestResource)
+   *     .build();
+   *   ApiFuture<TestPermissionsResponse> future = regionDiskClient.testIamPermissionsRegionDiskCallable().futureCall(request);
+   *   // Do something
+   *   TestPermissionsResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + testIamPermissionsRegionDiskCallable() { + return stub.testIamPermissionsRegionDiskCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListRegionDisksPagedResponse + extends AbstractPagedListResponse< + ListRegionDisksHttpRequest, DiskList, Disk, ListRegionDisksPage, + ListRegionDisksFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRegionDisksPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListRegionDisksPagedResponse apply(ListRegionDisksPage input) { + return new ListRegionDisksPagedResponse(input); + } + }); + } + + private ListRegionDisksPagedResponse(ListRegionDisksPage page) { + super(page, ListRegionDisksFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRegionDisksPage + extends AbstractPage { + + private ListRegionDisksPage( + PageContext context, DiskList response) { + super(context, response); + } + + private static ListRegionDisksPage createEmptyPage() { + return new ListRegionDisksPage(null, null); + } + + @Override + protected ListRegionDisksPage createPage( + PageContext context, DiskList response) { + return new ListRegionDisksPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRegionDisksFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRegionDisksHttpRequest, DiskList, Disk, ListRegionDisksPage, + ListRegionDisksFixedSizeCollection> { + + private ListRegionDisksFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRegionDisksFixedSizeCollection createEmptyCollection() { + return new ListRegionDisksFixedSizeCollection(null, 0); + } + + @Override + protected ListRegionDisksFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRegionDisksFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskSettings.java new file mode 100644 index 000000000000..fdb694f95881 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskSettings.java @@ -0,0 +1,265 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionDiskClient.ListRegionDisksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.RegionDiskStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionDiskClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of createSnapshotRegionDisk to 30 seconds: + * + *

+ * 
+ * RegionDiskSettings.Builder regionDiskSettingsBuilder =
+ *     RegionDiskSettings.newBuilder();
+ * regionDiskSettingsBuilder.createSnapshotRegionDiskSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionDiskSettings regionDiskSettings = regionDiskSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionDiskSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createSnapshotRegionDisk. */ + public UnaryCallSettings + createSnapshotRegionDiskSettings() { + return ((RegionDiskStubSettings) getStubSettings()).createSnapshotRegionDiskSettings(); + } + + /** Returns the object with the settings used for calls to deleteRegionDisk. */ + public UnaryCallSettings deleteRegionDiskSettings() { + return ((RegionDiskStubSettings) getStubSettings()).deleteRegionDiskSettings(); + } + + /** Returns the object with the settings used for calls to getRegionDisk. */ + public UnaryCallSettings getRegionDiskSettings() { + return ((RegionDiskStubSettings) getStubSettings()).getRegionDiskSettings(); + } + + /** Returns the object with the settings used for calls to insertRegionDisk. */ + public UnaryCallSettings insertRegionDiskSettings() { + return ((RegionDiskStubSettings) getStubSettings()).insertRegionDiskSettings(); + } + + /** Returns the object with the settings used for calls to listRegionDisks. */ + public PagedCallSettings + listRegionDisksSettings() { + return ((RegionDiskStubSettings) getStubSettings()).listRegionDisksSettings(); + } + + /** Returns the object with the settings used for calls to resizeRegionDisk. */ + public UnaryCallSettings resizeRegionDiskSettings() { + return ((RegionDiskStubSettings) getStubSettings()).resizeRegionDiskSettings(); + } + + /** Returns the object with the settings used for calls to setLabelsRegionDisk. */ + public UnaryCallSettings + setLabelsRegionDiskSettings() { + return ((RegionDiskStubSettings) getStubSettings()).setLabelsRegionDiskSettings(); + } + + /** Returns the object with the settings used for calls to testIamPermissionsRegionDisk. */ + public UnaryCallSettings + testIamPermissionsRegionDiskSettings() { + return ((RegionDiskStubSettings) getStubSettings()).testIamPermissionsRegionDiskSettings(); + } + + public static final RegionDiskSettings create(RegionDiskStubSettings stub) throws IOException { + return new RegionDiskSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return RegionDiskStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return RegionDiskStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return RegionDiskStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return RegionDiskStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return RegionDiskStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return RegionDiskStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return RegionDiskStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return RegionDiskStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionDiskSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for RegionDiskSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(RegionDiskStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(RegionDiskStubSettings.newBuilder()); + } + + protected Builder(RegionDiskSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(RegionDiskStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public RegionDiskStubSettings.Builder getStubSettingsBuilder() { + return ((RegionDiskStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to createSnapshotRegionDisk. */ + public UnaryCallSettings.Builder + createSnapshotRegionDiskSettings() { + return getStubSettingsBuilder().createSnapshotRegionDiskSettings(); + } + + /** Returns the builder for the settings used for calls to deleteRegionDisk. */ + public UnaryCallSettings.Builder + deleteRegionDiskSettings() { + return getStubSettingsBuilder().deleteRegionDiskSettings(); + } + + /** Returns the builder for the settings used for calls to getRegionDisk. */ + public UnaryCallSettings.Builder getRegionDiskSettings() { + return getStubSettingsBuilder().getRegionDiskSettings(); + } + + /** Returns the builder for the settings used for calls to insertRegionDisk. */ + public UnaryCallSettings.Builder + insertRegionDiskSettings() { + return getStubSettingsBuilder().insertRegionDiskSettings(); + } + + /** Returns the builder for the settings used for calls to listRegionDisks. */ + public PagedCallSettings.Builder< + ListRegionDisksHttpRequest, DiskList, ListRegionDisksPagedResponse> + listRegionDisksSettings() { + return getStubSettingsBuilder().listRegionDisksSettings(); + } + + /** Returns the builder for the settings used for calls to resizeRegionDisk. */ + public UnaryCallSettings.Builder + resizeRegionDiskSettings() { + return getStubSettingsBuilder().resizeRegionDiskSettings(); + } + + /** Returns the builder for the settings used for calls to setLabelsRegionDisk. */ + public UnaryCallSettings.Builder + setLabelsRegionDiskSettings() { + return getStubSettingsBuilder().setLabelsRegionDiskSettings(); + } + + /** Returns the builder for the settings used for calls to testIamPermissionsRegionDisk. */ + public UnaryCallSettings.Builder< + TestIamPermissionsRegionDiskHttpRequest, TestPermissionsResponse> + testIamPermissionsRegionDiskSettings() { + return getStubSettingsBuilder().testIamPermissionsRegionDiskSettings(); + } + + @Override + public RegionDiskSettings build() throws IOException { + return new RegionDiskSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskTypeClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskTypeClient.java new file mode 100644 index 000000000000..d4215d2c0199 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskTypeClient.java @@ -0,0 +1,498 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.RegionDiskTypeStub; +import com.google.cloud.compute.v1.stub.RegionDiskTypeStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
+ *   ProjectRegionDiskTypeName diskType = ProjectRegionDiskTypeName.of("[PROJECT]", "[REGION]", "[DISK_TYPE]");
+ *   DiskType response = regionDiskTypeClient.getRegionDiskType(diskType);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the regionDiskTypeClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of RegionDiskTypeSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * RegionDiskTypeSettings regionDiskTypeSettings =
+ *     RegionDiskTypeSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * RegionDiskTypeClient regionDiskTypeClient =
+ *     RegionDiskTypeClient.create(regionDiskTypeSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * RegionDiskTypeSettings regionDiskTypeSettings =
+ *     RegionDiskTypeSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RegionDiskTypeClient regionDiskTypeClient =
+ *     RegionDiskTypeClient.create(regionDiskTypeSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionDiskTypeClient implements BackgroundResource { + private final RegionDiskTypeSettings settings; + private final RegionDiskTypeStub stub; + + /** Constructs an instance of RegionDiskTypeClient with default settings. */ + public static final RegionDiskTypeClient create() throws IOException { + return create(RegionDiskTypeSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RegionDiskTypeClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final RegionDiskTypeClient create(RegionDiskTypeSettings settings) + throws IOException { + return new RegionDiskTypeClient(settings); + } + + /** + * Constructs an instance of RegionDiskTypeClient, using the given stub for making calls. This is + * for advanced usage - prefer to use RegionDiskTypeSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final RegionDiskTypeClient create(RegionDiskTypeStub stub) { + return new RegionDiskTypeClient(stub); + } + + /** + * Constructs an instance of RegionDiskTypeClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected RegionDiskTypeClient(RegionDiskTypeSettings settings) throws IOException { + this.settings = settings; + this.stub = ((RegionDiskTypeStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected RegionDiskTypeClient(RegionDiskTypeStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RegionDiskTypeSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionDiskTypeStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified regional disk type. Gets a list of available disk types by making a + * list() request. + * + *

Sample code: + * + *


+   * try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
+   *   ProjectRegionDiskTypeName diskType = ProjectRegionDiskTypeName.of("[PROJECT]", "[REGION]", "[DISK_TYPE]");
+   *   DiskType response = regionDiskTypeClient.getRegionDiskType(diskType);
+   * }
+   * 
+ * + * @param diskType Name of the disk type to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final DiskType getRegionDiskType(ProjectRegionDiskTypeName diskType) { + + GetRegionDiskTypeHttpRequest request = + GetRegionDiskTypeHttpRequest.newBuilder() + .setDiskType(diskType == null ? null : diskType.toString()) + .build(); + return getRegionDiskType(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified regional disk type. Gets a list of available disk types by making a + * list() request. + * + *

Sample code: + * + *


+   * try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
+   *   ProjectRegionDiskTypeName diskType = ProjectRegionDiskTypeName.of("[PROJECT]", "[REGION]", "[DISK_TYPE]");
+   *   DiskType response = regionDiskTypeClient.getRegionDiskType(diskType.toString());
+   * }
+   * 
+ * + * @param diskType Name of the disk type to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final DiskType getRegionDiskType(String diskType) { + + GetRegionDiskTypeHttpRequest request = + GetRegionDiskTypeHttpRequest.newBuilder().setDiskType(diskType).build(); + return getRegionDiskType(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified regional disk type. Gets a list of available disk types by making a + * list() request. + * + *

Sample code: + * + *


+   * try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
+   *   ProjectRegionDiskTypeName diskType = ProjectRegionDiskTypeName.of("[PROJECT]", "[REGION]", "[DISK_TYPE]");
+   *   GetRegionDiskTypeHttpRequest request = GetRegionDiskTypeHttpRequest.newBuilder()
+   *     .setDiskType(diskType.toString())
+   *     .build();
+   *   DiskType response = regionDiskTypeClient.getRegionDiskType(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final DiskType getRegionDiskType(GetRegionDiskTypeHttpRequest request) { + return getRegionDiskTypeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified regional disk type. Gets a list of available disk types by making a + * list() request. + * + *

Sample code: + * + *


+   * try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
+   *   ProjectRegionDiskTypeName diskType = ProjectRegionDiskTypeName.of("[PROJECT]", "[REGION]", "[DISK_TYPE]");
+   *   GetRegionDiskTypeHttpRequest request = GetRegionDiskTypeHttpRequest.newBuilder()
+   *     .setDiskType(diskType.toString())
+   *     .build();
+   *   ApiFuture<DiskType> future = regionDiskTypeClient.getRegionDiskTypeCallable().futureCall(request);
+   *   // Do something
+   *   DiskType response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getRegionDiskTypeCallable() { + return stub.getRegionDiskTypeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of regional disk types available to the specified project. + * + *

Sample code: + * + *


+   * try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (DiskType element : regionDiskTypeClient.listRegionDiskTypes(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region The name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionDiskTypesPagedResponse listRegionDiskTypes(ProjectRegionName region) { + ListRegionDiskTypesHttpRequest request = + ListRegionDiskTypesHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listRegionDiskTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of regional disk types available to the specified project. + * + *

Sample code: + * + *


+   * try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (DiskType element : regionDiskTypeClient.listRegionDiskTypes(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region The name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionDiskTypesPagedResponse listRegionDiskTypes(String region) { + ListRegionDiskTypesHttpRequest request = + ListRegionDiskTypesHttpRequest.newBuilder().setRegion(region).build(); + return listRegionDiskTypes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of regional disk types available to the specified project. + * + *

Sample code: + * + *


+   * try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionDiskTypesHttpRequest request = ListRegionDiskTypesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (DiskType element : regionDiskTypeClient.listRegionDiskTypes(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionDiskTypesPagedResponse listRegionDiskTypes( + ListRegionDiskTypesHttpRequest request) { + return listRegionDiskTypesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of regional disk types available to the specified project. + * + *

Sample code: + * + *


+   * try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionDiskTypesHttpRequest request = ListRegionDiskTypesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListRegionDiskTypesPagedResponse> future = regionDiskTypeClient.listRegionDiskTypesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (DiskType element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionDiskTypesPagedCallable() { + return stub.listRegionDiskTypesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of regional disk types available to the specified project. + * + *

Sample code: + * + *


+   * try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionDiskTypesHttpRequest request = ListRegionDiskTypesHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     RegionDiskTypeList response = regionDiskTypeClient.listRegionDiskTypesCallable().call(request);
+   *     for (DiskType element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionDiskTypesCallable() { + return stub.listRegionDiskTypesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListRegionDiskTypesPagedResponse + extends AbstractPagedListResponse< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, DiskType, ListRegionDiskTypesPage, + ListRegionDiskTypesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRegionDiskTypesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListRegionDiskTypesPagedResponse apply(ListRegionDiskTypesPage input) { + return new ListRegionDiskTypesPagedResponse(input); + } + }); + } + + private ListRegionDiskTypesPagedResponse(ListRegionDiskTypesPage page) { + super(page, ListRegionDiskTypesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRegionDiskTypesPage + extends AbstractPage< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, DiskType, ListRegionDiskTypesPage> { + + private ListRegionDiskTypesPage( + PageContext context, + RegionDiskTypeList response) { + super(context, response); + } + + private static ListRegionDiskTypesPage createEmptyPage() { + return new ListRegionDiskTypesPage(null, null); + } + + @Override + protected ListRegionDiskTypesPage createPage( + PageContext context, + RegionDiskTypeList response) { + return new ListRegionDiskTypesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRegionDiskTypesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, DiskType, ListRegionDiskTypesPage, + ListRegionDiskTypesFixedSizeCollection> { + + private ListRegionDiskTypesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRegionDiskTypesFixedSizeCollection createEmptyCollection() { + return new ListRegionDiskTypesFixedSizeCollection(null, 0); + } + + @Override + protected ListRegionDiskTypesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRegionDiskTypesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskTypeList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskTypeList.java new file mode 100644 index 000000000000..66d048d56ea9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskTypeList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionDiskTypeList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private RegionDiskTypeList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private RegionDiskTypeList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionDiskTypeList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionDiskTypeList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionDiskTypeList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionDiskTypeList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(RegionDiskTypeList other) { + if (other == RegionDiskTypeList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(RegionDiskTypeList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(DiskType items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public RegionDiskTypeList build() { + + return new RegionDiskTypeList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionDiskTypeList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionDiskTypeList) { + RegionDiskTypeList that = (RegionDiskTypeList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskTypeSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskTypeSettings.java new file mode 100644 index 000000000000..0a61ca74e741 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskTypeSettings.java @@ -0,0 +1,198 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionDiskTypeClient.ListRegionDiskTypesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.RegionDiskTypeStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionDiskTypeClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getRegionDiskType to 30 seconds: + * + *

+ * 
+ * RegionDiskTypeSettings.Builder regionDiskTypeSettingsBuilder =
+ *     RegionDiskTypeSettings.newBuilder();
+ * regionDiskTypeSettingsBuilder.getRegionDiskTypeSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionDiskTypeSettings regionDiskTypeSettings = regionDiskTypeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionDiskTypeSettings extends ClientSettings { + /** Returns the object with the settings used for calls to getRegionDiskType. */ + public UnaryCallSettings getRegionDiskTypeSettings() { + return ((RegionDiskTypeStubSettings) getStubSettings()).getRegionDiskTypeSettings(); + } + + /** Returns the object with the settings used for calls to listRegionDiskTypes. */ + public PagedCallSettings< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, ListRegionDiskTypesPagedResponse> + listRegionDiskTypesSettings() { + return ((RegionDiskTypeStubSettings) getStubSettings()).listRegionDiskTypesSettings(); + } + + public static final RegionDiskTypeSettings create(RegionDiskTypeStubSettings stub) + throws IOException { + return new RegionDiskTypeSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return RegionDiskTypeStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return RegionDiskTypeStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return RegionDiskTypeStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return RegionDiskTypeStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return RegionDiskTypeStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return RegionDiskTypeStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return RegionDiskTypeStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return RegionDiskTypeStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionDiskTypeSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for RegionDiskTypeSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(RegionDiskTypeStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(RegionDiskTypeStubSettings.newBuilder()); + } + + protected Builder(RegionDiskTypeSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(RegionDiskTypeStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public RegionDiskTypeStubSettings.Builder getStubSettingsBuilder() { + return ((RegionDiskTypeStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to getRegionDiskType. */ + public UnaryCallSettings.Builder + getRegionDiskTypeSettings() { + return getStubSettingsBuilder().getRegionDiskTypeSettings(); + } + + /** Returns the builder for the settings used for calls to listRegionDiskTypes. */ + public PagedCallSettings.Builder< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, ListRegionDiskTypesPagedResponse> + listRegionDiskTypesSettings() { + return getStubSettingsBuilder().listRegionDiskTypesSettings(); + } + + @Override + public RegionDiskTypeSettings build() throws IOException { + return new RegionDiskTypeSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDisksResizeRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDisksResizeRequest.java new file mode 100644 index 000000000000..55e1eaf40792 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDisksResizeRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionDisksResizeRequest implements ApiMessage { + private final String sizeGb; + + private RegionDisksResizeRequest() { + this.sizeGb = null; + } + + private RegionDisksResizeRequest(String sizeGb) { + this.sizeGb = sizeGb; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("sizeGb")) { + return sizeGb; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getSizeGb() { + return sizeGb; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionDisksResizeRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionDisksResizeRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionDisksResizeRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionDisksResizeRequest(); + } + + public static class Builder { + private String sizeGb; + + Builder() {} + + public Builder mergeFrom(RegionDisksResizeRequest other) { + if (other == RegionDisksResizeRequest.getDefaultInstance()) return this; + if (other.getSizeGb() != null) { + this.sizeGb = other.sizeGb; + } + return this; + } + + Builder(RegionDisksResizeRequest source) { + this.sizeGb = source.sizeGb; + } + + public String getSizeGb() { + return sizeGb; + } + + public Builder setSizeGb(String sizeGb) { + this.sizeGb = sizeGb; + return this; + } + + public RegionDisksResizeRequest build() { + return new RegionDisksResizeRequest(sizeGb); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setSizeGb(this.sizeGb); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionDisksResizeRequest{" + "sizeGb=" + sizeGb + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionDisksResizeRequest) { + RegionDisksResizeRequest that = (RegionDisksResizeRequest) o; + return Objects.equals(this.sizeGb, that.getSizeGb()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(sizeGb); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupClient.java new file mode 100644 index 000000000000..5c4038ebd787 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupClient.java @@ -0,0 +1,888 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.RegionInstanceGroupStub; +import com.google.cloud.compute.v1.stub.RegionInstanceGroupStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+ *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+ *   InstanceGroup response = regionInstanceGroupClient.getRegionInstanceGroup(instanceGroup);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the regionInstanceGroupClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of RegionInstanceGroupSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * RegionInstanceGroupSettings regionInstanceGroupSettings =
+ *     RegionInstanceGroupSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * RegionInstanceGroupClient regionInstanceGroupClient =
+ *     RegionInstanceGroupClient.create(regionInstanceGroupSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * RegionInstanceGroupSettings regionInstanceGroupSettings =
+ *     RegionInstanceGroupSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RegionInstanceGroupClient regionInstanceGroupClient =
+ *     RegionInstanceGroupClient.create(regionInstanceGroupSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionInstanceGroupClient implements BackgroundResource { + private final RegionInstanceGroupSettings settings; + private final RegionInstanceGroupStub stub; + + /** Constructs an instance of RegionInstanceGroupClient with default settings. */ + public static final RegionInstanceGroupClient create() throws IOException { + return create(RegionInstanceGroupSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RegionInstanceGroupClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final RegionInstanceGroupClient create(RegionInstanceGroupSettings settings) + throws IOException { + return new RegionInstanceGroupClient(settings); + } + + /** + * Constructs an instance of RegionInstanceGroupClient, using the given stub for making calls. + * This is for advanced usage - prefer to use RegionInstanceGroupSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final RegionInstanceGroupClient create(RegionInstanceGroupStub stub) { + return new RegionInstanceGroupClient(stub); + } + + /** + * Constructs an instance of RegionInstanceGroupClient, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected RegionInstanceGroupClient(RegionInstanceGroupSettings settings) throws IOException { + this.settings = settings; + this.stub = ((RegionInstanceGroupStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected RegionInstanceGroupClient(RegionInstanceGroupStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RegionInstanceGroupSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionInstanceGroupStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance group resource. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   InstanceGroup response = regionInstanceGroupClient.getRegionInstanceGroup(instanceGroup);
+   * }
+   * 
+ * + * @param instanceGroup Name of the instance group resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroup getRegionInstanceGroup(ProjectRegionInstanceGroupName instanceGroup) { + + GetRegionInstanceGroupHttpRequest request = + GetRegionInstanceGroupHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup == null ? null : instanceGroup.toString()) + .build(); + return getRegionInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance group resource. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   InstanceGroup response = regionInstanceGroupClient.getRegionInstanceGroup(instanceGroup.toString());
+   * }
+   * 
+ * + * @param instanceGroup Name of the instance group resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroup getRegionInstanceGroup(String instanceGroup) { + + GetRegionInstanceGroupHttpRequest request = + GetRegionInstanceGroupHttpRequest.newBuilder().setInstanceGroup(instanceGroup).build(); + return getRegionInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance group resource. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   GetRegionInstanceGroupHttpRequest request = GetRegionInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .build();
+   *   InstanceGroup response = regionInstanceGroupClient.getRegionInstanceGroup(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroup getRegionInstanceGroup(GetRegionInstanceGroupHttpRequest request) { + return getRegionInstanceGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified instance group resource. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   GetRegionInstanceGroupHttpRequest request = GetRegionInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .build();
+   *   ApiFuture<InstanceGroup> future = regionInstanceGroupClient.getRegionInstanceGroupCallable().futureCall(request);
+   *   // Do something
+   *   InstanceGroup response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getRegionInstanceGroupCallable() { + return stub.getRegionInstanceGroupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance group resources contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (InstanceGroup element : regionInstanceGroupClient.listRegionInstanceGroups(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionInstanceGroupsPagedResponse listRegionInstanceGroups( + ProjectRegionName region) { + ListRegionInstanceGroupsHttpRequest request = + ListRegionInstanceGroupsHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listRegionInstanceGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance group resources contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (InstanceGroup element : regionInstanceGroupClient.listRegionInstanceGroups(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionInstanceGroupsPagedResponse listRegionInstanceGroups(String region) { + ListRegionInstanceGroupsHttpRequest request = + ListRegionInstanceGroupsHttpRequest.newBuilder().setRegion(region).build(); + return listRegionInstanceGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance group resources contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionInstanceGroupsHttpRequest request = ListRegionInstanceGroupsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (InstanceGroup element : regionInstanceGroupClient.listRegionInstanceGroups(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionInstanceGroupsPagedResponse listRegionInstanceGroups( + ListRegionInstanceGroupsHttpRequest request) { + return listRegionInstanceGroupsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance group resources contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionInstanceGroupsHttpRequest request = ListRegionInstanceGroupsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListRegionInstanceGroupsPagedResponse> future = regionInstanceGroupClient.listRegionInstanceGroupsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InstanceGroup element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListRegionInstanceGroupsHttpRequest, ListRegionInstanceGroupsPagedResponse> + listRegionInstanceGroupsPagedCallable() { + return stub.listRegionInstanceGroupsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of instance group resources contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionInstanceGroupsHttpRequest request = ListRegionInstanceGroupsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     RegionInstanceGroupList response = regionInstanceGroupClient.listRegionInstanceGroupsCallable().call(request);
+   *     for (InstanceGroup element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionInstanceGroupsCallable() { + return stub.listRegionInstanceGroupsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the specified instance group and displays information about the named + * ports. Depending on the specified options, this method can list all instances or only the + * instances that are running. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource = RegionInstanceGroupsListInstancesRequest.newBuilder().build();
+   *   for (InstanceWithNamedPorts element : regionInstanceGroupClient.listInstancesRegionInstanceGroups(instanceGroup, regionInstanceGroupsListInstancesRequestResource).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param instanceGroup Name of the regional instance group for which we want to list the + * instances. + * @param regionInstanceGroupsListInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstancesRegionInstanceGroupsPagedResponse listInstancesRegionInstanceGroups( + ProjectRegionInstanceGroupName instanceGroup, + RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource) { + ListInstancesRegionInstanceGroupsHttpRequest request = + ListInstancesRegionInstanceGroupsHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup == null ? null : instanceGroup.toString()) + .setRegionInstanceGroupsListInstancesRequestResource( + regionInstanceGroupsListInstancesRequestResource) + .build(); + return listInstancesRegionInstanceGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the specified instance group and displays information about the named + * ports. Depending on the specified options, this method can list all instances or only the + * instances that are running. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource = RegionInstanceGroupsListInstancesRequest.newBuilder().build();
+   *   for (InstanceWithNamedPorts element : regionInstanceGroupClient.listInstancesRegionInstanceGroups(instanceGroup.toString(), regionInstanceGroupsListInstancesRequestResource).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param instanceGroup Name of the regional instance group for which we want to list the + * instances. + * @param regionInstanceGroupsListInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstancesRegionInstanceGroupsPagedResponse listInstancesRegionInstanceGroups( + String instanceGroup, + RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource) { + ListInstancesRegionInstanceGroupsHttpRequest request = + ListInstancesRegionInstanceGroupsHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup) + .setRegionInstanceGroupsListInstancesRequestResource( + regionInstanceGroupsListInstancesRequestResource) + .build(); + return listInstancesRegionInstanceGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the specified instance group and displays information about the named + * ports. Depending on the specified options, this method can list all instances or only the + * instances that are running. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource = RegionInstanceGroupsListInstancesRequest.newBuilder().build();
+   *   ListInstancesRegionInstanceGroupsHttpRequest request = ListInstancesRegionInstanceGroupsHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setRegionInstanceGroupsListInstancesRequestResource(regionInstanceGroupsListInstancesRequestResource)
+   *     .build();
+   *   for (InstanceWithNamedPorts element : regionInstanceGroupClient.listInstancesRegionInstanceGroups(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListInstancesRegionInstanceGroupsPagedResponse listInstancesRegionInstanceGroups( + ListInstancesRegionInstanceGroupsHttpRequest request) { + return listInstancesRegionInstanceGroupsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the specified instance group and displays information about the named + * ports. Depending on the specified options, this method can list all instances or only the + * instances that are running. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource = RegionInstanceGroupsListInstancesRequest.newBuilder().build();
+   *   ListInstancesRegionInstanceGroupsHttpRequest request = ListInstancesRegionInstanceGroupsHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setRegionInstanceGroupsListInstancesRequestResource(regionInstanceGroupsListInstancesRequestResource)
+   *     .build();
+   *   ApiFuture<ListInstancesRegionInstanceGroupsPagedResponse> future = regionInstanceGroupClient.listInstancesRegionInstanceGroupsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InstanceWithNamedPorts element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListInstancesRegionInstanceGroupsHttpRequest, + ListInstancesRegionInstanceGroupsPagedResponse> + listInstancesRegionInstanceGroupsPagedCallable() { + return stub.listInstancesRegionInstanceGroupsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the specified instance group and displays information about the named + * ports. Depending on the specified options, this method can list all instances or only the + * instances that are running. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource = RegionInstanceGroupsListInstancesRequest.newBuilder().build();
+   *   ListInstancesRegionInstanceGroupsHttpRequest request = ListInstancesRegionInstanceGroupsHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setRegionInstanceGroupsListInstancesRequestResource(regionInstanceGroupsListInstancesRequestResource)
+   *     .build();
+   *   while (true) {
+   *     RegionInstanceGroupsListInstances response = regionInstanceGroupClient.listInstancesRegionInstanceGroupsCallable().call(request);
+   *     for (InstanceWithNamedPorts element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances> + listInstancesRegionInstanceGroupsCallable() { + return stub.listInstancesRegionInstanceGroupsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the named ports for the specified regional instance group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   RegionInstanceGroupsSetNamedPortsRequest regionInstanceGroupsSetNamedPortsRequestResource = RegionInstanceGroupsSetNamedPortsRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupClient.setNamedPortsRegionInstanceGroup(instanceGroup, regionInstanceGroupsSetNamedPortsRequestResource);
+   * }
+   * 
+ * + * @param instanceGroup The name of the regional instance group where the named ports are updated. + * @param regionInstanceGroupsSetNamedPortsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setNamedPortsRegionInstanceGroup( + ProjectRegionInstanceGroupName instanceGroup, + RegionInstanceGroupsSetNamedPortsRequest regionInstanceGroupsSetNamedPortsRequestResource) { + + SetNamedPortsRegionInstanceGroupHttpRequest request = + SetNamedPortsRegionInstanceGroupHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup == null ? null : instanceGroup.toString()) + .setRegionInstanceGroupsSetNamedPortsRequestResource( + regionInstanceGroupsSetNamedPortsRequestResource) + .build(); + return setNamedPortsRegionInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the named ports for the specified regional instance group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   RegionInstanceGroupsSetNamedPortsRequest regionInstanceGroupsSetNamedPortsRequestResource = RegionInstanceGroupsSetNamedPortsRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupClient.setNamedPortsRegionInstanceGroup(instanceGroup.toString(), regionInstanceGroupsSetNamedPortsRequestResource);
+   * }
+   * 
+ * + * @param instanceGroup The name of the regional instance group where the named ports are updated. + * @param regionInstanceGroupsSetNamedPortsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setNamedPortsRegionInstanceGroup( + String instanceGroup, + RegionInstanceGroupsSetNamedPortsRequest regionInstanceGroupsSetNamedPortsRequestResource) { + + SetNamedPortsRegionInstanceGroupHttpRequest request = + SetNamedPortsRegionInstanceGroupHttpRequest.newBuilder() + .setInstanceGroup(instanceGroup) + .setRegionInstanceGroupsSetNamedPortsRequestResource( + regionInstanceGroupsSetNamedPortsRequestResource) + .build(); + return setNamedPortsRegionInstanceGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the named ports for the specified regional instance group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   RegionInstanceGroupsSetNamedPortsRequest regionInstanceGroupsSetNamedPortsRequestResource = RegionInstanceGroupsSetNamedPortsRequest.newBuilder().build();
+   *   SetNamedPortsRegionInstanceGroupHttpRequest request = SetNamedPortsRegionInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setRegionInstanceGroupsSetNamedPortsRequestResource(regionInstanceGroupsSetNamedPortsRequestResource)
+   *     .build();
+   *   Operation response = regionInstanceGroupClient.setNamedPortsRegionInstanceGroup(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setNamedPortsRegionInstanceGroup( + SetNamedPortsRegionInstanceGroupHttpRequest request) { + return setNamedPortsRegionInstanceGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the named ports for the specified regional instance group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+   *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+   *   RegionInstanceGroupsSetNamedPortsRequest regionInstanceGroupsSetNamedPortsRequestResource = RegionInstanceGroupsSetNamedPortsRequest.newBuilder().build();
+   *   SetNamedPortsRegionInstanceGroupHttpRequest request = SetNamedPortsRegionInstanceGroupHttpRequest.newBuilder()
+   *     .setInstanceGroup(instanceGroup.toString())
+   *     .setRegionInstanceGroupsSetNamedPortsRequestResource(regionInstanceGroupsSetNamedPortsRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionInstanceGroupClient.setNamedPortsRegionInstanceGroupCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setNamedPortsRegionInstanceGroupCallable() { + return stub.setNamedPortsRegionInstanceGroupCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListRegionInstanceGroupsPagedResponse + extends AbstractPagedListResponse< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, InstanceGroup, + ListRegionInstanceGroupsPage, ListRegionInstanceGroupsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRegionInstanceGroupsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListRegionInstanceGroupsPagedResponse apply(ListRegionInstanceGroupsPage input) { + return new ListRegionInstanceGroupsPagedResponse(input); + } + }); + } + + private ListRegionInstanceGroupsPagedResponse(ListRegionInstanceGroupsPage page) { + super(page, ListRegionInstanceGroupsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRegionInstanceGroupsPage + extends AbstractPage< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, InstanceGroup, + ListRegionInstanceGroupsPage> { + + private ListRegionInstanceGroupsPage( + PageContext + context, + RegionInstanceGroupList response) { + super(context, response); + } + + private static ListRegionInstanceGroupsPage createEmptyPage() { + return new ListRegionInstanceGroupsPage(null, null); + } + + @Override + protected ListRegionInstanceGroupsPage createPage( + PageContext + context, + RegionInstanceGroupList response) { + return new ListRegionInstanceGroupsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRegionInstanceGroupsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, InstanceGroup, + ListRegionInstanceGroupsPage, ListRegionInstanceGroupsFixedSizeCollection> { + + private ListRegionInstanceGroupsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRegionInstanceGroupsFixedSizeCollection createEmptyCollection() { + return new ListRegionInstanceGroupsFixedSizeCollection(null, 0); + } + + @Override + protected ListRegionInstanceGroupsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRegionInstanceGroupsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListInstancesRegionInstanceGroupsPagedResponse + extends AbstractPagedListResponse< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + InstanceWithNamedPorts, ListInstancesRegionInstanceGroupsPage, + ListInstancesRegionInstanceGroupsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + InstanceWithNamedPorts> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListInstancesRegionInstanceGroupsPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + ListInstancesRegionInstanceGroupsPage, + ListInstancesRegionInstanceGroupsPagedResponse>() { + @Override + public ListInstancesRegionInstanceGroupsPagedResponse apply( + ListInstancesRegionInstanceGroupsPage input) { + return new ListInstancesRegionInstanceGroupsPagedResponse(input); + } + }); + } + + private ListInstancesRegionInstanceGroupsPagedResponse( + ListInstancesRegionInstanceGroupsPage page) { + super(page, ListInstancesRegionInstanceGroupsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListInstancesRegionInstanceGroupsPage + extends AbstractPage< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + InstanceWithNamedPorts, ListInstancesRegionInstanceGroupsPage> { + + private ListInstancesRegionInstanceGroupsPage( + PageContext< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + InstanceWithNamedPorts> + context, + RegionInstanceGroupsListInstances response) { + super(context, response); + } + + private static ListInstancesRegionInstanceGroupsPage createEmptyPage() { + return new ListInstancesRegionInstanceGroupsPage(null, null); + } + + @Override + protected ListInstancesRegionInstanceGroupsPage createPage( + PageContext< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + InstanceWithNamedPorts> + context, + RegionInstanceGroupsListInstances response) { + return new ListInstancesRegionInstanceGroupsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + InstanceWithNamedPorts> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListInstancesRegionInstanceGroupsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + InstanceWithNamedPorts, ListInstancesRegionInstanceGroupsPage, + ListInstancesRegionInstanceGroupsFixedSizeCollection> { + + private ListInstancesRegionInstanceGroupsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListInstancesRegionInstanceGroupsFixedSizeCollection createEmptyCollection() { + return new ListInstancesRegionInstanceGroupsFixedSizeCollection(null, 0); + } + + @Override + protected ListInstancesRegionInstanceGroupsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListInstancesRegionInstanceGroupsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupList.java new file mode 100644 index 000000000000..b86404389c2c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionInstanceGroupList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private RegionInstanceGroupList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private RegionInstanceGroupList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionInstanceGroupList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionInstanceGroupList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionInstanceGroupList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionInstanceGroupList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(RegionInstanceGroupList other) { + if (other == RegionInstanceGroupList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(RegionInstanceGroupList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(InstanceGroup items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public RegionInstanceGroupList build() { + + return new RegionInstanceGroupList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionInstanceGroupList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionInstanceGroupList) { + RegionInstanceGroupList that = (RegionInstanceGroupList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerClient.java new file mode 100644 index 000000000000..9ec4e4d39af4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerClient.java @@ -0,0 +1,1774 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.RegionInstanceGroupManagerStub; +import com.google.cloud.compute.v1.stub.RegionInstanceGroupManagerStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+ *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+ *   RegionInstanceGroupManagersAbandonInstancesRequest regionInstanceGroupManagersAbandonInstancesRequestResource = RegionInstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+ *   Operation response = regionInstanceGroupManagerClient.abandonInstancesRegionInstanceGroupManager(instanceGroupManager, regionInstanceGroupManagersAbandonInstancesRequestResource);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the regionInstanceGroupManagerClient object to clean up + * resources such as threads. In the example above, try-with-resources is used, which automatically + * calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of + * RegionInstanceGroupManagerSettings to create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * RegionInstanceGroupManagerSettings regionInstanceGroupManagerSettings =
+ *     RegionInstanceGroupManagerSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * RegionInstanceGroupManagerClient regionInstanceGroupManagerClient =
+ *     RegionInstanceGroupManagerClient.create(regionInstanceGroupManagerSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * RegionInstanceGroupManagerSettings regionInstanceGroupManagerSettings =
+ *     RegionInstanceGroupManagerSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RegionInstanceGroupManagerClient regionInstanceGroupManagerClient =
+ *     RegionInstanceGroupManagerClient.create(regionInstanceGroupManagerSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionInstanceGroupManagerClient implements BackgroundResource { + private final RegionInstanceGroupManagerSettings settings; + private final RegionInstanceGroupManagerStub stub; + + /** Constructs an instance of RegionInstanceGroupManagerClient with default settings. */ + public static final RegionInstanceGroupManagerClient create() throws IOException { + return create(RegionInstanceGroupManagerSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RegionInstanceGroupManagerClient, using the given settings. The + * channels are created based on the settings passed in, or defaults for any settings that are not + * set. + */ + public static final RegionInstanceGroupManagerClient create( + RegionInstanceGroupManagerSettings settings) throws IOException { + return new RegionInstanceGroupManagerClient(settings); + } + + /** + * Constructs an instance of RegionInstanceGroupManagerClient, using the given stub for making + * calls. This is for advanced usage - prefer to use RegionInstanceGroupManagerSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final RegionInstanceGroupManagerClient create(RegionInstanceGroupManagerStub stub) { + return new RegionInstanceGroupManagerClient(stub); + } + + /** + * Constructs an instance of RegionInstanceGroupManagerClient, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected RegionInstanceGroupManagerClient(RegionInstanceGroupManagerSettings settings) + throws IOException { + this.settings = settings; + this.stub = ((RegionInstanceGroupManagerStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected RegionInstanceGroupManagerClient(RegionInstanceGroupManagerStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RegionInstanceGroupManagerSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionInstanceGroupManagerStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to remove the specified instances from the managed instance group. + * Abandoning an instance does not delete the instance, but it does remove the instance from any + * target pools that are applied by the managed instance group. This method reduces the targetSize + * of the managed instance group by the number of instances that you abandon. This operation is + * marked as DONE when the action is scheduled even if the instances have not yet been removed + * from the group. You must separately verify the status of the abandoning action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersAbandonInstancesRequest regionInstanceGroupManagersAbandonInstancesRequestResource = RegionInstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.abandonInstancesRegionInstanceGroupManager(instanceGroupManager, regionInstanceGroupManagersAbandonInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group. + * @param regionInstanceGroupManagersAbandonInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation abandonInstancesRegionInstanceGroupManager( + ProjectRegionInstanceGroupManagerName instanceGroupManager, + RegionInstanceGroupManagersAbandonInstancesRequest + regionInstanceGroupManagersAbandonInstancesRequestResource) { + + AbandonInstancesRegionInstanceGroupManagerHttpRequest request = + AbandonInstancesRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .setRegionInstanceGroupManagersAbandonInstancesRequestResource( + regionInstanceGroupManagersAbandonInstancesRequestResource) + .build(); + return abandonInstancesRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to remove the specified instances from the managed instance group. + * Abandoning an instance does not delete the instance, but it does remove the instance from any + * target pools that are applied by the managed instance group. This method reduces the targetSize + * of the managed instance group by the number of instances that you abandon. This operation is + * marked as DONE when the action is scheduled even if the instances have not yet been removed + * from the group. You must separately verify the status of the abandoning action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersAbandonInstancesRequest regionInstanceGroupManagersAbandonInstancesRequestResource = RegionInstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.abandonInstancesRegionInstanceGroupManager(instanceGroupManager.toString(), regionInstanceGroupManagersAbandonInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group. + * @param regionInstanceGroupManagersAbandonInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation abandonInstancesRegionInstanceGroupManager( + String instanceGroupManager, + RegionInstanceGroupManagersAbandonInstancesRequest + regionInstanceGroupManagersAbandonInstancesRequestResource) { + + AbandonInstancesRegionInstanceGroupManagerHttpRequest request = + AbandonInstancesRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setRegionInstanceGroupManagersAbandonInstancesRequestResource( + regionInstanceGroupManagersAbandonInstancesRequestResource) + .build(); + return abandonInstancesRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to remove the specified instances from the managed instance group. + * Abandoning an instance does not delete the instance, but it does remove the instance from any + * target pools that are applied by the managed instance group. This method reduces the targetSize + * of the managed instance group by the number of instances that you abandon. This operation is + * marked as DONE when the action is scheduled even if the instances have not yet been removed + * from the group. You must separately verify the status of the abandoning action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersAbandonInstancesRequest regionInstanceGroupManagersAbandonInstancesRequestResource = RegionInstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+   *   AbandonInstancesRegionInstanceGroupManagerHttpRequest request = AbandonInstancesRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setRegionInstanceGroupManagersAbandonInstancesRequestResource(regionInstanceGroupManagersAbandonInstancesRequestResource)
+   *     .build();
+   *   Operation response = regionInstanceGroupManagerClient.abandonInstancesRegionInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation abandonInstancesRegionInstanceGroupManager( + AbandonInstancesRegionInstanceGroupManagerHttpRequest request) { + return abandonInstancesRegionInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to remove the specified instances from the managed instance group. + * Abandoning an instance does not delete the instance, but it does remove the instance from any + * target pools that are applied by the managed instance group. This method reduces the targetSize + * of the managed instance group by the number of instances that you abandon. This operation is + * marked as DONE when the action is scheduled even if the instances have not yet been removed + * from the group. You must separately verify the status of the abandoning action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersAbandonInstancesRequest regionInstanceGroupManagersAbandonInstancesRequestResource = RegionInstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+   *   AbandonInstancesRegionInstanceGroupManagerHttpRequest request = AbandonInstancesRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setRegionInstanceGroupManagersAbandonInstancesRequestResource(regionInstanceGroupManagersAbandonInstancesRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionInstanceGroupManagerClient.abandonInstancesRegionInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + abandonInstancesRegionInstanceGroupManagerCallable() { + return stub.abandonInstancesRegionInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified managed instance group and all of the instances in that group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   Operation response = regionInstanceGroupManagerClient.deleteRegionInstanceGroupManager(instanceGroupManager);
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionInstanceGroupManager( + ProjectRegionInstanceGroupManagerName instanceGroupManager) { + + DeleteRegionInstanceGroupManagerHttpRequest request = + DeleteRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .build(); + return deleteRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified managed instance group and all of the instances in that group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   Operation response = regionInstanceGroupManagerClient.deleteRegionInstanceGroupManager(instanceGroupManager.toString());
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionInstanceGroupManager(String instanceGroupManager) { + + DeleteRegionInstanceGroupManagerHttpRequest request = + DeleteRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .build(); + return deleteRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified managed instance group and all of the instances in that group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   DeleteRegionInstanceGroupManagerHttpRequest request = DeleteRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   Operation response = regionInstanceGroupManagerClient.deleteRegionInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRegionInstanceGroupManager( + DeleteRegionInstanceGroupManagerHttpRequest request) { + return deleteRegionInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified managed instance group and all of the instances in that group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   DeleteRegionInstanceGroupManagerHttpRequest request = DeleteRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = regionInstanceGroupManagerClient.deleteRegionInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteRegionInstanceGroupManagerCallable() { + return stub.deleteRegionInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to delete the specified instances in the managed instance group. The + * instances are also removed from any target pools of which they were a member. This method + * reduces the targetSize of the managed instance group by the number of instances that you + * delete. This operation is marked as DONE when the action is scheduled even if the instances are + * still being deleted. You must separately verify the status of the deleting action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersDeleteInstancesRequest regionInstanceGroupManagersDeleteInstancesRequestResource = RegionInstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.deleteInstancesRegionInstanceGroupManager(instanceGroupManager, regionInstanceGroupManagersDeleteInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group. + * @param regionInstanceGroupManagersDeleteInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstancesRegionInstanceGroupManager( + ProjectRegionInstanceGroupManagerName instanceGroupManager, + RegionInstanceGroupManagersDeleteInstancesRequest + regionInstanceGroupManagersDeleteInstancesRequestResource) { + + DeleteInstancesRegionInstanceGroupManagerHttpRequest request = + DeleteInstancesRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .setRegionInstanceGroupManagersDeleteInstancesRequestResource( + regionInstanceGroupManagersDeleteInstancesRequestResource) + .build(); + return deleteInstancesRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to delete the specified instances in the managed instance group. The + * instances are also removed from any target pools of which they were a member. This method + * reduces the targetSize of the managed instance group by the number of instances that you + * delete. This operation is marked as DONE when the action is scheduled even if the instances are + * still being deleted. You must separately verify the status of the deleting action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersDeleteInstancesRequest regionInstanceGroupManagersDeleteInstancesRequestResource = RegionInstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.deleteInstancesRegionInstanceGroupManager(instanceGroupManager.toString(), regionInstanceGroupManagersDeleteInstancesRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group. + * @param regionInstanceGroupManagersDeleteInstancesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstancesRegionInstanceGroupManager( + String instanceGroupManager, + RegionInstanceGroupManagersDeleteInstancesRequest + regionInstanceGroupManagersDeleteInstancesRequestResource) { + + DeleteInstancesRegionInstanceGroupManagerHttpRequest request = + DeleteInstancesRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setRegionInstanceGroupManagersDeleteInstancesRequestResource( + regionInstanceGroupManagersDeleteInstancesRequestResource) + .build(); + return deleteInstancesRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to delete the specified instances in the managed instance group. The + * instances are also removed from any target pools of which they were a member. This method + * reduces the targetSize of the managed instance group by the number of instances that you + * delete. This operation is marked as DONE when the action is scheduled even if the instances are + * still being deleted. You must separately verify the status of the deleting action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersDeleteInstancesRequest regionInstanceGroupManagersDeleteInstancesRequestResource = RegionInstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
+   *   DeleteInstancesRegionInstanceGroupManagerHttpRequest request = DeleteInstancesRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setRegionInstanceGroupManagersDeleteInstancesRequestResource(regionInstanceGroupManagersDeleteInstancesRequestResource)
+   *     .build();
+   *   Operation response = regionInstanceGroupManagerClient.deleteInstancesRegionInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteInstancesRegionInstanceGroupManager( + DeleteInstancesRegionInstanceGroupManagerHttpRequest request) { + return deleteInstancesRegionInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to delete the specified instances in the managed instance group. The + * instances are also removed from any target pools of which they were a member. This method + * reduces the targetSize of the managed instance group by the number of instances that you + * delete. This operation is marked as DONE when the action is scheduled even if the instances are + * still being deleted. You must separately verify the status of the deleting action with the + * listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersDeleteInstancesRequest regionInstanceGroupManagersDeleteInstancesRequestResource = RegionInstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
+   *   DeleteInstancesRegionInstanceGroupManagerHttpRequest request = DeleteInstancesRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setRegionInstanceGroupManagersDeleteInstancesRequestResource(regionInstanceGroupManagersDeleteInstancesRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionInstanceGroupManagerClient.deleteInstancesRegionInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteInstancesRegionInstanceGroupManagerCallable() { + return stub.deleteInstancesRegionInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns all of the details about the specified managed instance group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManager response = regionInstanceGroupManagerClient.getRegionInstanceGroupManager(instanceGroupManager);
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroupManager getRegionInstanceGroupManager( + ProjectRegionInstanceGroupManagerName instanceGroupManager) { + + GetRegionInstanceGroupManagerHttpRequest request = + GetRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .build(); + return getRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns all of the details about the specified managed instance group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   InstanceGroupManager response = regionInstanceGroupManagerClient.getRegionInstanceGroupManager(instanceGroupManager.toString());
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroupManager getRegionInstanceGroupManager(String instanceGroupManager) { + + GetRegionInstanceGroupManagerHttpRequest request = + GetRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .build(); + return getRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns all of the details about the specified managed instance group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   GetRegionInstanceGroupManagerHttpRequest request = GetRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   InstanceGroupManager response = regionInstanceGroupManagerClient.getRegionInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final InstanceGroupManager getRegionInstanceGroupManager( + GetRegionInstanceGroupManagerHttpRequest request) { + return getRegionInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns all of the details about the specified managed instance group. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   GetRegionInstanceGroupManagerHttpRequest request = GetRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   ApiFuture<InstanceGroupManager> future = regionInstanceGroupManagerClient.getRegionInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   InstanceGroupManager response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getRegionInstanceGroupManagerCallable() { + return stub.getRegionInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a managed instance group using the information that you specify in the request. After + * the group is created, it schedules an action to create instances in the group using the + * specified instance template. This operation is marked as DONE when the group is created even if + * the instances in the group have not yet been created. You must separately verify the status of + * the individual instances with the listmanagedinstances method. + * + *

A regional managed instance group can contain up to 2000 instances. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.insertRegionInstanceGroupManager(region, instanceGroupManagerResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param instanceGroupManagerResource An Instance Group Manager resource. (== resource_for + * beta.instanceGroupManagers ==) (== resource_for v1.instanceGroupManagers ==) (== + * resource_for beta.regionInstanceGroupManagers ==) (== resource_for + * v1.regionInstanceGroupManagers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionInstanceGroupManager( + ProjectRegionName region, InstanceGroupManager instanceGroupManagerResource) { + + InsertRegionInstanceGroupManagerHttpRequest request = + InsertRegionInstanceGroupManagerHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setInstanceGroupManagerResource(instanceGroupManagerResource) + .build(); + return insertRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a managed instance group using the information that you specify in the request. After + * the group is created, it schedules an action to create instances in the group using the + * specified instance template. This operation is marked as DONE when the group is created even if + * the instances in the group have not yet been created. You must separately verify the status of + * the individual instances with the listmanagedinstances method. + * + *

A regional managed instance group can contain up to 2000 instances. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.insertRegionInstanceGroupManager(region.toString(), instanceGroupManagerResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param instanceGroupManagerResource An Instance Group Manager resource. (== resource_for + * beta.instanceGroupManagers ==) (== resource_for v1.instanceGroupManagers ==) (== + * resource_for beta.regionInstanceGroupManagers ==) (== resource_for + * v1.regionInstanceGroupManagers ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionInstanceGroupManager( + String region, InstanceGroupManager instanceGroupManagerResource) { + + InsertRegionInstanceGroupManagerHttpRequest request = + InsertRegionInstanceGroupManagerHttpRequest.newBuilder() + .setRegion(region) + .setInstanceGroupManagerResource(instanceGroupManagerResource) + .build(); + return insertRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a managed instance group using the information that you specify in the request. After + * the group is created, it schedules an action to create instances in the group using the + * specified instance template. This operation is marked as DONE when the group is created even if + * the instances in the group have not yet been created. You must separately verify the status of + * the individual instances with the listmanagedinstances method. + * + *

A regional managed instance group can contain up to 2000 instances. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
+   *   InsertRegionInstanceGroupManagerHttpRequest request = InsertRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setInstanceGroupManagerResource(instanceGroupManagerResource)
+   *     .build();
+   *   Operation response = regionInstanceGroupManagerClient.insertRegionInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRegionInstanceGroupManager( + InsertRegionInstanceGroupManagerHttpRequest request) { + return insertRegionInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a managed instance group using the information that you specify in the request. After + * the group is created, it schedules an action to create instances in the group using the + * specified instance template. This operation is marked as DONE when the group is created even if + * the instances in the group have not yet been created. You must separately verify the status of + * the individual instances with the listmanagedinstances method. + * + *

A regional managed instance group can contain up to 2000 instances. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
+   *   InsertRegionInstanceGroupManagerHttpRequest request = InsertRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setInstanceGroupManagerResource(instanceGroupManagerResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionInstanceGroupManagerClient.insertRegionInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertRegionInstanceGroupManagerCallable() { + return stub.insertRegionInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of managed instance groups that are contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (InstanceGroupManager element : regionInstanceGroupManagerClient.listRegionInstanceGroupManagers(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionInstanceGroupManagersPagedResponse listRegionInstanceGroupManagers( + ProjectRegionName region) { + ListRegionInstanceGroupManagersHttpRequest request = + ListRegionInstanceGroupManagersHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listRegionInstanceGroupManagers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of managed instance groups that are contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (InstanceGroupManager element : regionInstanceGroupManagerClient.listRegionInstanceGroupManagers(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionInstanceGroupManagersPagedResponse listRegionInstanceGroupManagers( + String region) { + ListRegionInstanceGroupManagersHttpRequest request = + ListRegionInstanceGroupManagersHttpRequest.newBuilder().setRegion(region).build(); + return listRegionInstanceGroupManagers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of managed instance groups that are contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionInstanceGroupManagersHttpRequest request = ListRegionInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (InstanceGroupManager element : regionInstanceGroupManagerClient.listRegionInstanceGroupManagers(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionInstanceGroupManagersPagedResponse listRegionInstanceGroupManagers( + ListRegionInstanceGroupManagersHttpRequest request) { + return listRegionInstanceGroupManagersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of managed instance groups that are contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionInstanceGroupManagersHttpRequest request = ListRegionInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListRegionInstanceGroupManagersPagedResponse> future = regionInstanceGroupManagerClient.listRegionInstanceGroupManagersPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (InstanceGroupManager element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListRegionInstanceGroupManagersHttpRequest, ListRegionInstanceGroupManagersPagedResponse> + listRegionInstanceGroupManagersPagedCallable() { + return stub.listRegionInstanceGroupManagersPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of managed instance groups that are contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionInstanceGroupManagersHttpRequest request = ListRegionInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     RegionInstanceGroupManagerList response = regionInstanceGroupManagerClient.listRegionInstanceGroupManagersCallable().call(request);
+   *     for (InstanceGroupManager element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList> + listRegionInstanceGroupManagersCallable() { + return stub.listRegionInstanceGroupManagersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the managed instance group and instances that are scheduled to be + * created. The list includes any current actions that the group has scheduled for its instances. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersListInstancesResponse response = regionInstanceGroupManagerClient.listManagedInstancesRegionInstanceGroupManagers(instanceGroupManager);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final RegionInstanceGroupManagersListInstancesResponse + listManagedInstancesRegionInstanceGroupManagers( + ProjectRegionInstanceGroupManagerName instanceGroupManager) { + + ListManagedInstancesRegionInstanceGroupManagersHttpRequest request = + ListManagedInstancesRegionInstanceGroupManagersHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .build(); + return listManagedInstancesRegionInstanceGroupManagers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the managed instance group and instances that are scheduled to be + * created. The list includes any current actions that the group has scheduled for its instances. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersListInstancesResponse response = regionInstanceGroupManagerClient.listManagedInstancesRegionInstanceGroupManagers(instanceGroupManager.toString());
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final RegionInstanceGroupManagersListInstancesResponse + listManagedInstancesRegionInstanceGroupManagers(String instanceGroupManager) { + + ListManagedInstancesRegionInstanceGroupManagersHttpRequest request = + ListManagedInstancesRegionInstanceGroupManagersHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .build(); + return listManagedInstancesRegionInstanceGroupManagers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the managed instance group and instances that are scheduled to be + * created. The list includes any current actions that the group has scheduled for its instances. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   ListManagedInstancesRegionInstanceGroupManagersHttpRequest request = ListManagedInstancesRegionInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   RegionInstanceGroupManagersListInstancesResponse response = regionInstanceGroupManagerClient.listManagedInstancesRegionInstanceGroupManagers(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final RegionInstanceGroupManagersListInstancesResponse + listManagedInstancesRegionInstanceGroupManagers( + ListManagedInstancesRegionInstanceGroupManagersHttpRequest request) { + return listManagedInstancesRegionInstanceGroupManagersCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the instances in the managed instance group and instances that are scheduled to be + * created. The list includes any current actions that the group has scheduled for its instances. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   ListManagedInstancesRegionInstanceGroupManagersHttpRequest request = ListManagedInstancesRegionInstanceGroupManagersHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   ApiFuture<RegionInstanceGroupManagersListInstancesResponse> future = regionInstanceGroupManagerClient.listManagedInstancesRegionInstanceGroupManagersCallable().futureCall(request);
+   *   // Do something
+   *   RegionInstanceGroupManagersListInstancesResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersCallable() { + return stub.listManagedInstancesRegionInstanceGroupManagersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to recreate the specified instances in the managed instance group. The + * instances are deleted and recreated using the current instance template for the managed + * instance group. This operation is marked as DONE when the action is scheduled even if the + * instances have not yet been recreated. You must separately verify the status of the recreating + * action with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersRecreateRequest regionInstanceGroupManagersRecreateRequestResource = RegionInstanceGroupManagersRecreateRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.recreateInstancesRegionInstanceGroupManager(instanceGroupManager, regionInstanceGroupManagersRecreateRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group. + * @param regionInstanceGroupManagersRecreateRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation recreateInstancesRegionInstanceGroupManager( + ProjectRegionInstanceGroupManagerName instanceGroupManager, + RegionInstanceGroupManagersRecreateRequest + regionInstanceGroupManagersRecreateRequestResource) { + + RecreateInstancesRegionInstanceGroupManagerHttpRequest request = + RecreateInstancesRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .setRegionInstanceGroupManagersRecreateRequestResource( + regionInstanceGroupManagersRecreateRequestResource) + .build(); + return recreateInstancesRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to recreate the specified instances in the managed instance group. The + * instances are deleted and recreated using the current instance template for the managed + * instance group. This operation is marked as DONE when the action is scheduled even if the + * instances have not yet been recreated. You must separately verify the status of the recreating + * action with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersRecreateRequest regionInstanceGroupManagersRecreateRequestResource = RegionInstanceGroupManagersRecreateRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.recreateInstancesRegionInstanceGroupManager(instanceGroupManager.toString(), regionInstanceGroupManagersRecreateRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group. + * @param regionInstanceGroupManagersRecreateRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation recreateInstancesRegionInstanceGroupManager( + String instanceGroupManager, + RegionInstanceGroupManagersRecreateRequest + regionInstanceGroupManagersRecreateRequestResource) { + + RecreateInstancesRegionInstanceGroupManagerHttpRequest request = + RecreateInstancesRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setRegionInstanceGroupManagersRecreateRequestResource( + regionInstanceGroupManagersRecreateRequestResource) + .build(); + return recreateInstancesRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to recreate the specified instances in the managed instance group. The + * instances are deleted and recreated using the current instance template for the managed + * instance group. This operation is marked as DONE when the action is scheduled even if the + * instances have not yet been recreated. You must separately verify the status of the recreating + * action with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersRecreateRequest regionInstanceGroupManagersRecreateRequestResource = RegionInstanceGroupManagersRecreateRequest.newBuilder().build();
+   *   RecreateInstancesRegionInstanceGroupManagerHttpRequest request = RecreateInstancesRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setRegionInstanceGroupManagersRecreateRequestResource(regionInstanceGroupManagersRecreateRequestResource)
+   *     .build();
+   *   Operation response = regionInstanceGroupManagerClient.recreateInstancesRegionInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation recreateInstancesRegionInstanceGroupManager( + RecreateInstancesRegionInstanceGroupManagerHttpRequest request) { + return recreateInstancesRegionInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedules a group action to recreate the specified instances in the managed instance group. The + * instances are deleted and recreated using the current instance template for the managed + * instance group. This operation is marked as DONE when the action is scheduled even if the + * instances have not yet been recreated. You must separately verify the status of the recreating + * action with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

You can specify a maximum of 1000 instances with this method per request. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersRecreateRequest regionInstanceGroupManagersRecreateRequestResource = RegionInstanceGroupManagersRecreateRequest.newBuilder().build();
+   *   RecreateInstancesRegionInstanceGroupManagerHttpRequest request = RecreateInstancesRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setRegionInstanceGroupManagersRecreateRequestResource(regionInstanceGroupManagersRecreateRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionInstanceGroupManagerClient.recreateInstancesRegionInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + recreateInstancesRegionInstanceGroupManagerCallable() { + return stub.recreateInstancesRegionInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the intended size for the managed instance group. If you increase the size, the group + * schedules actions to create new instances using the current instance template. If you decrease + * the size, the group schedules delete actions on one or more instances. The resize operation is + * marked DONE when the resize actions are scheduled even if the group has not yet added or + * deleted any instances. You must separately verify the status of the creating or deleting + * actions with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   Integer size = 0;
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   Operation response = regionInstanceGroupManagerClient.resizeRegionInstanceGroupManager(size, instanceGroupManager);
+   * }
+   * 
+ * + * @param size Number of instances that should exist in this instance group manager. + * @param instanceGroupManager Name of the managed instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeRegionInstanceGroupManager( + Integer size, ProjectRegionInstanceGroupManagerName instanceGroupManager) { + + ResizeRegionInstanceGroupManagerHttpRequest request = + ResizeRegionInstanceGroupManagerHttpRequest.newBuilder() + .setSize(size) + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .build(); + return resizeRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the intended size for the managed instance group. If you increase the size, the group + * schedules actions to create new instances using the current instance template. If you decrease + * the size, the group schedules delete actions on one or more instances. The resize operation is + * marked DONE when the resize actions are scheduled even if the group has not yet added or + * deleted any instances. You must separately verify the status of the creating or deleting + * actions with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   Integer size = 0;
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   Operation response = regionInstanceGroupManagerClient.resizeRegionInstanceGroupManager(size, instanceGroupManager.toString());
+   * }
+   * 
+ * + * @param size Number of instances that should exist in this instance group manager. + * @param instanceGroupManager Name of the managed instance group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeRegionInstanceGroupManager( + Integer size, String instanceGroupManager) { + + ResizeRegionInstanceGroupManagerHttpRequest request = + ResizeRegionInstanceGroupManagerHttpRequest.newBuilder() + .setSize(size) + .setInstanceGroupManager(instanceGroupManager) + .build(); + return resizeRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the intended size for the managed instance group. If you increase the size, the group + * schedules actions to create new instances using the current instance template. If you decrease + * the size, the group schedules delete actions on one or more instances. The resize operation is + * marked DONE when the resize actions are scheduled even if the group has not yet added or + * deleted any instances. You must separately verify the status of the creating or deleting + * actions with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   Integer size = 0;
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   ResizeRegionInstanceGroupManagerHttpRequest request = ResizeRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setSize(size)
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   Operation response = regionInstanceGroupManagerClient.resizeRegionInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation resizeRegionInstanceGroupManager( + ResizeRegionInstanceGroupManagerHttpRequest request) { + return resizeRegionInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the intended size for the managed instance group. If you increase the size, the group + * schedules actions to create new instances using the current instance template. If you decrease + * the size, the group schedules delete actions on one or more instances. The resize operation is + * marked DONE when the resize actions are scheduled even if the group has not yet added or + * deleted any instances. You must separately verify the status of the creating or deleting + * actions with the listmanagedinstances method. + * + *

If the group is part of a backend service that has enabled connection draining, it can take + * up to 60 seconds after the connection draining duration has elapsed before the VM instance is + * removed or deleted. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   Integer size = 0;
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   ResizeRegionInstanceGroupManagerHttpRequest request = ResizeRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setSize(size)
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = regionInstanceGroupManagerClient.resizeRegionInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + resizeRegionInstanceGroupManagerCallable() { + return stub.resizeRegionInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the instance template to use when creating new instances or recreating instances in this + * group. Existing instances are not affected. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersSetTemplateRequest regionInstanceGroupManagersSetTemplateRequestResource = RegionInstanceGroupManagersSetTemplateRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.setInstanceTemplateRegionInstanceGroupManager(instanceGroupManager, regionInstanceGroupManagersSetTemplateRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param regionInstanceGroupManagersSetTemplateRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setInstanceTemplateRegionInstanceGroupManager( + ProjectRegionInstanceGroupManagerName instanceGroupManager, + RegionInstanceGroupManagersSetTemplateRequest + regionInstanceGroupManagersSetTemplateRequestResource) { + + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest request = + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .setRegionInstanceGroupManagersSetTemplateRequestResource( + regionInstanceGroupManagersSetTemplateRequestResource) + .build(); + return setInstanceTemplateRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the instance template to use when creating new instances or recreating instances in this + * group. Existing instances are not affected. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersSetTemplateRequest regionInstanceGroupManagersSetTemplateRequestResource = RegionInstanceGroupManagersSetTemplateRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.setInstanceTemplateRegionInstanceGroupManager(instanceGroupManager.toString(), regionInstanceGroupManagersSetTemplateRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager The name of the managed instance group. + * @param regionInstanceGroupManagersSetTemplateRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setInstanceTemplateRegionInstanceGroupManager( + String instanceGroupManager, + RegionInstanceGroupManagersSetTemplateRequest + regionInstanceGroupManagersSetTemplateRequestResource) { + + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest request = + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setRegionInstanceGroupManagersSetTemplateRequestResource( + regionInstanceGroupManagersSetTemplateRequestResource) + .build(); + return setInstanceTemplateRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the instance template to use when creating new instances or recreating instances in this + * group. Existing instances are not affected. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersSetTemplateRequest regionInstanceGroupManagersSetTemplateRequestResource = RegionInstanceGroupManagersSetTemplateRequest.newBuilder().build();
+   *   SetInstanceTemplateRegionInstanceGroupManagerHttpRequest request = SetInstanceTemplateRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setRegionInstanceGroupManagersSetTemplateRequestResource(regionInstanceGroupManagersSetTemplateRequestResource)
+   *     .build();
+   *   Operation response = regionInstanceGroupManagerClient.setInstanceTemplateRegionInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setInstanceTemplateRegionInstanceGroupManager( + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest request) { + return setInstanceTemplateRegionInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the instance template to use when creating new instances or recreating instances in this + * group. Existing instances are not affected. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersSetTemplateRequest regionInstanceGroupManagersSetTemplateRequestResource = RegionInstanceGroupManagersSetTemplateRequest.newBuilder().build();
+   *   SetInstanceTemplateRegionInstanceGroupManagerHttpRequest request = SetInstanceTemplateRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setRegionInstanceGroupManagersSetTemplateRequestResource(regionInstanceGroupManagersSetTemplateRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionInstanceGroupManagerClient.setInstanceTemplateRegionInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setInstanceTemplateRegionInstanceGroupManagerCallable() { + return stub.setInstanceTemplateRegionInstanceGroupManagerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Modifies the target pools to which all new instances in this group are assigned. Existing + * instances in the group are not affected. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersSetTargetPoolsRequest regionInstanceGroupManagersSetTargetPoolsRequestResource = RegionInstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.setTargetPoolsRegionInstanceGroupManager(instanceGroupManager, regionInstanceGroupManagersSetTargetPoolsRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group. + * @param regionInstanceGroupManagersSetTargetPoolsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetPoolsRegionInstanceGroupManager( + ProjectRegionInstanceGroupManagerName instanceGroupManager, + RegionInstanceGroupManagersSetTargetPoolsRequest + regionInstanceGroupManagersSetTargetPoolsRequestResource) { + + SetTargetPoolsRegionInstanceGroupManagerHttpRequest request = + SetTargetPoolsRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager( + instanceGroupManager == null ? null : instanceGroupManager.toString()) + .setRegionInstanceGroupManagersSetTargetPoolsRequestResource( + regionInstanceGroupManagersSetTargetPoolsRequestResource) + .build(); + return setTargetPoolsRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Modifies the target pools to which all new instances in this group are assigned. Existing + * instances in the group are not affected. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersSetTargetPoolsRequest regionInstanceGroupManagersSetTargetPoolsRequestResource = RegionInstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
+   *   Operation response = regionInstanceGroupManagerClient.setTargetPoolsRegionInstanceGroupManager(instanceGroupManager.toString(), regionInstanceGroupManagersSetTargetPoolsRequestResource);
+   * }
+   * 
+ * + * @param instanceGroupManager Name of the managed instance group. + * @param regionInstanceGroupManagersSetTargetPoolsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetPoolsRegionInstanceGroupManager( + String instanceGroupManager, + RegionInstanceGroupManagersSetTargetPoolsRequest + regionInstanceGroupManagersSetTargetPoolsRequestResource) { + + SetTargetPoolsRegionInstanceGroupManagerHttpRequest request = + SetTargetPoolsRegionInstanceGroupManagerHttpRequest.newBuilder() + .setInstanceGroupManager(instanceGroupManager) + .setRegionInstanceGroupManagersSetTargetPoolsRequestResource( + regionInstanceGroupManagersSetTargetPoolsRequestResource) + .build(); + return setTargetPoolsRegionInstanceGroupManager(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Modifies the target pools to which all new instances in this group are assigned. Existing + * instances in the group are not affected. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersSetTargetPoolsRequest regionInstanceGroupManagersSetTargetPoolsRequestResource = RegionInstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
+   *   SetTargetPoolsRegionInstanceGroupManagerHttpRequest request = SetTargetPoolsRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setRegionInstanceGroupManagersSetTargetPoolsRequestResource(regionInstanceGroupManagersSetTargetPoolsRequestResource)
+   *     .build();
+   *   Operation response = regionInstanceGroupManagerClient.setTargetPoolsRegionInstanceGroupManager(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setTargetPoolsRegionInstanceGroupManager( + SetTargetPoolsRegionInstanceGroupManagerHttpRequest request) { + return setTargetPoolsRegionInstanceGroupManagerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Modifies the target pools to which all new instances in this group are assigned. Existing + * instances in the group are not affected. + * + *

Sample code: + * + *


+   * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+   *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+   *   RegionInstanceGroupManagersSetTargetPoolsRequest regionInstanceGroupManagersSetTargetPoolsRequestResource = RegionInstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
+   *   SetTargetPoolsRegionInstanceGroupManagerHttpRequest request = SetTargetPoolsRegionInstanceGroupManagerHttpRequest.newBuilder()
+   *     .setInstanceGroupManager(instanceGroupManager.toString())
+   *     .setRegionInstanceGroupManagersSetTargetPoolsRequestResource(regionInstanceGroupManagersSetTargetPoolsRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = regionInstanceGroupManagerClient.setTargetPoolsRegionInstanceGroupManagerCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setTargetPoolsRegionInstanceGroupManagerCallable() { + return stub.setTargetPoolsRegionInstanceGroupManagerCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListRegionInstanceGroupManagersPagedResponse + extends AbstractPagedListResponse< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + InstanceGroupManager, ListRegionInstanceGroupManagersPage, + ListRegionInstanceGroupManagersFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + InstanceGroupManager> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRegionInstanceGroupManagersPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + ListRegionInstanceGroupManagersPage, ListRegionInstanceGroupManagersPagedResponse>() { + @Override + public ListRegionInstanceGroupManagersPagedResponse apply( + ListRegionInstanceGroupManagersPage input) { + return new ListRegionInstanceGroupManagersPagedResponse(input); + } + }); + } + + private ListRegionInstanceGroupManagersPagedResponse(ListRegionInstanceGroupManagersPage page) { + super(page, ListRegionInstanceGroupManagersFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRegionInstanceGroupManagersPage + extends AbstractPage< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + InstanceGroupManager, ListRegionInstanceGroupManagersPage> { + + private ListRegionInstanceGroupManagersPage( + PageContext< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + InstanceGroupManager> + context, + RegionInstanceGroupManagerList response) { + super(context, response); + } + + private static ListRegionInstanceGroupManagersPage createEmptyPage() { + return new ListRegionInstanceGroupManagersPage(null, null); + } + + @Override + protected ListRegionInstanceGroupManagersPage createPage( + PageContext< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + InstanceGroupManager> + context, + RegionInstanceGroupManagerList response) { + return new ListRegionInstanceGroupManagersPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + InstanceGroupManager> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRegionInstanceGroupManagersFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + InstanceGroupManager, ListRegionInstanceGroupManagersPage, + ListRegionInstanceGroupManagersFixedSizeCollection> { + + private ListRegionInstanceGroupManagersFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRegionInstanceGroupManagersFixedSizeCollection createEmptyCollection() { + return new ListRegionInstanceGroupManagersFixedSizeCollection(null, 0); + } + + @Override + protected ListRegionInstanceGroupManagersFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRegionInstanceGroupManagersFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerList.java new file mode 100644 index 000000000000..861020ed21e7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionInstanceGroupManagerList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private RegionInstanceGroupManagerList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private RegionInstanceGroupManagerList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionInstanceGroupManagerList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionInstanceGroupManagerList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionInstanceGroupManagerList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionInstanceGroupManagerList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(RegionInstanceGroupManagerList other) { + if (other == RegionInstanceGroupManagerList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(RegionInstanceGroupManagerList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(InstanceGroupManager items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public RegionInstanceGroupManagerList build() { + + return new RegionInstanceGroupManagerList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionInstanceGroupManagerList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionInstanceGroupManagerList) { + RegionInstanceGroupManagerList that = (RegionInstanceGroupManagerList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerSettings.java new file mode 100644 index 000000000000..3644f801038d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerSettings.java @@ -0,0 +1,366 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionInstanceGroupManagerClient.ListRegionInstanceGroupManagersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.RegionInstanceGroupManagerStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionInstanceGroupManagerClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of abandonInstancesRegionInstanceGroupManager to 30 seconds: + * + *

+ * 
+ * RegionInstanceGroupManagerSettings.Builder regionInstanceGroupManagerSettingsBuilder =
+ *     RegionInstanceGroupManagerSettings.newBuilder();
+ * regionInstanceGroupManagerSettingsBuilder.abandonInstancesRegionInstanceGroupManagerSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionInstanceGroupManagerSettings regionInstanceGroupManagerSettings = regionInstanceGroupManagerSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionInstanceGroupManagerSettings + extends ClientSettings { + /** + * Returns the object with the settings used for calls to + * abandonInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings + abandonInstancesRegionInstanceGroupManagerSettings() { + return ((RegionInstanceGroupManagerStubSettings) getStubSettings()) + .abandonInstancesRegionInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to deleteRegionInstanceGroupManager. */ + public UnaryCallSettings + deleteRegionInstanceGroupManagerSettings() { + return ((RegionInstanceGroupManagerStubSettings) getStubSettings()) + .deleteRegionInstanceGroupManagerSettings(); + } + + /** + * Returns the object with the settings used for calls to + * deleteInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings + deleteInstancesRegionInstanceGroupManagerSettings() { + return ((RegionInstanceGroupManagerStubSettings) getStubSettings()) + .deleteInstancesRegionInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to getRegionInstanceGroupManager. */ + public UnaryCallSettings + getRegionInstanceGroupManagerSettings() { + return ((RegionInstanceGroupManagerStubSettings) getStubSettings()) + .getRegionInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to insertRegionInstanceGroupManager. */ + public UnaryCallSettings + insertRegionInstanceGroupManagerSettings() { + return ((RegionInstanceGroupManagerStubSettings) getStubSettings()) + .insertRegionInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to listRegionInstanceGroupManagers. */ + public PagedCallSettings< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + ListRegionInstanceGroupManagersPagedResponse> + listRegionInstanceGroupManagersSettings() { + return ((RegionInstanceGroupManagerStubSettings) getStubSettings()) + .listRegionInstanceGroupManagersSettings(); + } + + /** + * Returns the object with the settings used for calls to + * listManagedInstancesRegionInstanceGroupManagers. + */ + public UnaryCallSettings< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersSettings() { + return ((RegionInstanceGroupManagerStubSettings) getStubSettings()) + .listManagedInstancesRegionInstanceGroupManagersSettings(); + } + + /** + * Returns the object with the settings used for calls to + * recreateInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings + recreateInstancesRegionInstanceGroupManagerSettings() { + return ((RegionInstanceGroupManagerStubSettings) getStubSettings()) + .recreateInstancesRegionInstanceGroupManagerSettings(); + } + + /** Returns the object with the settings used for calls to resizeRegionInstanceGroupManager. */ + public UnaryCallSettings + resizeRegionInstanceGroupManagerSettings() { + return ((RegionInstanceGroupManagerStubSettings) getStubSettings()) + .resizeRegionInstanceGroupManagerSettings(); + } + + /** + * Returns the object with the settings used for calls to + * setInstanceTemplateRegionInstanceGroupManager. + */ + public UnaryCallSettings + setInstanceTemplateRegionInstanceGroupManagerSettings() { + return ((RegionInstanceGroupManagerStubSettings) getStubSettings()) + .setInstanceTemplateRegionInstanceGroupManagerSettings(); + } + + /** + * Returns the object with the settings used for calls to + * setTargetPoolsRegionInstanceGroupManager. + */ + public UnaryCallSettings + setTargetPoolsRegionInstanceGroupManagerSettings() { + return ((RegionInstanceGroupManagerStubSettings) getStubSettings()) + .setTargetPoolsRegionInstanceGroupManagerSettings(); + } + + public static final RegionInstanceGroupManagerSettings create( + RegionInstanceGroupManagerStubSettings stub) throws IOException { + return new RegionInstanceGroupManagerSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return RegionInstanceGroupManagerStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return RegionInstanceGroupManagerStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return RegionInstanceGroupManagerStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return RegionInstanceGroupManagerStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return RegionInstanceGroupManagerStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return RegionInstanceGroupManagerStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return RegionInstanceGroupManagerStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return RegionInstanceGroupManagerStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionInstanceGroupManagerSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for RegionInstanceGroupManagerSettings. */ + public static class Builder + extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(RegionInstanceGroupManagerStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(RegionInstanceGroupManagerStubSettings.newBuilder()); + } + + protected Builder(RegionInstanceGroupManagerSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(RegionInstanceGroupManagerStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public RegionInstanceGroupManagerStubSettings.Builder getStubSettingsBuilder() { + return ((RegionInstanceGroupManagerStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** + * Returns the builder for the settings used for calls to + * abandonInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings.Builder< + AbandonInstancesRegionInstanceGroupManagerHttpRequest, Operation> + abandonInstancesRegionInstanceGroupManagerSettings() { + return getStubSettingsBuilder().abandonInstancesRegionInstanceGroupManagerSettings(); + } + + /** Returns the builder for the settings used for calls to deleteRegionInstanceGroupManager. */ + public UnaryCallSettings.Builder + deleteRegionInstanceGroupManagerSettings() { + return getStubSettingsBuilder().deleteRegionInstanceGroupManagerSettings(); + } + + /** + * Returns the builder for the settings used for calls to + * deleteInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings.Builder< + DeleteInstancesRegionInstanceGroupManagerHttpRequest, Operation> + deleteInstancesRegionInstanceGroupManagerSettings() { + return getStubSettingsBuilder().deleteInstancesRegionInstanceGroupManagerSettings(); + } + + /** Returns the builder for the settings used for calls to getRegionInstanceGroupManager. */ + public UnaryCallSettings.Builder + getRegionInstanceGroupManagerSettings() { + return getStubSettingsBuilder().getRegionInstanceGroupManagerSettings(); + } + + /** Returns the builder for the settings used for calls to insertRegionInstanceGroupManager. */ + public UnaryCallSettings.Builder + insertRegionInstanceGroupManagerSettings() { + return getStubSettingsBuilder().insertRegionInstanceGroupManagerSettings(); + } + + /** Returns the builder for the settings used for calls to listRegionInstanceGroupManagers. */ + public PagedCallSettings.Builder< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + ListRegionInstanceGroupManagersPagedResponse> + listRegionInstanceGroupManagersSettings() { + return getStubSettingsBuilder().listRegionInstanceGroupManagersSettings(); + } + + /** + * Returns the builder for the settings used for calls to + * listManagedInstancesRegionInstanceGroupManagers. + */ + public UnaryCallSettings.Builder< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersSettings() { + return getStubSettingsBuilder().listManagedInstancesRegionInstanceGroupManagersSettings(); + } + + /** + * Returns the builder for the settings used for calls to + * recreateInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings.Builder< + RecreateInstancesRegionInstanceGroupManagerHttpRequest, Operation> + recreateInstancesRegionInstanceGroupManagerSettings() { + return getStubSettingsBuilder().recreateInstancesRegionInstanceGroupManagerSettings(); + } + + /** Returns the builder for the settings used for calls to resizeRegionInstanceGroupManager. */ + public UnaryCallSettings.Builder + resizeRegionInstanceGroupManagerSettings() { + return getStubSettingsBuilder().resizeRegionInstanceGroupManagerSettings(); + } + + /** + * Returns the builder for the settings used for calls to + * setInstanceTemplateRegionInstanceGroupManager. + */ + public UnaryCallSettings.Builder< + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest, Operation> + setInstanceTemplateRegionInstanceGroupManagerSettings() { + return getStubSettingsBuilder().setInstanceTemplateRegionInstanceGroupManagerSettings(); + } + + /** + * Returns the builder for the settings used for calls to + * setTargetPoolsRegionInstanceGroupManager. + */ + public UnaryCallSettings.Builder + setTargetPoolsRegionInstanceGroupManagerSettings() { + return getStubSettingsBuilder().setTargetPoolsRegionInstanceGroupManagerSettings(); + } + + @Override + public RegionInstanceGroupManagerSettings build() throws IOException { + return new RegionInstanceGroupManagerSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersAbandonInstancesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersAbandonInstancesRequest.java new file mode 100644 index 000000000000..87956be472c0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersAbandonInstancesRequest.java @@ -0,0 +1,153 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionInstanceGroupManagersAbandonInstancesRequest implements ApiMessage { + private final List instances; + + private RegionInstanceGroupManagersAbandonInstancesRequest() { + this.instances = null; + } + + private RegionInstanceGroupManagersAbandonInstancesRequest(List instances) { + this.instances = instances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instances")) { + return instances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstancesList() { + return instances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionInstanceGroupManagersAbandonInstancesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionInstanceGroupManagersAbandonInstancesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionInstanceGroupManagersAbandonInstancesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionInstanceGroupManagersAbandonInstancesRequest(); + } + + public static class Builder { + private List instances; + + Builder() {} + + public Builder mergeFrom(RegionInstanceGroupManagersAbandonInstancesRequest other) { + if (other == RegionInstanceGroupManagersAbandonInstancesRequest.getDefaultInstance()) + return this; + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + return this; + } + + Builder(RegionInstanceGroupManagersAbandonInstancesRequest source) { + this.instances = source.instances; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(String instances) { + this.instances.add(instances); + return this; + } + + public RegionInstanceGroupManagersAbandonInstancesRequest build() { + return new RegionInstanceGroupManagersAbandonInstancesRequest(instances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstances(this.instances); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionInstanceGroupManagersAbandonInstancesRequest{" + "instances=" + instances + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionInstanceGroupManagersAbandonInstancesRequest) { + RegionInstanceGroupManagersAbandonInstancesRequest that = + (RegionInstanceGroupManagersAbandonInstancesRequest) o; + return Objects.equals(this.instances, that.getInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersDeleteInstancesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersDeleteInstancesRequest.java new file mode 100644 index 000000000000..a4b32543c022 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersDeleteInstancesRequest.java @@ -0,0 +1,153 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionInstanceGroupManagersDeleteInstancesRequest implements ApiMessage { + private final List instances; + + private RegionInstanceGroupManagersDeleteInstancesRequest() { + this.instances = null; + } + + private RegionInstanceGroupManagersDeleteInstancesRequest(List instances) { + this.instances = instances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instances")) { + return instances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstancesList() { + return instances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionInstanceGroupManagersDeleteInstancesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionInstanceGroupManagersDeleteInstancesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionInstanceGroupManagersDeleteInstancesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionInstanceGroupManagersDeleteInstancesRequest(); + } + + public static class Builder { + private List instances; + + Builder() {} + + public Builder mergeFrom(RegionInstanceGroupManagersDeleteInstancesRequest other) { + if (other == RegionInstanceGroupManagersDeleteInstancesRequest.getDefaultInstance()) + return this; + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + return this; + } + + Builder(RegionInstanceGroupManagersDeleteInstancesRequest source) { + this.instances = source.instances; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(String instances) { + this.instances.add(instances); + return this; + } + + public RegionInstanceGroupManagersDeleteInstancesRequest build() { + return new RegionInstanceGroupManagersDeleteInstancesRequest(instances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstances(this.instances); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionInstanceGroupManagersDeleteInstancesRequest{" + "instances=" + instances + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionInstanceGroupManagersDeleteInstancesRequest) { + RegionInstanceGroupManagersDeleteInstancesRequest that = + (RegionInstanceGroupManagersDeleteInstancesRequest) o; + return Objects.equals(this.instances, that.getInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersListInstancesResponse.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersListInstancesResponse.java new file mode 100644 index 000000000000..4ae23bf6b182 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersListInstancesResponse.java @@ -0,0 +1,156 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionInstanceGroupManagersListInstancesResponse implements ApiMessage { + private final List managedInstances; + + private RegionInstanceGroupManagersListInstancesResponse() { + this.managedInstances = null; + } + + private RegionInstanceGroupManagersListInstancesResponse(List managedInstances) { + this.managedInstances = managedInstances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("managedInstances")) { + return managedInstances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getManagedInstancesList() { + return managedInstances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionInstanceGroupManagersListInstancesResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionInstanceGroupManagersListInstancesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionInstanceGroupManagersListInstancesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionInstanceGroupManagersListInstancesResponse(); + } + + public static class Builder { + private List managedInstances; + + Builder() {} + + public Builder mergeFrom(RegionInstanceGroupManagersListInstancesResponse other) { + if (other == RegionInstanceGroupManagersListInstancesResponse.getDefaultInstance()) + return this; + if (other.getManagedInstancesList() != null) { + this.managedInstances = other.managedInstances; + } + return this; + } + + Builder(RegionInstanceGroupManagersListInstancesResponse source) { + this.managedInstances = source.managedInstances; + } + + public List getManagedInstancesList() { + return managedInstances; + } + + public Builder addAllManagedInstances(List managedInstances) { + if (this.managedInstances == null) { + this.managedInstances = new ArrayList<>(managedInstances.size()); + } + this.managedInstances.addAll(managedInstances); + return this; + } + + public Builder addManagedInstances(ManagedInstance managedInstances) { + this.managedInstances.add(managedInstances); + return this; + } + + public RegionInstanceGroupManagersListInstancesResponse build() { + return new RegionInstanceGroupManagersListInstancesResponse(managedInstances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllManagedInstances(this.managedInstances); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionInstanceGroupManagersListInstancesResponse{" + + "managedInstances=" + + managedInstances + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionInstanceGroupManagersListInstancesResponse) { + RegionInstanceGroupManagersListInstancesResponse that = + (RegionInstanceGroupManagersListInstancesResponse) o; + return Objects.equals(this.managedInstances, that.getManagedInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(managedInstances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersRecreateRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersRecreateRequest.java new file mode 100644 index 000000000000..ba1241f5c9ea --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersRecreateRequest.java @@ -0,0 +1,152 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionInstanceGroupManagersRecreateRequest implements ApiMessage { + private final List instances; + + private RegionInstanceGroupManagersRecreateRequest() { + this.instances = null; + } + + private RegionInstanceGroupManagersRecreateRequest(List instances) { + this.instances = instances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instances")) { + return instances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstancesList() { + return instances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionInstanceGroupManagersRecreateRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionInstanceGroupManagersRecreateRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionInstanceGroupManagersRecreateRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionInstanceGroupManagersRecreateRequest(); + } + + public static class Builder { + private List instances; + + Builder() {} + + public Builder mergeFrom(RegionInstanceGroupManagersRecreateRequest other) { + if (other == RegionInstanceGroupManagersRecreateRequest.getDefaultInstance()) return this; + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + return this; + } + + Builder(RegionInstanceGroupManagersRecreateRequest source) { + this.instances = source.instances; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(String instances) { + this.instances.add(instances); + return this; + } + + public RegionInstanceGroupManagersRecreateRequest build() { + return new RegionInstanceGroupManagersRecreateRequest(instances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstances(this.instances); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionInstanceGroupManagersRecreateRequest{" + "instances=" + instances + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionInstanceGroupManagersRecreateRequest) { + RegionInstanceGroupManagersRecreateRequest that = + (RegionInstanceGroupManagersRecreateRequest) o; + return Objects.equals(this.instances, that.getInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersSetTargetPoolsRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersSetTargetPoolsRequest.java new file mode 100644 index 000000000000..e855cb402ec3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersSetTargetPoolsRequest.java @@ -0,0 +1,187 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionInstanceGroupManagersSetTargetPoolsRequest implements ApiMessage { + private final String fingerprint; + private final List targetPools; + + private RegionInstanceGroupManagersSetTargetPoolsRequest() { + this.fingerprint = null; + this.targetPools = null; + } + + private RegionInstanceGroupManagersSetTargetPoolsRequest( + String fingerprint, List targetPools) { + this.fingerprint = fingerprint; + this.targetPools = targetPools; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("targetPools")) { + return targetPools; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getFingerprint() { + return fingerprint; + } + + public List getTargetPoolsList() { + return targetPools; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionInstanceGroupManagersSetTargetPoolsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionInstanceGroupManagersSetTargetPoolsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionInstanceGroupManagersSetTargetPoolsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionInstanceGroupManagersSetTargetPoolsRequest(); + } + + public static class Builder { + private String fingerprint; + private List targetPools; + + Builder() {} + + public Builder mergeFrom(RegionInstanceGroupManagersSetTargetPoolsRequest other) { + if (other == RegionInstanceGroupManagersSetTargetPoolsRequest.getDefaultInstance()) + return this; + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getTargetPoolsList() != null) { + this.targetPools = other.targetPools; + } + return this; + } + + Builder(RegionInstanceGroupManagersSetTargetPoolsRequest source) { + this.fingerprint = source.fingerprint; + this.targetPools = source.targetPools; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public List getTargetPoolsList() { + return targetPools; + } + + public Builder addAllTargetPools(List targetPools) { + if (this.targetPools == null) { + this.targetPools = new ArrayList<>(targetPools.size()); + } + this.targetPools.addAll(targetPools); + return this; + } + + public Builder addTargetPools(String targetPools) { + this.targetPools.add(targetPools); + return this; + } + + public RegionInstanceGroupManagersSetTargetPoolsRequest build() { + + return new RegionInstanceGroupManagersSetTargetPoolsRequest(fingerprint, targetPools); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.addAllTargetPools(this.targetPools); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionInstanceGroupManagersSetTargetPoolsRequest{" + + "fingerprint=" + + fingerprint + + ", " + + "targetPools=" + + targetPools + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionInstanceGroupManagersSetTargetPoolsRequest) { + RegionInstanceGroupManagersSetTargetPoolsRequest that = + (RegionInstanceGroupManagersSetTargetPoolsRequest) o; + return Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.targetPools, that.getTargetPoolsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(fingerprint, targetPools); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersSetTemplateRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersSetTemplateRequest.java new file mode 100644 index 000000000000..5529a711192c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagersSetTemplateRequest.java @@ -0,0 +1,146 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionInstanceGroupManagersSetTemplateRequest implements ApiMessage { + private final String instanceTemplate; + + private RegionInstanceGroupManagersSetTemplateRequest() { + this.instanceTemplate = null; + } + + private RegionInstanceGroupManagersSetTemplateRequest(String instanceTemplate) { + this.instanceTemplate = instanceTemplate; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instanceTemplate")) { + return instanceTemplate; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionInstanceGroupManagersSetTemplateRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionInstanceGroupManagersSetTemplateRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionInstanceGroupManagersSetTemplateRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionInstanceGroupManagersSetTemplateRequest(); + } + + public static class Builder { + private String instanceTemplate; + + Builder() {} + + public Builder mergeFrom(RegionInstanceGroupManagersSetTemplateRequest other) { + if (other == RegionInstanceGroupManagersSetTemplateRequest.getDefaultInstance()) return this; + if (other.getInstanceTemplate() != null) { + this.instanceTemplate = other.instanceTemplate; + } + return this; + } + + Builder(RegionInstanceGroupManagersSetTemplateRequest source) { + this.instanceTemplate = source.instanceTemplate; + } + + public String getInstanceTemplate() { + return instanceTemplate; + } + + public Builder setInstanceTemplate(String instanceTemplate) { + this.instanceTemplate = instanceTemplate; + return this; + } + + public RegionInstanceGroupManagersSetTemplateRequest build() { + return new RegionInstanceGroupManagersSetTemplateRequest(instanceTemplate); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setInstanceTemplate(this.instanceTemplate); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionInstanceGroupManagersSetTemplateRequest{" + + "instanceTemplate=" + + instanceTemplate + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionInstanceGroupManagersSetTemplateRequest) { + RegionInstanceGroupManagersSetTemplateRequest that = + (RegionInstanceGroupManagersSetTemplateRequest) o; + return Objects.equals(this.instanceTemplate, that.getInstanceTemplate()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instanceTemplate); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupSettings.java new file mode 100644 index 000000000000..19585b0215a1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupSettings.java @@ -0,0 +1,232 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionInstanceGroupClient.ListInstancesRegionInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.RegionInstanceGroupClient.ListRegionInstanceGroupsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.RegionInstanceGroupStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionInstanceGroupClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getRegionInstanceGroup to 30 seconds: + * + *

+ * 
+ * RegionInstanceGroupSettings.Builder regionInstanceGroupSettingsBuilder =
+ *     RegionInstanceGroupSettings.newBuilder();
+ * regionInstanceGroupSettingsBuilder.getRegionInstanceGroupSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionInstanceGroupSettings regionInstanceGroupSettings = regionInstanceGroupSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionInstanceGroupSettings extends ClientSettings { + /** Returns the object with the settings used for calls to getRegionInstanceGroup. */ + public UnaryCallSettings + getRegionInstanceGroupSettings() { + return ((RegionInstanceGroupStubSettings) getStubSettings()).getRegionInstanceGroupSettings(); + } + + /** Returns the object with the settings used for calls to listRegionInstanceGroups. */ + public PagedCallSettings< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, + ListRegionInstanceGroupsPagedResponse> + listRegionInstanceGroupsSettings() { + return ((RegionInstanceGroupStubSettings) getStubSettings()).listRegionInstanceGroupsSettings(); + } + + /** Returns the object with the settings used for calls to listInstancesRegionInstanceGroups. */ + public PagedCallSettings< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + ListInstancesRegionInstanceGroupsPagedResponse> + listInstancesRegionInstanceGroupsSettings() { + return ((RegionInstanceGroupStubSettings) getStubSettings()) + .listInstancesRegionInstanceGroupsSettings(); + } + + /** Returns the object with the settings used for calls to setNamedPortsRegionInstanceGroup. */ + public UnaryCallSettings + setNamedPortsRegionInstanceGroupSettings() { + return ((RegionInstanceGroupStubSettings) getStubSettings()) + .setNamedPortsRegionInstanceGroupSettings(); + } + + public static final RegionInstanceGroupSettings create(RegionInstanceGroupStubSettings stub) + throws IOException { + return new RegionInstanceGroupSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return RegionInstanceGroupStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return RegionInstanceGroupStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return RegionInstanceGroupStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return RegionInstanceGroupStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return RegionInstanceGroupStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return RegionInstanceGroupStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return RegionInstanceGroupStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return RegionInstanceGroupStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionInstanceGroupSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for RegionInstanceGroupSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(RegionInstanceGroupStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(RegionInstanceGroupStubSettings.newBuilder()); + } + + protected Builder(RegionInstanceGroupSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(RegionInstanceGroupStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public RegionInstanceGroupStubSettings.Builder getStubSettingsBuilder() { + return ((RegionInstanceGroupStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to getRegionInstanceGroup. */ + public UnaryCallSettings.Builder + getRegionInstanceGroupSettings() { + return getStubSettingsBuilder().getRegionInstanceGroupSettings(); + } + + /** Returns the builder for the settings used for calls to listRegionInstanceGroups. */ + public PagedCallSettings.Builder< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, + ListRegionInstanceGroupsPagedResponse> + listRegionInstanceGroupsSettings() { + return getStubSettingsBuilder().listRegionInstanceGroupsSettings(); + } + + /** Returns the builder for the settings used for calls to listInstancesRegionInstanceGroups. */ + public PagedCallSettings.Builder< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + ListInstancesRegionInstanceGroupsPagedResponse> + listInstancesRegionInstanceGroupsSettings() { + return getStubSettingsBuilder().listInstancesRegionInstanceGroupsSettings(); + } + + /** Returns the builder for the settings used for calls to setNamedPortsRegionInstanceGroup. */ + public UnaryCallSettings.Builder + setNamedPortsRegionInstanceGroupSettings() { + return getStubSettingsBuilder().setNamedPortsRegionInstanceGroupSettings(); + } + + @Override + public RegionInstanceGroupSettings build() throws IOException { + return new RegionInstanceGroupSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupsListInstances.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupsListInstances.java new file mode 100644 index 000000000000..e97ad0a481a8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupsListInstances.java @@ -0,0 +1,307 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionInstanceGroupsListInstances implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private RegionInstanceGroupsListInstances() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private RegionInstanceGroupsListInstances( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionInstanceGroupsListInstances prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionInstanceGroupsListInstances getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionInstanceGroupsListInstances DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionInstanceGroupsListInstances(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(RegionInstanceGroupsListInstances other) { + if (other == RegionInstanceGroupsListInstances.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(RegionInstanceGroupsListInstances source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(InstanceWithNamedPorts items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public RegionInstanceGroupsListInstances build() { + + return new RegionInstanceGroupsListInstances( + id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionInstanceGroupsListInstances{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionInstanceGroupsListInstances) { + RegionInstanceGroupsListInstances that = (RegionInstanceGroupsListInstances) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupsListInstancesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupsListInstancesRequest.java new file mode 100644 index 000000000000..fa62768f170b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupsListInstancesRequest.java @@ -0,0 +1,175 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionInstanceGroupsListInstancesRequest implements ApiMessage { + private final String instanceState; + private final String portName; + + private RegionInstanceGroupsListInstancesRequest() { + this.instanceState = null; + this.portName = null; + } + + private RegionInstanceGroupsListInstancesRequest(String instanceState, String portName) { + this.instanceState = instanceState; + this.portName = portName; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instanceState")) { + return instanceState; + } + if (fieldName.equals("portName")) { + return portName; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getInstanceState() { + return instanceState; + } + + public String getPortName() { + return portName; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionInstanceGroupsListInstancesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionInstanceGroupsListInstancesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionInstanceGroupsListInstancesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionInstanceGroupsListInstancesRequest(); + } + + public static class Builder { + private String instanceState; + private String portName; + + Builder() {} + + public Builder mergeFrom(RegionInstanceGroupsListInstancesRequest other) { + if (other == RegionInstanceGroupsListInstancesRequest.getDefaultInstance()) return this; + if (other.getInstanceState() != null) { + this.instanceState = other.instanceState; + } + if (other.getPortName() != null) { + this.portName = other.portName; + } + return this; + } + + Builder(RegionInstanceGroupsListInstancesRequest source) { + this.instanceState = source.instanceState; + this.portName = source.portName; + } + + public String getInstanceState() { + return instanceState; + } + + public Builder setInstanceState(String instanceState) { + this.instanceState = instanceState; + return this; + } + + public String getPortName() { + return portName; + } + + public Builder setPortName(String portName) { + this.portName = portName; + return this; + } + + public RegionInstanceGroupsListInstancesRequest build() { + + return new RegionInstanceGroupsListInstancesRequest(instanceState, portName); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setInstanceState(this.instanceState); + newBuilder.setPortName(this.portName); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionInstanceGroupsListInstancesRequest{" + + "instanceState=" + + instanceState + + ", " + + "portName=" + + portName + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionInstanceGroupsListInstancesRequest) { + RegionInstanceGroupsListInstancesRequest that = (RegionInstanceGroupsListInstancesRequest) o; + return Objects.equals(this.instanceState, that.getInstanceState()) + && Objects.equals(this.portName, that.getPortName()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instanceState, portName); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupsSetNamedPortsRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupsSetNamedPortsRequest.java new file mode 100644 index 000000000000..8e609e19ef37 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupsSetNamedPortsRequest.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionInstanceGroupsSetNamedPortsRequest implements ApiMessage { + private final String fingerprint; + private final List namedPorts; + + private RegionInstanceGroupsSetNamedPortsRequest() { + this.fingerprint = null; + this.namedPorts = null; + } + + private RegionInstanceGroupsSetNamedPortsRequest(String fingerprint, List namedPorts) { + this.fingerprint = fingerprint; + this.namedPorts = namedPorts; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("namedPorts")) { + return namedPorts; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getFingerprint() { + return fingerprint; + } + + public List getNamedPortsList() { + return namedPorts; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionInstanceGroupsSetNamedPortsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionInstanceGroupsSetNamedPortsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionInstanceGroupsSetNamedPortsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionInstanceGroupsSetNamedPortsRequest(); + } + + public static class Builder { + private String fingerprint; + private List namedPorts; + + Builder() {} + + public Builder mergeFrom(RegionInstanceGroupsSetNamedPortsRequest other) { + if (other == RegionInstanceGroupsSetNamedPortsRequest.getDefaultInstance()) return this; + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getNamedPortsList() != null) { + this.namedPorts = other.namedPorts; + } + return this; + } + + Builder(RegionInstanceGroupsSetNamedPortsRequest source) { + this.fingerprint = source.fingerprint; + this.namedPorts = source.namedPorts; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public List getNamedPortsList() { + return namedPorts; + } + + public Builder addAllNamedPorts(List namedPorts) { + if (this.namedPorts == null) { + this.namedPorts = new ArrayList<>(namedPorts.size()); + } + this.namedPorts.addAll(namedPorts); + return this; + } + + public Builder addNamedPorts(NamedPort namedPorts) { + this.namedPorts.add(namedPorts); + return this; + } + + public RegionInstanceGroupsSetNamedPortsRequest build() { + + return new RegionInstanceGroupsSetNamedPortsRequest(fingerprint, namedPorts); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.addAllNamedPorts(this.namedPorts); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionInstanceGroupsSetNamedPortsRequest{" + + "fingerprint=" + + fingerprint + + ", " + + "namedPorts=" + + namedPorts + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionInstanceGroupsSetNamedPortsRequest) { + RegionInstanceGroupsSetNamedPortsRequest that = (RegionInstanceGroupsSetNamedPortsRequest) o; + return Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.namedPorts, that.getNamedPortsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(fingerprint, namedPorts); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionList.java new file mode 100644 index 000000000000..083b4ad7f70b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private RegionList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private RegionList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(RegionList other) { + if (other == RegionList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(RegionList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Region items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public RegionList build() { + + return new RegionList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionList) { + RegionList that = (RegionList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionOperationClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionOperationClient.java new file mode 100644 index 000000000000..104d8fe56914 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionOperationClient.java @@ -0,0 +1,594 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.RegionOperationStub; +import com.google.cloud.compute.v1.stub.RegionOperationStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+ *   ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
+ *   regionOperationClient.deleteRegionOperation(operation);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the regionOperationClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of RegionOperationSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * RegionOperationSettings regionOperationSettings =
+ *     RegionOperationSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * RegionOperationClient regionOperationClient =
+ *     RegionOperationClient.create(regionOperationSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * RegionOperationSettings regionOperationSettings =
+ *     RegionOperationSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RegionOperationClient regionOperationClient =
+ *     RegionOperationClient.create(regionOperationSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionOperationClient implements BackgroundResource { + private final RegionOperationSettings settings; + private final RegionOperationStub stub; + + /** Constructs an instance of RegionOperationClient with default settings. */ + public static final RegionOperationClient create() throws IOException { + return create(RegionOperationSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RegionOperationClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final RegionOperationClient create(RegionOperationSettings settings) + throws IOException { + return new RegionOperationClient(settings); + } + + /** + * Constructs an instance of RegionOperationClient, using the given stub for making calls. This is + * for advanced usage - prefer to use RegionOperationSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final RegionOperationClient create(RegionOperationStub stub) { + return new RegionOperationClient(stub); + } + + /** + * Constructs an instance of RegionOperationClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected RegionOperationClient(RegionOperationSettings settings) throws IOException { + this.settings = settings; + this.stub = ((RegionOperationStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected RegionOperationClient(RegionOperationStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RegionOperationSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionOperationStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified region-specific Operations resource. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
+   *   regionOperationClient.deleteRegionOperation(operation);
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final void deleteRegionOperation(ProjectRegionOperationName operation) { + + DeleteRegionOperationHttpRequest request = + DeleteRegionOperationHttpRequest.newBuilder() + .setOperation(operation == null ? null : operation.toString()) + .build(); + deleteRegionOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified region-specific Operations resource. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
+   *   regionOperationClient.deleteRegionOperation(operation.toString());
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final void deleteRegionOperation(String operation) { + + DeleteRegionOperationHttpRequest request = + DeleteRegionOperationHttpRequest.newBuilder().setOperation(operation).build(); + deleteRegionOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified region-specific Operations resource. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
+   *   DeleteRegionOperationHttpRequest request = DeleteRegionOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   regionOperationClient.deleteRegionOperation(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final void deleteRegionOperation(DeleteRegionOperationHttpRequest request) { + deleteRegionOperationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified region-specific Operations resource. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
+   *   DeleteRegionOperationHttpRequest request = DeleteRegionOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   ApiFuture<Void> future = regionOperationClient.deleteRegionOperationCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteRegionOperationCallable() { + return stub.deleteRegionOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified region-specific Operations resource. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
+   *   Operation response = regionOperationClient.getRegionOperation(operation);
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation getRegionOperation(ProjectRegionOperationName operation) { + + GetRegionOperationHttpRequest request = + GetRegionOperationHttpRequest.newBuilder() + .setOperation(operation == null ? null : operation.toString()) + .build(); + return getRegionOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified region-specific Operations resource. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
+   *   Operation response = regionOperationClient.getRegionOperation(operation.toString());
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation getRegionOperation(String operation) { + + GetRegionOperationHttpRequest request = + GetRegionOperationHttpRequest.newBuilder().setOperation(operation).build(); + return getRegionOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified region-specific Operations resource. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
+   *   GetRegionOperationHttpRequest request = GetRegionOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   Operation response = regionOperationClient.getRegionOperation(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation getRegionOperation(GetRegionOperationHttpRequest request) { + return getRegionOperationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified region-specific Operations resource. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
+   *   GetRegionOperationHttpRequest request = GetRegionOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = regionOperationClient.getRegionOperationCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getRegionOperationCallable() { + return stub.getRegionOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Operation element : regionOperationClient.listRegionOperations(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionOperationsPagedResponse listRegionOperations(ProjectRegionName region) { + ListRegionOperationsHttpRequest request = + ListRegionOperationsHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listRegionOperations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Operation element : regionOperationClient.listRegionOperations(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionOperationsPagedResponse listRegionOperations(String region) { + ListRegionOperationsHttpRequest request = + ListRegionOperationsHttpRequest.newBuilder().setRegion(region).build(); + return listRegionOperations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionOperationsHttpRequest request = ListRegionOperationsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (Operation element : regionOperationClient.listRegionOperations(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRegionOperationsPagedResponse listRegionOperations( + ListRegionOperationsHttpRequest request) { + return listRegionOperationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionOperationsHttpRequest request = ListRegionOperationsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListRegionOperationsPagedResponse> future = regionOperationClient.listRegionOperationsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Operation element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionOperationsPagedCallable() { + return stub.listRegionOperationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified region. + * + *

Sample code: + * + *


+   * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRegionOperationsHttpRequest request = ListRegionOperationsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     OperationList response = regionOperationClient.listRegionOperationsCallable().call(request);
+   *     for (Operation element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRegionOperationsCallable() { + return stub.listRegionOperationsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListRegionOperationsPagedResponse + extends AbstractPagedListResponse< + ListRegionOperationsHttpRequest, OperationList, Operation, ListRegionOperationsPage, + ListRegionOperationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRegionOperationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListRegionOperationsPagedResponse apply(ListRegionOperationsPage input) { + return new ListRegionOperationsPagedResponse(input); + } + }); + } + + private ListRegionOperationsPagedResponse(ListRegionOperationsPage page) { + super(page, ListRegionOperationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRegionOperationsPage + extends AbstractPage< + ListRegionOperationsHttpRequest, OperationList, Operation, ListRegionOperationsPage> { + + private ListRegionOperationsPage( + PageContext context, + OperationList response) { + super(context, response); + } + + private static ListRegionOperationsPage createEmptyPage() { + return new ListRegionOperationsPage(null, null); + } + + @Override + protected ListRegionOperationsPage createPage( + PageContext context, + OperationList response) { + return new ListRegionOperationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRegionOperationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRegionOperationsHttpRequest, OperationList, Operation, ListRegionOperationsPage, + ListRegionOperationsFixedSizeCollection> { + + private ListRegionOperationsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRegionOperationsFixedSizeCollection createEmptyCollection() { + return new ListRegionOperationsFixedSizeCollection(null, 0); + } + + @Override + protected ListRegionOperationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRegionOperationsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionOperationSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionOperationSettings.java new file mode 100644 index 000000000000..671a0f927720 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionOperationSettings.java @@ -0,0 +1,209 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionOperationClient.ListRegionOperationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.RegionOperationStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionOperationClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteRegionOperation to 30 seconds: + * + *

+ * 
+ * RegionOperationSettings.Builder regionOperationSettingsBuilder =
+ *     RegionOperationSettings.newBuilder();
+ * regionOperationSettingsBuilder.deleteRegionOperationSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionOperationSettings regionOperationSettings = regionOperationSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionOperationSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteRegionOperation. */ + public UnaryCallSettings deleteRegionOperationSettings() { + return ((RegionOperationStubSettings) getStubSettings()).deleteRegionOperationSettings(); + } + + /** Returns the object with the settings used for calls to getRegionOperation. */ + public UnaryCallSettings getRegionOperationSettings() { + return ((RegionOperationStubSettings) getStubSettings()).getRegionOperationSettings(); + } + + /** Returns the object with the settings used for calls to listRegionOperations. */ + public PagedCallSettings< + ListRegionOperationsHttpRequest, OperationList, ListRegionOperationsPagedResponse> + listRegionOperationsSettings() { + return ((RegionOperationStubSettings) getStubSettings()).listRegionOperationsSettings(); + } + + public static final RegionOperationSettings create(RegionOperationStubSettings stub) + throws IOException { + return new RegionOperationSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return RegionOperationStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return RegionOperationStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return RegionOperationStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return RegionOperationStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return RegionOperationStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return RegionOperationStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return RegionOperationStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return RegionOperationStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionOperationSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for RegionOperationSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(RegionOperationStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(RegionOperationStubSettings.newBuilder()); + } + + protected Builder(RegionOperationSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(RegionOperationStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public RegionOperationStubSettings.Builder getStubSettingsBuilder() { + return ((RegionOperationStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteRegionOperation. */ + public UnaryCallSettings.Builder + deleteRegionOperationSettings() { + return getStubSettingsBuilder().deleteRegionOperationSettings(); + } + + /** Returns the builder for the settings used for calls to getRegionOperation. */ + public UnaryCallSettings.Builder + getRegionOperationSettings() { + return getStubSettingsBuilder().getRegionOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listRegionOperations. */ + public PagedCallSettings.Builder< + ListRegionOperationsHttpRequest, OperationList, ListRegionOperationsPagedResponse> + listRegionOperationsSettings() { + return getStubSettingsBuilder().listRegionOperationsSettings(); + } + + @Override + public RegionOperationSettings build() throws IOException { + return new RegionOperationSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionSetLabelsRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionSetLabelsRequest.java new file mode 100644 index 000000000000..d1e38298e6a9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionSetLabelsRequest.java @@ -0,0 +1,176 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RegionSetLabelsRequest implements ApiMessage { + private final String labelFingerprint; + private final Map labels; + + private RegionSetLabelsRequest() { + this.labelFingerprint = null; + this.labels = null; + } + + private RegionSetLabelsRequest(String labelFingerprint, Map labels) { + this.labelFingerprint = labelFingerprint; + this.labels = labels; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("labelFingerprint")) { + return labelFingerprint; + } + if (fieldName.equals("labels")) { + return labels; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Map getLabelsMap() { + return labels; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RegionSetLabelsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RegionSetLabelsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RegionSetLabelsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RegionSetLabelsRequest(); + } + + public static class Builder { + private String labelFingerprint; + private Map labels; + + Builder() {} + + public Builder mergeFrom(RegionSetLabelsRequest other) { + if (other == RegionSetLabelsRequest.getDefaultInstance()) return this; + if (other.getLabelFingerprint() != null) { + this.labelFingerprint = other.labelFingerprint; + } + if (other.getLabelsMap() != null) { + this.labels = other.labels; + } + return this; + } + + Builder(RegionSetLabelsRequest source) { + this.labelFingerprint = source.labelFingerprint; + this.labels = source.labels; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Builder setLabelFingerprint(String labelFingerprint) { + this.labelFingerprint = labelFingerprint; + return this; + } + + public Map getLabelsMap() { + return labels; + } + + public Builder putAllLabels(Map labels) { + this.labels = labels; + return this; + } + + public RegionSetLabelsRequest build() { + + return new RegionSetLabelsRequest(labelFingerprint, labels); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setLabelFingerprint(this.labelFingerprint); + newBuilder.putAllLabels(this.labels); + return newBuilder; + } + } + + @Override + public String toString() { + return "RegionSetLabelsRequest{" + + "labelFingerprint=" + + labelFingerprint + + ", " + + "labels=" + + labels + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RegionSetLabelsRequest) { + RegionSetLabelsRequest that = (RegionSetLabelsRequest) o; + return Objects.equals(this.labelFingerprint, that.getLabelFingerprint()) + && Objects.equals(this.labels, that.getLabelsMap()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(labelFingerprint, labels); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionSettings.java new file mode 100644 index 000000000000..051ae55f6d1f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionSettings.java @@ -0,0 +1,194 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionClient.ListRegionsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.RegionStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getRegion to 30 seconds: + * + *

+ * 
+ * RegionSettings.Builder regionSettingsBuilder =
+ *     RegionSettings.newBuilder();
+ * regionSettingsBuilder.getRegionSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionSettings regionSettings = regionSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionSettings extends ClientSettings { + /** Returns the object with the settings used for calls to getRegion. */ + public UnaryCallSettings getRegionSettings() { + return ((RegionStubSettings) getStubSettings()).getRegionSettings(); + } + + /** Returns the object with the settings used for calls to listRegions. */ + public PagedCallSettings + listRegionsSettings() { + return ((RegionStubSettings) getStubSettings()).listRegionsSettings(); + } + + public static final RegionSettings create(RegionStubSettings stub) throws IOException { + return new RegionSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return RegionStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return RegionStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return RegionStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return RegionStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return RegionStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return RegionStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return RegionStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return RegionStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for RegionSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(RegionStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(RegionStubSettings.newBuilder()); + } + + protected Builder(RegionSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(RegionStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public RegionStubSettings.Builder getStubSettingsBuilder() { + return ((RegionStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to getRegion. */ + public UnaryCallSettings.Builder getRegionSettings() { + return getStubSettingsBuilder().getRegionSettings(); + } + + /** Returns the builder for the settings used for calls to listRegions. */ + public PagedCallSettings.Builder + listRegionsSettings() { + return getStubSettingsBuilder().listRegionsSettings(); + } + + @Override + public RegionSettings build() throws IOException { + return new RegionSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemoveHealthCheckTargetPoolHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemoveHealthCheckTargetPoolHttpRequest.java new file mode 100644 index 000000000000..9e372429acbd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemoveHealthCheckTargetPoolHttpRequest.java @@ -0,0 +1,452 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RemoveHealthCheckTargetPoolHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetPool; + private final TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource; + private final String userIp; + + private RemoveHealthCheckTargetPoolHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetPool = null; + this.targetPoolsRemoveHealthCheckRequestResource = null; + this.userIp = null; + } + + private RemoveHealthCheckTargetPoolHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetPool, + TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetPool = targetPool; + this.targetPoolsRemoveHealthCheckRequestResource = targetPoolsRemoveHealthCheckRequestResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetPool")) { + return targetPool; + } + if (fieldName.equals("targetPoolsRemoveHealthCheckRequestResource")) { + return targetPoolsRemoveHealthCheckRequestResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetPoolsRemoveHealthCheckRequest getApiMessageRequestBody() { + return targetPoolsRemoveHealthCheckRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetPool() { + return targetPool; + } + + public TargetPoolsRemoveHealthCheckRequest getTargetPoolsRemoveHealthCheckRequestResource() { + return targetPoolsRemoveHealthCheckRequestResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RemoveHealthCheckTargetPoolHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RemoveHealthCheckTargetPoolHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RemoveHealthCheckTargetPoolHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RemoveHealthCheckTargetPoolHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetPool; + private TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(RemoveHealthCheckTargetPoolHttpRequest other) { + if (other == RemoveHealthCheckTargetPoolHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetPool() != null) { + this.targetPool = other.targetPool; + } + if (other.getTargetPoolsRemoveHealthCheckRequestResource() != null) { + this.targetPoolsRemoveHealthCheckRequestResource = + other.targetPoolsRemoveHealthCheckRequestResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(RemoveHealthCheckTargetPoolHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetPool = source.targetPool; + this.targetPoolsRemoveHealthCheckRequestResource = + source.targetPoolsRemoveHealthCheckRequestResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetPool() { + return targetPool; + } + + public Builder setTargetPool(String targetPool) { + this.targetPool = targetPool; + return this; + } + + public TargetPoolsRemoveHealthCheckRequest getTargetPoolsRemoveHealthCheckRequestResource() { + return targetPoolsRemoveHealthCheckRequestResource; + } + + public Builder setTargetPoolsRemoveHealthCheckRequestResource( + TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource) { + this.targetPoolsRemoveHealthCheckRequestResource = + targetPoolsRemoveHealthCheckRequestResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public RemoveHealthCheckTargetPoolHttpRequest build() { + String missing = ""; + + if (targetPool == null) { + missing += " targetPool"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new RemoveHealthCheckTargetPoolHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetPool, + targetPoolsRemoveHealthCheckRequestResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetPool(this.targetPool); + newBuilder.setTargetPoolsRemoveHealthCheckRequestResource( + this.targetPoolsRemoveHealthCheckRequestResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "RemoveHealthCheckTargetPoolHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetPool=" + + targetPool + + ", " + + "targetPoolsRemoveHealthCheckRequestResource=" + + targetPoolsRemoveHealthCheckRequestResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RemoveHealthCheckTargetPoolHttpRequest) { + RemoveHealthCheckTargetPoolHttpRequest that = (RemoveHealthCheckTargetPoolHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetPool, that.getTargetPool()) + && Objects.equals( + this.targetPoolsRemoveHealthCheckRequestResource, + that.getTargetPoolsRemoveHealthCheckRequestResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetPool, + targetPoolsRemoveHealthCheckRequestResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemoveInstanceTargetPoolHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemoveInstanceTargetPoolHttpRequest.java new file mode 100644 index 000000000000..6459033db189 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemoveInstanceTargetPoolHttpRequest.java @@ -0,0 +1,451 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RemoveInstanceTargetPoolHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetPool; + private final TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource; + private final String userIp; + + private RemoveInstanceTargetPoolHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetPool = null; + this.targetPoolsRemoveInstanceRequestResource = null; + this.userIp = null; + } + + private RemoveInstanceTargetPoolHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetPool, + TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetPool = targetPool; + this.targetPoolsRemoveInstanceRequestResource = targetPoolsRemoveInstanceRequestResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetPool")) { + return targetPool; + } + if (fieldName.equals("targetPoolsRemoveInstanceRequestResource")) { + return targetPoolsRemoveInstanceRequestResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetPoolsRemoveInstanceRequest getApiMessageRequestBody() { + return targetPoolsRemoveInstanceRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetPool() { + return targetPool; + } + + public TargetPoolsRemoveInstanceRequest getTargetPoolsRemoveInstanceRequestResource() { + return targetPoolsRemoveInstanceRequestResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RemoveInstanceTargetPoolHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RemoveInstanceTargetPoolHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RemoveInstanceTargetPoolHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RemoveInstanceTargetPoolHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetPool; + private TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(RemoveInstanceTargetPoolHttpRequest other) { + if (other == RemoveInstanceTargetPoolHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetPool() != null) { + this.targetPool = other.targetPool; + } + if (other.getTargetPoolsRemoveInstanceRequestResource() != null) { + this.targetPoolsRemoveInstanceRequestResource = + other.targetPoolsRemoveInstanceRequestResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(RemoveInstanceTargetPoolHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetPool = source.targetPool; + this.targetPoolsRemoveInstanceRequestResource = + source.targetPoolsRemoveInstanceRequestResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetPool() { + return targetPool; + } + + public Builder setTargetPool(String targetPool) { + this.targetPool = targetPool; + return this; + } + + public TargetPoolsRemoveInstanceRequest getTargetPoolsRemoveInstanceRequestResource() { + return targetPoolsRemoveInstanceRequestResource; + } + + public Builder setTargetPoolsRemoveInstanceRequestResource( + TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource) { + this.targetPoolsRemoveInstanceRequestResource = targetPoolsRemoveInstanceRequestResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public RemoveInstanceTargetPoolHttpRequest build() { + String missing = ""; + + if (targetPool == null) { + missing += " targetPool"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new RemoveInstanceTargetPoolHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetPool, + targetPoolsRemoveInstanceRequestResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetPool(this.targetPool); + newBuilder.setTargetPoolsRemoveInstanceRequestResource( + this.targetPoolsRemoveInstanceRequestResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "RemoveInstanceTargetPoolHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetPool=" + + targetPool + + ", " + + "targetPoolsRemoveInstanceRequestResource=" + + targetPoolsRemoveInstanceRequestResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RemoveInstanceTargetPoolHttpRequest) { + RemoveInstanceTargetPoolHttpRequest that = (RemoveInstanceTargetPoolHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetPool, that.getTargetPool()) + && Objects.equals( + this.targetPoolsRemoveInstanceRequestResource, + that.getTargetPoolsRemoveInstanceRequestResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetPool, + targetPoolsRemoveInstanceRequestResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemoveInstancesInstanceGroupHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemoveInstancesInstanceGroupHttpRequest.java new file mode 100644 index 000000000000..a997c78245e8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemoveInstancesInstanceGroupHttpRequest.java @@ -0,0 +1,453 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RemoveInstancesInstanceGroupHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroup; + private final InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private RemoveInstancesInstanceGroupHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroup = null; + this.instanceGroupsRemoveInstancesRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private RemoveInstancesInstanceGroupHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroup, + InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroup = instanceGroup; + this.instanceGroupsRemoveInstancesRequestResource = + instanceGroupsRemoveInstancesRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroup")) { + return instanceGroup; + } + if (fieldName.equals("instanceGroupsRemoveInstancesRequestResource")) { + return instanceGroupsRemoveInstancesRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceGroupsRemoveInstancesRequest getApiMessageRequestBody() { + return instanceGroupsRemoveInstancesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public InstanceGroupsRemoveInstancesRequest getInstanceGroupsRemoveInstancesRequestResource() { + return instanceGroupsRemoveInstancesRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RemoveInstancesInstanceGroupHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RemoveInstancesInstanceGroupHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RemoveInstancesInstanceGroupHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RemoveInstancesInstanceGroupHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroup; + private InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(RemoveInstancesInstanceGroupHttpRequest other) { + if (other == RemoveInstancesInstanceGroupHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroup() != null) { + this.instanceGroup = other.instanceGroup; + } + if (other.getInstanceGroupsRemoveInstancesRequestResource() != null) { + this.instanceGroupsRemoveInstancesRequestResource = + other.instanceGroupsRemoveInstancesRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(RemoveInstancesInstanceGroupHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroup = source.instanceGroup; + this.instanceGroupsRemoveInstancesRequestResource = + source.instanceGroupsRemoveInstancesRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public InstanceGroupsRemoveInstancesRequest getInstanceGroupsRemoveInstancesRequestResource() { + return instanceGroupsRemoveInstancesRequestResource; + } + + public Builder setInstanceGroupsRemoveInstancesRequestResource( + InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource) { + this.instanceGroupsRemoveInstancesRequestResource = + instanceGroupsRemoveInstancesRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public RemoveInstancesInstanceGroupHttpRequest build() { + String missing = ""; + + if (instanceGroup == null) { + missing += " instanceGroup"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new RemoveInstancesInstanceGroupHttpRequest( + access_token, + callback, + fields, + instanceGroup, + instanceGroupsRemoveInstancesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroup(this.instanceGroup); + newBuilder.setInstanceGroupsRemoveInstancesRequestResource( + this.instanceGroupsRemoveInstancesRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "RemoveInstancesInstanceGroupHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroup=" + + instanceGroup + + ", " + + "instanceGroupsRemoveInstancesRequestResource=" + + instanceGroupsRemoveInstancesRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RemoveInstancesInstanceGroupHttpRequest) { + RemoveInstancesInstanceGroupHttpRequest that = (RemoveInstancesInstanceGroupHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals( + this.instanceGroupsRemoveInstancesRequestResource, + that.getInstanceGroupsRemoveInstancesRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroup, + instanceGroupsRemoveInstancesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemovePeeringNetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemovePeeringNetworkHttpRequest.java new file mode 100644 index 000000000000..8bd762d6c23d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RemovePeeringNetworkHttpRequest.java @@ -0,0 +1,448 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RemovePeeringNetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String network; + private final NetworksRemovePeeringRequest networksRemovePeeringRequestResource; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private RemovePeeringNetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.network = null; + this.networksRemovePeeringRequestResource = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private RemovePeeringNetworkHttpRequest( + String access_token, + String callback, + String fields, + String key, + String network, + NetworksRemovePeeringRequest networksRemovePeeringRequestResource, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.network = network; + this.networksRemovePeeringRequestResource = networksRemovePeeringRequestResource; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("networksRemovePeeringRequestResource")) { + return networksRemovePeeringRequestResource; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public NetworksRemovePeeringRequest getApiMessageRequestBody() { + return networksRemovePeeringRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getNetwork() { + return network; + } + + public NetworksRemovePeeringRequest getNetworksRemovePeeringRequestResource() { + return networksRemovePeeringRequestResource; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RemovePeeringNetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RemovePeeringNetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RemovePeeringNetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RemovePeeringNetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String network; + private NetworksRemovePeeringRequest networksRemovePeeringRequestResource; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(RemovePeeringNetworkHttpRequest other) { + if (other == RemovePeeringNetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getNetworksRemovePeeringRequestResource() != null) { + this.networksRemovePeeringRequestResource = other.networksRemovePeeringRequestResource; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(RemovePeeringNetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.network = source.network; + this.networksRemovePeeringRequestResource = source.networksRemovePeeringRequestResource; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public NetworksRemovePeeringRequest getNetworksRemovePeeringRequestResource() { + return networksRemovePeeringRequestResource; + } + + public Builder setNetworksRemovePeeringRequestResource( + NetworksRemovePeeringRequest networksRemovePeeringRequestResource) { + this.networksRemovePeeringRequestResource = networksRemovePeeringRequestResource; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public RemovePeeringNetworkHttpRequest build() { + String missing = ""; + + if (network == null) { + missing += " network"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new RemovePeeringNetworkHttpRequest( + access_token, + callback, + fields, + key, + network, + networksRemovePeeringRequestResource, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setNetwork(this.network); + newBuilder.setNetworksRemovePeeringRequestResource(this.networksRemovePeeringRequestResource); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "RemovePeeringNetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "network=" + + network + + ", " + + "networksRemovePeeringRequestResource=" + + networksRemovePeeringRequestResource + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RemovePeeringNetworkHttpRequest) { + RemovePeeringNetworkHttpRequest that = (RemovePeeringNetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals( + this.networksRemovePeeringRequestResource, + that.getNetworksRemovePeeringRequestResource()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + network, + networksRemovePeeringRequestResource, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResetInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResetInstanceHttpRequest.java new file mode 100644 index 000000000000..426b99a4e8ae --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResetInstanceHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ResetInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private ResetInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private ResetInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ResetInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ResetInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ResetInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ResetInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ResetInstanceHttpRequest other) { + if (other == ResetInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ResetInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ResetInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ResetInstanceHttpRequest( + access_token, callback, fields, instance, key, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ResetInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ResetInstanceHttpRequest) { + ResetInstanceHttpRequest that = (ResetInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, instance, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeDiskHttpRequest.java new file mode 100644 index 000000000000..7231c0b99131 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeDiskHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ResizeDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String disk; + private final DisksResizeRequest disksResizeRequestResource; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private ResizeDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.disk = null; + this.disksResizeRequestResource = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private ResizeDiskHttpRequest( + String access_token, + String callback, + String disk, + DisksResizeRequest disksResizeRequestResource, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.disk = disk; + this.disksResizeRequestResource = disksResizeRequestResource; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("disk")) { + return disk; + } + if (fieldName.equals("disksResizeRequestResource")) { + return disksResizeRequestResource; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public DisksResizeRequest getApiMessageRequestBody() { + return disksResizeRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getDisk() { + return disk; + } + + public DisksResizeRequest getDisksResizeRequestResource() { + return disksResizeRequestResource; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ResizeDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ResizeDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ResizeDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ResizeDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String disk; + private DisksResizeRequest disksResizeRequestResource; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ResizeDiskHttpRequest other) { + if (other == ResizeDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDisk() != null) { + this.disk = other.disk; + } + if (other.getDisksResizeRequestResource() != null) { + this.disksResizeRequestResource = other.disksResizeRequestResource; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ResizeDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.disk = source.disk; + this.disksResizeRequestResource = source.disksResizeRequestResource; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDisk() { + return disk; + } + + public Builder setDisk(String disk) { + this.disk = disk; + return this; + } + + public DisksResizeRequest getDisksResizeRequestResource() { + return disksResizeRequestResource; + } + + public Builder setDisksResizeRequestResource(DisksResizeRequest disksResizeRequestResource) { + this.disksResizeRequestResource = disksResizeRequestResource; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ResizeDiskHttpRequest build() { + String missing = ""; + + if (disk == null) { + missing += " disk"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ResizeDiskHttpRequest( + access_token, + callback, + disk, + disksResizeRequestResource, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDisk(this.disk); + newBuilder.setDisksResizeRequestResource(this.disksResizeRequestResource); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ResizeDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "disk=" + + disk + + ", " + + "disksResizeRequestResource=" + + disksResizeRequestResource + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ResizeDiskHttpRequest) { + ResizeDiskHttpRequest that = (ResizeDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.disk, that.getDisk()) + && Objects.equals(this.disksResizeRequestResource, that.getDisksResizeRequestResource()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + disk, + disksResizeRequestResource, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..9fd2f0fbdd49 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeInstanceGroupManagerHttpRequest.java @@ -0,0 +1,449 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ResizeInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final Integer size; + private final String userIp; + + private ResizeInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.size = null; + this.userIp = null; + } + + private ResizeInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + String key, + String prettyPrint, + String quotaUser, + String requestId, + Integer size, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.size = size; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("size")) { + return size; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public Integer getSize() { + return size; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ResizeInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ResizeInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ResizeInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ResizeInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private Integer size; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ResizeInstanceGroupManagerHttpRequest other) { + if (other == ResizeInstanceGroupManagerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSize() != null) { + this.size = other.size; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ResizeInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.size = source.size; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Integer getSize() { + return size; + } + + public Builder setSize(Integer size) { + this.size = size; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ResizeInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (size == null) { + missing += " size"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ResizeInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + requestId, + size, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSize(this.size); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ResizeInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "size=" + + size + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ResizeInstanceGroupManagerHttpRequest) { + ResizeInstanceGroupManagerHttpRequest that = (ResizeInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.size, that.getSize()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + requestId, + size, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeRegionDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeRegionDiskHttpRequest.java new file mode 100644 index 000000000000..53c6d1937ea7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeRegionDiskHttpRequest.java @@ -0,0 +1,447 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ResizeRegionDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String disk; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final RegionDisksResizeRequest regionDisksResizeRequestResource; + private final String requestId; + private final String userIp; + + private ResizeRegionDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.disk = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.regionDisksResizeRequestResource = null; + this.requestId = null; + this.userIp = null; + } + + private ResizeRegionDiskHttpRequest( + String access_token, + String callback, + String disk, + String fields, + String key, + String prettyPrint, + String quotaUser, + RegionDisksResizeRequest regionDisksResizeRequestResource, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.disk = disk; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.regionDisksResizeRequestResource = regionDisksResizeRequestResource; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("disk")) { + return disk; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("regionDisksResizeRequestResource")) { + return regionDisksResizeRequestResource; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public RegionDisksResizeRequest getApiMessageRequestBody() { + return regionDisksResizeRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getDisk() { + return disk; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public RegionDisksResizeRequest getRegionDisksResizeRequestResource() { + return regionDisksResizeRequestResource; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ResizeRegionDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ResizeRegionDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ResizeRegionDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ResizeRegionDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String disk; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private RegionDisksResizeRequest regionDisksResizeRequestResource; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ResizeRegionDiskHttpRequest other) { + if (other == ResizeRegionDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDisk() != null) { + this.disk = other.disk; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegionDisksResizeRequestResource() != null) { + this.regionDisksResizeRequestResource = other.regionDisksResizeRequestResource; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ResizeRegionDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.disk = source.disk; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.regionDisksResizeRequestResource = source.regionDisksResizeRequestResource; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDisk() { + return disk; + } + + public Builder setDisk(String disk) { + this.disk = disk; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public RegionDisksResizeRequest getRegionDisksResizeRequestResource() { + return regionDisksResizeRequestResource; + } + + public Builder setRegionDisksResizeRequestResource( + RegionDisksResizeRequest regionDisksResizeRequestResource) { + this.regionDisksResizeRequestResource = regionDisksResizeRequestResource; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ResizeRegionDiskHttpRequest build() { + String missing = ""; + + if (disk == null) { + missing += " disk"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ResizeRegionDiskHttpRequest( + access_token, + callback, + disk, + fields, + key, + prettyPrint, + quotaUser, + regionDisksResizeRequestResource, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDisk(this.disk); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegionDisksResizeRequestResource(this.regionDisksResizeRequestResource); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ResizeRegionDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "disk=" + + disk + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "regionDisksResizeRequestResource=" + + regionDisksResizeRequestResource + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ResizeRegionDiskHttpRequest) { + ResizeRegionDiskHttpRequest that = (ResizeRegionDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.disk, that.getDisk()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals( + this.regionDisksResizeRequestResource, that.getRegionDisksResizeRequestResource()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + disk, + fields, + key, + prettyPrint, + quotaUser, + regionDisksResizeRequestResource, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeRegionInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeRegionInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..9ad8bcb64ff6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResizeRegionInstanceGroupManagerHttpRequest.java @@ -0,0 +1,450 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ResizeRegionInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final Integer size; + private final String userIp; + + private ResizeRegionInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.size = null; + this.userIp = null; + } + + private ResizeRegionInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + String key, + String prettyPrint, + String quotaUser, + String requestId, + Integer size, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.size = size; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("size")) { + return size; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public Integer getSize() { + return size; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ResizeRegionInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ResizeRegionInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ResizeRegionInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ResizeRegionInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private Integer size; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ResizeRegionInstanceGroupManagerHttpRequest other) { + if (other == ResizeRegionInstanceGroupManagerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSize() != null) { + this.size = other.size; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ResizeRegionInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.size = source.size; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Integer getSize() { + return size; + } + + public Builder setSize(Integer size) { + this.size = size; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ResizeRegionInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (size == null) { + missing += " size"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ResizeRegionInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + requestId, + size, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSize(this.size); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ResizeRegionInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "size=" + + size + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ResizeRegionInstanceGroupManagerHttpRequest) { + ResizeRegionInstanceGroupManagerHttpRequest that = + (ResizeRegionInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.size, that.getSize()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + requestId, + size, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResourceCommitment.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResourceCommitment.java new file mode 100644 index 000000000000..c48fcbb28ff5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResourceCommitment.java @@ -0,0 +1,169 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ResourceCommitment implements ApiMessage { + private final String amount; + private final String type; + + private ResourceCommitment() { + this.amount = null; + this.type = null; + } + + private ResourceCommitment(String amount, String type) { + this.amount = amount; + this.type = type; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("amount")) { + return amount; + } + if (fieldName.equals("type")) { + return type; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAmount() { + return amount; + } + + public String getType() { + return type; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ResourceCommitment prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ResourceCommitment getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ResourceCommitment DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ResourceCommitment(); + } + + public static class Builder { + private String amount; + private String type; + + Builder() {} + + public Builder mergeFrom(ResourceCommitment other) { + if (other == ResourceCommitment.getDefaultInstance()) return this; + if (other.getAmount() != null) { + this.amount = other.amount; + } + if (other.getType() != null) { + this.type = other.type; + } + return this; + } + + Builder(ResourceCommitment source) { + this.amount = source.amount; + this.type = source.type; + } + + public String getAmount() { + return amount; + } + + public Builder setAmount(String amount) { + this.amount = amount; + return this; + } + + public String getType() { + return type; + } + + public Builder setType(String type) { + this.type = type; + return this; + } + + public ResourceCommitment build() { + + return new ResourceCommitment(amount, type); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAmount(this.amount); + newBuilder.setType(this.type); + return newBuilder; + } + } + + @Override + public String toString() { + return "ResourceCommitment{" + "amount=" + amount + ", " + "type=" + type + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ResourceCommitment) { + ResourceCommitment that = (ResourceCommitment) o; + return Objects.equals(this.amount, that.getAmount()) + && Objects.equals(this.type, that.getType()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(amount, type); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResourceGroupReference.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResourceGroupReference.java new file mode 100644 index 000000000000..5b6876d4274b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ResourceGroupReference.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ResourceGroupReference implements ApiMessage { + private final String group; + + private ResourceGroupReference() { + this.group = null; + } + + private ResourceGroupReference(String group) { + this.group = group; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("group")) { + return group; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getGroup() { + return group; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ResourceGroupReference prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ResourceGroupReference getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ResourceGroupReference DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ResourceGroupReference(); + } + + public static class Builder { + private String group; + + Builder() {} + + public Builder mergeFrom(ResourceGroupReference other) { + if (other == ResourceGroupReference.getDefaultInstance()) return this; + if (other.getGroup() != null) { + this.group = other.group; + } + return this; + } + + Builder(ResourceGroupReference source) { + this.group = source.group; + } + + public String getGroup() { + return group; + } + + public Builder setGroup(String group) { + this.group = group; + return this; + } + + public ResourceGroupReference build() { + return new ResourceGroupReference(group); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setGroup(this.group); + return newBuilder; + } + } + + @Override + public String toString() { + return "ResourceGroupReference{" + "group=" + group + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ResourceGroupReference) { + ResourceGroupReference that = (ResourceGroupReference) o; + return Objects.equals(this.group, that.getGroup()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(group); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Route.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Route.java new file mode 100644 index 000000000000..5787127134b3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Route.java @@ -0,0 +1,678 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Route implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String destRange; + private final String id; + private final String kind; + private final String name; + private final String network; + private final String nextHopGateway; + private final String nextHopInstance; + private final String nextHopIp; + private final String nextHopNetwork; + private final String nextHopPeering; + private final String nextHopVpnTunnel; + private final Integer priority; + private final String selfLink; + private final List tags; + private final List warnings; + + private Route() { + this.creationTimestamp = null; + this.description = null; + this.destRange = null; + this.id = null; + this.kind = null; + this.name = null; + this.network = null; + this.nextHopGateway = null; + this.nextHopInstance = null; + this.nextHopIp = null; + this.nextHopNetwork = null; + this.nextHopPeering = null; + this.nextHopVpnTunnel = null; + this.priority = null; + this.selfLink = null; + this.tags = null; + this.warnings = null; + } + + private Route( + String creationTimestamp, + String description, + String destRange, + String id, + String kind, + String name, + String network, + String nextHopGateway, + String nextHopInstance, + String nextHopIp, + String nextHopNetwork, + String nextHopPeering, + String nextHopVpnTunnel, + Integer priority, + String selfLink, + List tags, + List warnings) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.destRange = destRange; + this.id = id; + this.kind = kind; + this.name = name; + this.network = network; + this.nextHopGateway = nextHopGateway; + this.nextHopInstance = nextHopInstance; + this.nextHopIp = nextHopIp; + this.nextHopNetwork = nextHopNetwork; + this.nextHopPeering = nextHopPeering; + this.nextHopVpnTunnel = nextHopVpnTunnel; + this.priority = priority; + this.selfLink = selfLink; + this.tags = tags; + this.warnings = warnings; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("destRange")) { + return destRange; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("nextHopGateway")) { + return nextHopGateway; + } + if (fieldName.equals("nextHopInstance")) { + return nextHopInstance; + } + if (fieldName.equals("nextHopIp")) { + return nextHopIp; + } + if (fieldName.equals("nextHopNetwork")) { + return nextHopNetwork; + } + if (fieldName.equals("nextHopPeering")) { + return nextHopPeering; + } + if (fieldName.equals("nextHopVpnTunnel")) { + return nextHopVpnTunnel; + } + if (fieldName.equals("priority")) { + return priority; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("tags")) { + return tags; + } + if (fieldName.equals("warnings")) { + return warnings; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getDestRange() { + return destRange; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getNetwork() { + return network; + } + + public String getNextHopGateway() { + return nextHopGateway; + } + + public String getNextHopInstance() { + return nextHopInstance; + } + + public String getNextHopIp() { + return nextHopIp; + } + + public String getNextHopNetwork() { + return nextHopNetwork; + } + + public String getNextHopPeering() { + return nextHopPeering; + } + + public String getNextHopVpnTunnel() { + return nextHopVpnTunnel; + } + + public Integer getPriority() { + return priority; + } + + public String getSelfLink() { + return selfLink; + } + + public List getTagsList() { + return tags; + } + + public List getWarningsList() { + return warnings; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Route prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Route getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Route DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Route(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String destRange; + private String id; + private String kind; + private String name; + private String network; + private String nextHopGateway; + private String nextHopInstance; + private String nextHopIp; + private String nextHopNetwork; + private String nextHopPeering; + private String nextHopVpnTunnel; + private Integer priority; + private String selfLink; + private List tags; + private List warnings; + + Builder() {} + + public Builder mergeFrom(Route other) { + if (other == Route.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getDestRange() != null) { + this.destRange = other.destRange; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getNextHopGateway() != null) { + this.nextHopGateway = other.nextHopGateway; + } + if (other.getNextHopInstance() != null) { + this.nextHopInstance = other.nextHopInstance; + } + if (other.getNextHopIp() != null) { + this.nextHopIp = other.nextHopIp; + } + if (other.getNextHopNetwork() != null) { + this.nextHopNetwork = other.nextHopNetwork; + } + if (other.getNextHopPeering() != null) { + this.nextHopPeering = other.nextHopPeering; + } + if (other.getNextHopVpnTunnel() != null) { + this.nextHopVpnTunnel = other.nextHopVpnTunnel; + } + if (other.getPriority() != null) { + this.priority = other.priority; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getTagsList() != null) { + this.tags = other.tags; + } + if (other.getWarningsList() != null) { + this.warnings = other.warnings; + } + return this; + } + + Builder(Route source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.destRange = source.destRange; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.network = source.network; + this.nextHopGateway = source.nextHopGateway; + this.nextHopInstance = source.nextHopInstance; + this.nextHopIp = source.nextHopIp; + this.nextHopNetwork = source.nextHopNetwork; + this.nextHopPeering = source.nextHopPeering; + this.nextHopVpnTunnel = source.nextHopVpnTunnel; + this.priority = source.priority; + this.selfLink = source.selfLink; + this.tags = source.tags; + this.warnings = source.warnings; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getDestRange() { + return destRange; + } + + public Builder setDestRange(String destRange) { + this.destRange = destRange; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public String getNextHopGateway() { + return nextHopGateway; + } + + public Builder setNextHopGateway(String nextHopGateway) { + this.nextHopGateway = nextHopGateway; + return this; + } + + public String getNextHopInstance() { + return nextHopInstance; + } + + public Builder setNextHopInstance(String nextHopInstance) { + this.nextHopInstance = nextHopInstance; + return this; + } + + public String getNextHopIp() { + return nextHopIp; + } + + public Builder setNextHopIp(String nextHopIp) { + this.nextHopIp = nextHopIp; + return this; + } + + public String getNextHopNetwork() { + return nextHopNetwork; + } + + public Builder setNextHopNetwork(String nextHopNetwork) { + this.nextHopNetwork = nextHopNetwork; + return this; + } + + public String getNextHopPeering() { + return nextHopPeering; + } + + public Builder setNextHopPeering(String nextHopPeering) { + this.nextHopPeering = nextHopPeering; + return this; + } + + public String getNextHopVpnTunnel() { + return nextHopVpnTunnel; + } + + public Builder setNextHopVpnTunnel(String nextHopVpnTunnel) { + this.nextHopVpnTunnel = nextHopVpnTunnel; + return this; + } + + public Integer getPriority() { + return priority; + } + + public Builder setPriority(Integer priority) { + this.priority = priority; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public List getTagsList() { + return tags; + } + + public Builder addAllTags(List tags) { + if (this.tags == null) { + this.tags = new ArrayList<>(tags.size()); + } + this.tags.addAll(tags); + return this; + } + + public Builder addTags(String tags) { + this.tags.add(tags); + return this; + } + + public List getWarningsList() { + return warnings; + } + + public Builder addAllWarnings(List warnings) { + if (this.warnings == null) { + this.warnings = new ArrayList<>(warnings.size()); + } + this.warnings.addAll(warnings); + return this; + } + + public Builder addWarnings(Warnings warnings) { + this.warnings.add(warnings); + return this; + } + + public Route build() { + + return new Route( + creationTimestamp, + description, + destRange, + id, + kind, + name, + network, + nextHopGateway, + nextHopInstance, + nextHopIp, + nextHopNetwork, + nextHopPeering, + nextHopVpnTunnel, + priority, + selfLink, + tags, + warnings); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setDestRange(this.destRange); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setNetwork(this.network); + newBuilder.setNextHopGateway(this.nextHopGateway); + newBuilder.setNextHopInstance(this.nextHopInstance); + newBuilder.setNextHopIp(this.nextHopIp); + newBuilder.setNextHopNetwork(this.nextHopNetwork); + newBuilder.setNextHopPeering(this.nextHopPeering); + newBuilder.setNextHopVpnTunnel(this.nextHopVpnTunnel); + newBuilder.setPriority(this.priority); + newBuilder.setSelfLink(this.selfLink); + newBuilder.addAllTags(this.tags); + newBuilder.addAllWarnings(this.warnings); + return newBuilder; + } + } + + @Override + public String toString() { + return "Route{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "destRange=" + + destRange + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "network=" + + network + + ", " + + "nextHopGateway=" + + nextHopGateway + + ", " + + "nextHopInstance=" + + nextHopInstance + + ", " + + "nextHopIp=" + + nextHopIp + + ", " + + "nextHopNetwork=" + + nextHopNetwork + + ", " + + "nextHopPeering=" + + nextHopPeering + + ", " + + "nextHopVpnTunnel=" + + nextHopVpnTunnel + + ", " + + "priority=" + + priority + + ", " + + "selfLink=" + + selfLink + + ", " + + "tags=" + + tags + + ", " + + "warnings=" + + warnings + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Route) { + Route that = (Route) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.destRange, that.getDestRange()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.nextHopGateway, that.getNextHopGateway()) + && Objects.equals(this.nextHopInstance, that.getNextHopInstance()) + && Objects.equals(this.nextHopIp, that.getNextHopIp()) + && Objects.equals(this.nextHopNetwork, that.getNextHopNetwork()) + && Objects.equals(this.nextHopPeering, that.getNextHopPeering()) + && Objects.equals(this.nextHopVpnTunnel, that.getNextHopVpnTunnel()) + && Objects.equals(this.priority, that.getPriority()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.tags, that.getTagsList()) + && Objects.equals(this.warnings, that.getWarningsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + description, + destRange, + id, + kind, + name, + network, + nextHopGateway, + nextHopInstance, + nextHopIp, + nextHopNetwork, + nextHopPeering, + nextHopVpnTunnel, + priority, + selfLink, + tags, + warnings); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteClient.java new file mode 100644 index 000000000000..c59904facdae --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteClient.java @@ -0,0 +1,713 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.RouteStub; +import com.google.cloud.compute.v1.stub.RouteStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (RouteClient routeClient = RouteClient.create()) {
+ *   ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]");
+ *   Operation response = routeClient.deleteRoute(route);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the routeClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of RouteSettings to create(). For + * example: + * + *

To customize credentials: + * + *

+ * 
+ * RouteSettings routeSettings =
+ *     RouteSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * RouteClient routeClient =
+ *     RouteClient.create(routeSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * RouteSettings routeSettings =
+ *     RouteSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RouteClient routeClient =
+ *     RouteClient.create(routeSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RouteClient implements BackgroundResource { + private final RouteSettings settings; + private final RouteStub stub; + + /** Constructs an instance of RouteClient with default settings. */ + public static final RouteClient create() throws IOException { + return create(RouteSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RouteClient, using the given settings. The channels are created based + * on the settings passed in, or defaults for any settings that are not set. + */ + public static final RouteClient create(RouteSettings settings) throws IOException { + return new RouteClient(settings); + } + + /** + * Constructs an instance of RouteClient, using the given stub for making calls. This is for + * advanced usage - prefer to use RouteSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final RouteClient create(RouteStub stub) { + return new RouteClient(stub); + } + + /** + * Constructs an instance of RouteClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected RouteClient(RouteSettings settings) throws IOException { + this.settings = settings; + this.stub = ((RouteStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected RouteClient(RouteStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RouteSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RouteStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Route resource. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]");
+   *   Operation response = routeClient.deleteRoute(route);
+   * }
+   * 
+ * + * @param route Name of the Route resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRoute(ProjectGlobalRouteName route) { + + DeleteRouteHttpRequest request = + DeleteRouteHttpRequest.newBuilder() + .setRoute(route == null ? null : route.toString()) + .build(); + return deleteRoute(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Route resource. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]");
+   *   Operation response = routeClient.deleteRoute(route.toString());
+   * }
+   * 
+ * + * @param route Name of the Route resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRoute(String route) { + + DeleteRouteHttpRequest request = DeleteRouteHttpRequest.newBuilder().setRoute(route).build(); + return deleteRoute(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Route resource. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]");
+   *   DeleteRouteHttpRequest request = DeleteRouteHttpRequest.newBuilder()
+   *     .setRoute(route.toString())
+   *     .build();
+   *   Operation response = routeClient.deleteRoute(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRoute(DeleteRouteHttpRequest request) { + return deleteRouteCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Route resource. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]");
+   *   DeleteRouteHttpRequest request = DeleteRouteHttpRequest.newBuilder()
+   *     .setRoute(route.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = routeClient.deleteRouteCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteRouteCallable() { + return stub.deleteRouteCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Route resource. Gets a list of available routes by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]");
+   *   Route response = routeClient.getRoute(route);
+   * }
+   * 
+ * + * @param route Name of the Route resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Route getRoute(ProjectGlobalRouteName route) { + + GetRouteHttpRequest request = + GetRouteHttpRequest.newBuilder().setRoute(route == null ? null : route.toString()).build(); + return getRoute(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Route resource. Gets a list of available routes by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]");
+   *   Route response = routeClient.getRoute(route.toString());
+   * }
+   * 
+ * + * @param route Name of the Route resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Route getRoute(String route) { + + GetRouteHttpRequest request = GetRouteHttpRequest.newBuilder().setRoute(route).build(); + return getRoute(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Route resource. Gets a list of available routes by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]");
+   *   GetRouteHttpRequest request = GetRouteHttpRequest.newBuilder()
+   *     .setRoute(route.toString())
+   *     .build();
+   *   Route response = routeClient.getRoute(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Route getRoute(GetRouteHttpRequest request) { + return getRouteCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Route resource. Gets a list of available routes by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]");
+   *   GetRouteHttpRequest request = GetRouteHttpRequest.newBuilder()
+   *     .setRoute(route.toString())
+   *     .build();
+   *   ApiFuture<Route> future = routeClient.getRouteCallable().futureCall(request);
+   *   // Do something
+   *   Route response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getRouteCallable() { + return stub.getRouteCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Route resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Route routeResource = Route.newBuilder().build();
+   *   Operation response = routeClient.insertRoute(project, routeResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param routeResource Represents a Route resource. A route specifies how certain packets should + * be handled by the network. Routes are associated with instances by tags and the set of + * routes for a particular instance is called its routing table. + *

For each packet leaving an instance, the system searches that instance's routing table + * for a single best matching route. Routes match packets by destination IP address, + * preferring smaller or more specific ranges over larger ones. If there is a tie, the system + * selects the route with the smallest priority value. If there is still a tie, it uses the + * layer three and four packet headers to select just one of the remaining matching routes. + * The packet is then forwarded as specified by the nextHop field of the winning route - + * either to another instance destination, an instance gateway, or a Google Compute + * Engine-operated gateway. + *

Packets that do not match any route in the sending instance's routing table are dropped. + * (== resource_for beta.routes ==) (== resource_for v1.routes ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRoute(ProjectName project, Route routeResource) { + + InsertRouteHttpRequest request = + InsertRouteHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setRouteResource(routeResource) + .build(); + return insertRoute(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Route resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Route routeResource = Route.newBuilder().build();
+   *   Operation response = routeClient.insertRoute(project.toString(), routeResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param routeResource Represents a Route resource. A route specifies how certain packets should + * be handled by the network. Routes are associated with instances by tags and the set of + * routes for a particular instance is called its routing table. + *

For each packet leaving an instance, the system searches that instance's routing table + * for a single best matching route. Routes match packets by destination IP address, + * preferring smaller or more specific ranges over larger ones. If there is a tie, the system + * selects the route with the smallest priority value. If there is still a tie, it uses the + * layer three and four packet headers to select just one of the remaining matching routes. + * The packet is then forwarded as specified by the nextHop field of the winning route - + * either to another instance destination, an instance gateway, or a Google Compute + * Engine-operated gateway. + *

Packets that do not match any route in the sending instance's routing table are dropped. + * (== resource_for beta.routes ==) (== resource_for v1.routes ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRoute(String project, Route routeResource) { + + InsertRouteHttpRequest request = + InsertRouteHttpRequest.newBuilder() + .setProject(project) + .setRouteResource(routeResource) + .build(); + return insertRoute(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Route resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Route routeResource = Route.newBuilder().build();
+   *   InsertRouteHttpRequest request = InsertRouteHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setRouteResource(routeResource)
+   *     .build();
+   *   Operation response = routeClient.insertRoute(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRoute(InsertRouteHttpRequest request) { + return insertRouteCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Route resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   Route routeResource = Route.newBuilder().build();
+   *   InsertRouteHttpRequest request = InsertRouteHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setRouteResource(routeResource)
+   *     .build();
+   *   ApiFuture<Operation> future = routeClient.insertRouteCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertRouteCallable() { + return stub.insertRouteCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Route resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Route element : routeClient.listRoutes(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRoutesPagedResponse listRoutes(ProjectName project) { + ListRoutesHttpRequest request = + ListRoutesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listRoutes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Route resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Route element : routeClient.listRoutes(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRoutesPagedResponse listRoutes(String project) { + ListRoutesHttpRequest request = ListRoutesHttpRequest.newBuilder().setProject(project).build(); + return listRoutes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Route resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListRoutesHttpRequest request = ListRoutesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (Route element : routeClient.listRoutes(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRoutesPagedResponse listRoutes(ListRoutesHttpRequest request) { + return listRoutesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Route resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListRoutesHttpRequest request = ListRoutesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListRoutesPagedResponse> future = routeClient.listRoutesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Route element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRoutesPagedCallable() { + return stub.listRoutesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Route resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RouteClient routeClient = RouteClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListRoutesHttpRequest request = ListRoutesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     RouteList response = routeClient.listRoutesCallable().call(request);
+   *     for (Route element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listRoutesCallable() { + return stub.listRoutesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListRoutesPagedResponse + extends AbstractPagedListResponse< + ListRoutesHttpRequest, RouteList, Route, ListRoutesPage, ListRoutesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRoutesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListRoutesPagedResponse apply(ListRoutesPage input) { + return new ListRoutesPagedResponse(input); + } + }); + } + + private ListRoutesPagedResponse(ListRoutesPage page) { + super(page, ListRoutesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRoutesPage + extends AbstractPage { + + private ListRoutesPage( + PageContext context, RouteList response) { + super(context, response); + } + + private static ListRoutesPage createEmptyPage() { + return new ListRoutesPage(null, null); + } + + @Override + protected ListRoutesPage createPage( + PageContext context, RouteList response) { + return new ListRoutesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRoutesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRoutesHttpRequest, RouteList, Route, ListRoutesPage, ListRoutesFixedSizeCollection> { + + private ListRoutesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRoutesFixedSizeCollection createEmptyCollection() { + return new ListRoutesFixedSizeCollection(null, 0); + } + + @Override + protected ListRoutesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRoutesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteList.java new file mode 100644 index 000000000000..49dadda25cc1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RouteList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private RouteList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private RouteList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RouteList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RouteList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RouteList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RouteList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(RouteList other) { + if (other == RouteList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(RouteList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Route items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public RouteList build() { + + return new RouteList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "RouteList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RouteList) { + RouteList that = (RouteList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteSettings.java new file mode 100644 index 000000000000..a439d3cfe474 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteSettings.java @@ -0,0 +1,214 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RouteClient.ListRoutesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.RouteStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RouteClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteRoute to 30 seconds: + * + *

+ * 
+ * RouteSettings.Builder routeSettingsBuilder =
+ *     RouteSettings.newBuilder();
+ * routeSettingsBuilder.deleteRouteSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RouteSettings routeSettings = routeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RouteSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteRoute. */ + public UnaryCallSettings deleteRouteSettings() { + return ((RouteStubSettings) getStubSettings()).deleteRouteSettings(); + } + + /** Returns the object with the settings used for calls to getRoute. */ + public UnaryCallSettings getRouteSettings() { + return ((RouteStubSettings) getStubSettings()).getRouteSettings(); + } + + /** Returns the object with the settings used for calls to insertRoute. */ + public UnaryCallSettings insertRouteSettings() { + return ((RouteStubSettings) getStubSettings()).insertRouteSettings(); + } + + /** Returns the object with the settings used for calls to listRoutes. */ + public PagedCallSettings + listRoutesSettings() { + return ((RouteStubSettings) getStubSettings()).listRoutesSettings(); + } + + public static final RouteSettings create(RouteStubSettings stub) throws IOException { + return new RouteSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return RouteStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return RouteStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return RouteStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return RouteStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return RouteStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return RouteStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return RouteStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return RouteStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RouteSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for RouteSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(RouteStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(RouteStubSettings.newBuilder()); + } + + protected Builder(RouteSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(RouteStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public RouteStubSettings.Builder getStubSettingsBuilder() { + return ((RouteStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteRoute. */ + public UnaryCallSettings.Builder deleteRouteSettings() { + return getStubSettingsBuilder().deleteRouteSettings(); + } + + /** Returns the builder for the settings used for calls to getRoute. */ + public UnaryCallSettings.Builder getRouteSettings() { + return getStubSettingsBuilder().getRouteSettings(); + } + + /** Returns the builder for the settings used for calls to insertRoute. */ + public UnaryCallSettings.Builder insertRouteSettings() { + return getStubSettingsBuilder().insertRouteSettings(); + } + + /** Returns the builder for the settings used for calls to listRoutes. */ + public PagedCallSettings.Builder + listRoutesSettings() { + return getStubSettingsBuilder().listRoutesSettings(); + } + + @Override + public RouteSettings build() throws IOException { + return new RouteSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Router.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Router.java new file mode 100644 index 000000000000..a4f548b9a72a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Router.java @@ -0,0 +1,486 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Router implements ApiMessage { + private final RouterBgp bgp; + private final List bgpPeers; + private final String creationTimestamp; + private final String description; + private final String id; + private final List interfaces; + private final String kind; + private final String name; + private final String network; + private final String region; + private final String selfLink; + + private Router() { + this.bgp = null; + this.bgpPeers = null; + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.interfaces = null; + this.kind = null; + this.name = null; + this.network = null; + this.region = null; + this.selfLink = null; + } + + private Router( + RouterBgp bgp, + List bgpPeers, + String creationTimestamp, + String description, + String id, + List interfaces, + String kind, + String name, + String network, + String region, + String selfLink) { + this.bgp = bgp; + this.bgpPeers = bgpPeers; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.interfaces = interfaces; + this.kind = kind; + this.name = name; + this.network = network; + this.region = region; + this.selfLink = selfLink; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("bgp")) { + return bgp; + } + if (fieldName.equals("bgpPeers")) { + return bgpPeers; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("interfaces")) { + return interfaces; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public RouterBgp getBgp() { + return bgp; + } + + public List getBgpPeersList() { + return bgpPeers; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public List getInterfacesList() { + return interfaces; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getNetwork() { + return network; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Router prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Router getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Router DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Router(); + } + + public static class Builder { + private RouterBgp bgp; + private List bgpPeers; + private String creationTimestamp; + private String description; + private String id; + private List interfaces; + private String kind; + private String name; + private String network; + private String region; + private String selfLink; + + Builder() {} + + public Builder mergeFrom(Router other) { + if (other == Router.getDefaultInstance()) return this; + if (other.getBgp() != null) { + this.bgp = other.bgp; + } + if (other.getBgpPeersList() != null) { + this.bgpPeers = other.bgpPeers; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getInterfacesList() != null) { + this.interfaces = other.interfaces; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + return this; + } + + Builder(Router source) { + this.bgp = source.bgp; + this.bgpPeers = source.bgpPeers; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.interfaces = source.interfaces; + this.kind = source.kind; + this.name = source.name; + this.network = source.network; + this.region = source.region; + this.selfLink = source.selfLink; + } + + public RouterBgp getBgp() { + return bgp; + } + + public Builder setBgp(RouterBgp bgp) { + this.bgp = bgp; + return this; + } + + public List getBgpPeersList() { + return bgpPeers; + } + + public Builder addAllBgpPeers(List bgpPeers) { + if (this.bgpPeers == null) { + this.bgpPeers = new ArrayList<>(bgpPeers.size()); + } + this.bgpPeers.addAll(bgpPeers); + return this; + } + + public Builder addBgpPeers(RouterBgpPeer bgpPeers) { + this.bgpPeers.add(bgpPeers); + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getInterfacesList() { + return interfaces; + } + + public Builder addAllInterfaces(List interfaces) { + if (this.interfaces == null) { + this.interfaces = new ArrayList<>(interfaces.size()); + } + this.interfaces.addAll(interfaces); + return this; + } + + public Builder addInterfaces(RouterInterface interfaces) { + this.interfaces.add(interfaces); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Router build() { + + return new Router( + bgp, + bgpPeers, + creationTimestamp, + description, + id, + interfaces, + kind, + name, + network, + region, + selfLink); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setBgp(this.bgp); + newBuilder.addAllBgpPeers(this.bgpPeers); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.addAllInterfaces(this.interfaces); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setNetwork(this.network); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + return newBuilder; + } + } + + @Override + public String toString() { + return "Router{" + + "bgp=" + + bgp + + ", " + + "bgpPeers=" + + bgpPeers + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "interfaces=" + + interfaces + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "network=" + + network + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Router) { + Router that = (Router) o; + return Objects.equals(this.bgp, that.getBgp()) + && Objects.equals(this.bgpPeers, that.getBgpPeersList()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.interfaces, that.getInterfacesList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + bgp, + bgpPeers, + creationTimestamp, + description, + id, + interfaces, + kind, + name, + network, + region, + selfLink); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterAdvertisedIpRange.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterAdvertisedIpRange.java new file mode 100644 index 000000000000..993cfe8968f3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterAdvertisedIpRange.java @@ -0,0 +1,175 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RouterAdvertisedIpRange implements ApiMessage { + private final String description; + private final String range; + + private RouterAdvertisedIpRange() { + this.description = null; + this.range = null; + } + + private RouterAdvertisedIpRange(String description, String range) { + this.description = description; + this.range = range; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("range")) { + return range; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getDescription() { + return description; + } + + public String getRange() { + return range; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RouterAdvertisedIpRange prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RouterAdvertisedIpRange getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RouterAdvertisedIpRange DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RouterAdvertisedIpRange(); + } + + public static class Builder { + private String description; + private String range; + + Builder() {} + + public Builder mergeFrom(RouterAdvertisedIpRange other) { + if (other == RouterAdvertisedIpRange.getDefaultInstance()) return this; + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getRange() != null) { + this.range = other.range; + } + return this; + } + + Builder(RouterAdvertisedIpRange source) { + this.description = source.description; + this.range = source.range; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getRange() { + return range; + } + + public Builder setRange(String range) { + this.range = range; + return this; + } + + public RouterAdvertisedIpRange build() { + + return new RouterAdvertisedIpRange(description, range); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDescription(this.description); + newBuilder.setRange(this.range); + return newBuilder; + } + } + + @Override + public String toString() { + return "RouterAdvertisedIpRange{" + + "description=" + + description + + ", " + + "range=" + + range + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RouterAdvertisedIpRange) { + RouterAdvertisedIpRange that = (RouterAdvertisedIpRange) o; + return Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.range, that.getRange()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(description, range); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterAggregatedList.java new file mode 100644 index 000000000000..dc85b2cc9a5c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RouterAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private RouterAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private RouterAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RouterAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RouterAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RouterAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RouterAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(RouterAggregatedList other) { + if (other == RouterAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(RouterAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public RouterAggregatedList build() { + + return new RouterAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "RouterAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RouterAggregatedList) { + RouterAggregatedList that = (RouterAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterBgp.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterBgp.java new file mode 100644 index 000000000000..bedca25c58d3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterBgp.java @@ -0,0 +1,254 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RouterBgp implements ApiMessage { + private final String advertiseMode; + private final List advertisedGroups; + private final List advertisedIpRanges; + private final Integer asn; + + private RouterBgp() { + this.advertiseMode = null; + this.advertisedGroups = null; + this.advertisedIpRanges = null; + this.asn = null; + } + + private RouterBgp( + String advertiseMode, + List advertisedGroups, + List advertisedIpRanges, + Integer asn) { + this.advertiseMode = advertiseMode; + this.advertisedGroups = advertisedGroups; + this.advertisedIpRanges = advertisedIpRanges; + this.asn = asn; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("advertiseMode")) { + return advertiseMode; + } + if (fieldName.equals("advertisedGroups")) { + return advertisedGroups; + } + if (fieldName.equals("advertisedIpRanges")) { + return advertisedIpRanges; + } + if (fieldName.equals("asn")) { + return asn; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAdvertiseMode() { + return advertiseMode; + } + + public List getAdvertisedGroupsList() { + return advertisedGroups; + } + + public List getAdvertisedIpRangesList() { + return advertisedIpRanges; + } + + public Integer getAsn() { + return asn; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RouterBgp prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RouterBgp getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RouterBgp DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RouterBgp(); + } + + public static class Builder { + private String advertiseMode; + private List advertisedGroups; + private List advertisedIpRanges; + private Integer asn; + + Builder() {} + + public Builder mergeFrom(RouterBgp other) { + if (other == RouterBgp.getDefaultInstance()) return this; + if (other.getAdvertiseMode() != null) { + this.advertiseMode = other.advertiseMode; + } + if (other.getAdvertisedGroupsList() != null) { + this.advertisedGroups = other.advertisedGroups; + } + if (other.getAdvertisedIpRangesList() != null) { + this.advertisedIpRanges = other.advertisedIpRanges; + } + if (other.getAsn() != null) { + this.asn = other.asn; + } + return this; + } + + Builder(RouterBgp source) { + this.advertiseMode = source.advertiseMode; + this.advertisedGroups = source.advertisedGroups; + this.advertisedIpRanges = source.advertisedIpRanges; + this.asn = source.asn; + } + + public String getAdvertiseMode() { + return advertiseMode; + } + + public Builder setAdvertiseMode(String advertiseMode) { + this.advertiseMode = advertiseMode; + return this; + } + + public List getAdvertisedGroupsList() { + return advertisedGroups; + } + + public Builder addAllAdvertisedGroups(List advertisedGroups) { + if (this.advertisedGroups == null) { + this.advertisedGroups = new ArrayList<>(advertisedGroups.size()); + } + this.advertisedGroups.addAll(advertisedGroups); + return this; + } + + public Builder addAdvertisedGroups(String advertisedGroups) { + this.advertisedGroups.add(advertisedGroups); + return this; + } + + public List getAdvertisedIpRangesList() { + return advertisedIpRanges; + } + + public Builder addAllAdvertisedIpRanges(List advertisedIpRanges) { + if (this.advertisedIpRanges == null) { + this.advertisedIpRanges = new ArrayList<>(advertisedIpRanges.size()); + } + this.advertisedIpRanges.addAll(advertisedIpRanges); + return this; + } + + public Builder addAdvertisedIpRanges(RouterAdvertisedIpRange advertisedIpRanges) { + this.advertisedIpRanges.add(advertisedIpRanges); + return this; + } + + public Integer getAsn() { + return asn; + } + + public Builder setAsn(Integer asn) { + this.asn = asn; + return this; + } + + public RouterBgp build() { + + return new RouterBgp(advertiseMode, advertisedGroups, advertisedIpRanges, asn); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAdvertiseMode(this.advertiseMode); + newBuilder.addAllAdvertisedGroups(this.advertisedGroups); + newBuilder.addAllAdvertisedIpRanges(this.advertisedIpRanges); + newBuilder.setAsn(this.asn); + return newBuilder; + } + } + + @Override + public String toString() { + return "RouterBgp{" + + "advertiseMode=" + + advertiseMode + + ", " + + "advertisedGroups=" + + advertisedGroups + + ", " + + "advertisedIpRanges=" + + advertisedIpRanges + + ", " + + "asn=" + + asn + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RouterBgp) { + RouterBgp that = (RouterBgp) o; + return Objects.equals(this.advertiseMode, that.getAdvertiseMode()) + && Objects.equals(this.advertisedGroups, that.getAdvertisedGroupsList()) + && Objects.equals(this.advertisedIpRanges, that.getAdvertisedIpRangesList()) + && Objects.equals(this.asn, that.getAsn()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(advertiseMode, advertisedGroups, advertisedIpRanges, asn); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterBgpPeer.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterBgpPeer.java new file mode 100644 index 000000000000..1667284e364c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterBgpPeer.java @@ -0,0 +1,422 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RouterBgpPeer implements ApiMessage { + private final String advertiseMode; + private final List advertisedGroups; + private final List advertisedIpRanges; + private final Integer advertisedRoutePriority; + private final String interfaceName; + private final String ipAddress; + private final String name; + private final Integer peerAsn; + private final String peerIpAddress; + + private RouterBgpPeer() { + this.advertiseMode = null; + this.advertisedGroups = null; + this.advertisedIpRanges = null; + this.advertisedRoutePriority = null; + this.interfaceName = null; + this.ipAddress = null; + this.name = null; + this.peerAsn = null; + this.peerIpAddress = null; + } + + private RouterBgpPeer( + String advertiseMode, + List advertisedGroups, + List advertisedIpRanges, + Integer advertisedRoutePriority, + String interfaceName, + String ipAddress, + String name, + Integer peerAsn, + String peerIpAddress) { + this.advertiseMode = advertiseMode; + this.advertisedGroups = advertisedGroups; + this.advertisedIpRanges = advertisedIpRanges; + this.advertisedRoutePriority = advertisedRoutePriority; + this.interfaceName = interfaceName; + this.ipAddress = ipAddress; + this.name = name; + this.peerAsn = peerAsn; + this.peerIpAddress = peerIpAddress; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("advertiseMode")) { + return advertiseMode; + } + if (fieldName.equals("advertisedGroups")) { + return advertisedGroups; + } + if (fieldName.equals("advertisedIpRanges")) { + return advertisedIpRanges; + } + if (fieldName.equals("advertisedRoutePriority")) { + return advertisedRoutePriority; + } + if (fieldName.equals("interfaceName")) { + return interfaceName; + } + if (fieldName.equals("ipAddress")) { + return ipAddress; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("peerAsn")) { + return peerAsn; + } + if (fieldName.equals("peerIpAddress")) { + return peerIpAddress; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAdvertiseMode() { + return advertiseMode; + } + + public List getAdvertisedGroupsList() { + return advertisedGroups; + } + + public List getAdvertisedIpRangesList() { + return advertisedIpRanges; + } + + public Integer getAdvertisedRoutePriority() { + return advertisedRoutePriority; + } + + public String getInterfaceName() { + return interfaceName; + } + + public String getIpAddress() { + return ipAddress; + } + + public String getName() { + return name; + } + + public Integer getPeerAsn() { + return peerAsn; + } + + public String getPeerIpAddress() { + return peerIpAddress; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RouterBgpPeer prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RouterBgpPeer getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RouterBgpPeer DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RouterBgpPeer(); + } + + public static class Builder { + private String advertiseMode; + private List advertisedGroups; + private List advertisedIpRanges; + private Integer advertisedRoutePriority; + private String interfaceName; + private String ipAddress; + private String name; + private Integer peerAsn; + private String peerIpAddress; + + Builder() {} + + public Builder mergeFrom(RouterBgpPeer other) { + if (other == RouterBgpPeer.getDefaultInstance()) return this; + if (other.getAdvertiseMode() != null) { + this.advertiseMode = other.advertiseMode; + } + if (other.getAdvertisedGroupsList() != null) { + this.advertisedGroups = other.advertisedGroups; + } + if (other.getAdvertisedIpRangesList() != null) { + this.advertisedIpRanges = other.advertisedIpRanges; + } + if (other.getAdvertisedRoutePriority() != null) { + this.advertisedRoutePriority = other.advertisedRoutePriority; + } + if (other.getInterfaceName() != null) { + this.interfaceName = other.interfaceName; + } + if (other.getIpAddress() != null) { + this.ipAddress = other.ipAddress; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPeerAsn() != null) { + this.peerAsn = other.peerAsn; + } + if (other.getPeerIpAddress() != null) { + this.peerIpAddress = other.peerIpAddress; + } + return this; + } + + Builder(RouterBgpPeer source) { + this.advertiseMode = source.advertiseMode; + this.advertisedGroups = source.advertisedGroups; + this.advertisedIpRanges = source.advertisedIpRanges; + this.advertisedRoutePriority = source.advertisedRoutePriority; + this.interfaceName = source.interfaceName; + this.ipAddress = source.ipAddress; + this.name = source.name; + this.peerAsn = source.peerAsn; + this.peerIpAddress = source.peerIpAddress; + } + + public String getAdvertiseMode() { + return advertiseMode; + } + + public Builder setAdvertiseMode(String advertiseMode) { + this.advertiseMode = advertiseMode; + return this; + } + + public List getAdvertisedGroupsList() { + return advertisedGroups; + } + + public Builder addAllAdvertisedGroups(List advertisedGroups) { + if (this.advertisedGroups == null) { + this.advertisedGroups = new ArrayList<>(advertisedGroups.size()); + } + this.advertisedGroups.addAll(advertisedGroups); + return this; + } + + public Builder addAdvertisedGroups(String advertisedGroups) { + this.advertisedGroups.add(advertisedGroups); + return this; + } + + public List getAdvertisedIpRangesList() { + return advertisedIpRanges; + } + + public Builder addAllAdvertisedIpRanges(List advertisedIpRanges) { + if (this.advertisedIpRanges == null) { + this.advertisedIpRanges = new ArrayList<>(advertisedIpRanges.size()); + } + this.advertisedIpRanges.addAll(advertisedIpRanges); + return this; + } + + public Builder addAdvertisedIpRanges(RouterAdvertisedIpRange advertisedIpRanges) { + this.advertisedIpRanges.add(advertisedIpRanges); + return this; + } + + public Integer getAdvertisedRoutePriority() { + return advertisedRoutePriority; + } + + public Builder setAdvertisedRoutePriority(Integer advertisedRoutePriority) { + this.advertisedRoutePriority = advertisedRoutePriority; + return this; + } + + public String getInterfaceName() { + return interfaceName; + } + + public Builder setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + return this; + } + + public String getIpAddress() { + return ipAddress; + } + + public Builder setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Integer getPeerAsn() { + return peerAsn; + } + + public Builder setPeerAsn(Integer peerAsn) { + this.peerAsn = peerAsn; + return this; + } + + public String getPeerIpAddress() { + return peerIpAddress; + } + + public Builder setPeerIpAddress(String peerIpAddress) { + this.peerIpAddress = peerIpAddress; + return this; + } + + public RouterBgpPeer build() { + + return new RouterBgpPeer( + advertiseMode, + advertisedGroups, + advertisedIpRanges, + advertisedRoutePriority, + interfaceName, + ipAddress, + name, + peerAsn, + peerIpAddress); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAdvertiseMode(this.advertiseMode); + newBuilder.addAllAdvertisedGroups(this.advertisedGroups); + newBuilder.addAllAdvertisedIpRanges(this.advertisedIpRanges); + newBuilder.setAdvertisedRoutePriority(this.advertisedRoutePriority); + newBuilder.setInterfaceName(this.interfaceName); + newBuilder.setIpAddress(this.ipAddress); + newBuilder.setName(this.name); + newBuilder.setPeerAsn(this.peerAsn); + newBuilder.setPeerIpAddress(this.peerIpAddress); + return newBuilder; + } + } + + @Override + public String toString() { + return "RouterBgpPeer{" + + "advertiseMode=" + + advertiseMode + + ", " + + "advertisedGroups=" + + advertisedGroups + + ", " + + "advertisedIpRanges=" + + advertisedIpRanges + + ", " + + "advertisedRoutePriority=" + + advertisedRoutePriority + + ", " + + "interfaceName=" + + interfaceName + + ", " + + "ipAddress=" + + ipAddress + + ", " + + "name=" + + name + + ", " + + "peerAsn=" + + peerAsn + + ", " + + "peerIpAddress=" + + peerIpAddress + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RouterBgpPeer) { + RouterBgpPeer that = (RouterBgpPeer) o; + return Objects.equals(this.advertiseMode, that.getAdvertiseMode()) + && Objects.equals(this.advertisedGroups, that.getAdvertisedGroupsList()) + && Objects.equals(this.advertisedIpRanges, that.getAdvertisedIpRangesList()) + && Objects.equals(this.advertisedRoutePriority, that.getAdvertisedRoutePriority()) + && Objects.equals(this.interfaceName, that.getInterfaceName()) + && Objects.equals(this.ipAddress, that.getIpAddress()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.peerAsn, that.getPeerAsn()) + && Objects.equals(this.peerIpAddress, that.getPeerIpAddress()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + advertiseMode, + advertisedGroups, + advertisedIpRanges, + advertisedRoutePriority, + interfaceName, + ipAddress, + name, + peerAsn, + peerIpAddress); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterClient.java new file mode 100644 index 000000000000..5b7b27180607 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterClient.java @@ -0,0 +1,1352 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.RouterStub; +import com.google.cloud.compute.v1.stub.RouterStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (RouterClient routerClient = RouterClient.create()) {
+ *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+ *   Operation response = routerClient.deleteRouter(router);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the routerClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of RouterSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * RouterSettings routerSettings =
+ *     RouterSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * RouterClient routerClient =
+ *     RouterClient.create(routerSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * RouterSettings routerSettings =
+ *     RouterSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RouterClient routerClient =
+ *     RouterClient.create(routerSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RouterClient implements BackgroundResource { + private final RouterSettings settings; + private final RouterStub stub; + + /** Constructs an instance of RouterClient with default settings. */ + public static final RouterClient create() throws IOException { + return create(RouterSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RouterClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final RouterClient create(RouterSettings settings) throws IOException { + return new RouterClient(settings); + } + + /** + * Constructs an instance of RouterClient, using the given stub for making calls. This is for + * advanced usage - prefer to use RouterSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final RouterClient create(RouterStub stub) { + return new RouterClient(stub); + } + + /** + * Constructs an instance of RouterClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected RouterClient(RouterSettings settings) throws IOException { + this.settings = settings; + this.stub = ((RouterStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected RouterClient(RouterStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RouterSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RouterStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of routers. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (RoutersScopedList element : routerClient.aggregatedListRouters(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListRoutersPagedResponse aggregatedListRouters(ProjectName project) { + AggregatedListRoutersHttpRequest request = + AggregatedListRoutersHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListRouters(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of routers. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (RoutersScopedList element : routerClient.aggregatedListRouters(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListRoutersPagedResponse aggregatedListRouters(String project) { + AggregatedListRoutersHttpRequest request = + AggregatedListRoutersHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListRouters(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of routers. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListRoutersHttpRequest request = AggregatedListRoutersHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (RoutersScopedList element : routerClient.aggregatedListRouters(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListRoutersPagedResponse aggregatedListRouters( + AggregatedListRoutersHttpRequest request) { + return aggregatedListRoutersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of routers. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListRoutersHttpRequest request = AggregatedListRoutersHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListRoutersPagedResponse> future = routerClient.aggregatedListRoutersPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (RoutersScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListRoutersPagedCallable() { + return stub.aggregatedListRoutersPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of routers. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListRoutersHttpRequest request = AggregatedListRoutersHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     RouterAggregatedList response = routerClient.aggregatedListRoutersCallable().call(request);
+   *     for (RoutersScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListRoutersCallable() { + return stub.aggregatedListRoutersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Router resource. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Operation response = routerClient.deleteRouter(router);
+   * }
+   * 
+ * + * @param router Name of the Router resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRouter(ProjectRegionRouterName router) { + + DeleteRouterHttpRequest request = + DeleteRouterHttpRequest.newBuilder() + .setRouter(router == null ? null : router.toString()) + .build(); + return deleteRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Router resource. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Operation response = routerClient.deleteRouter(router.toString());
+   * }
+   * 
+ * + * @param router Name of the Router resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRouter(String router) { + + DeleteRouterHttpRequest request = + DeleteRouterHttpRequest.newBuilder().setRouter(router).build(); + return deleteRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Router resource. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   DeleteRouterHttpRequest request = DeleteRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .build();
+   *   Operation response = routerClient.deleteRouter(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteRouter(DeleteRouterHttpRequest request) { + return deleteRouterCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Router resource. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   DeleteRouterHttpRequest request = DeleteRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = routerClient.deleteRouterCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteRouterCallable() { + return stub.deleteRouterCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Router resource. Gets a list of available routers by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router response = routerClient.getRouter(router);
+   * }
+   * 
+ * + * @param router Name of the Router resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Router getRouter(ProjectRegionRouterName router) { + + GetRouterHttpRequest request = + GetRouterHttpRequest.newBuilder() + .setRouter(router == null ? null : router.toString()) + .build(); + return getRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Router resource. Gets a list of available routers by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router response = routerClient.getRouter(router.toString());
+   * }
+   * 
+ * + * @param router Name of the Router resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Router getRouter(String router) { + + GetRouterHttpRequest request = GetRouterHttpRequest.newBuilder().setRouter(router).build(); + return getRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Router resource. Gets a list of available routers by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   GetRouterHttpRequest request = GetRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .build();
+   *   Router response = routerClient.getRouter(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Router getRouter(GetRouterHttpRequest request) { + return getRouterCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Router resource. Gets a list of available routers by making a list() + * request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   GetRouterHttpRequest request = GetRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .build();
+   *   ApiFuture<Router> future = routerClient.getRouterCallable().futureCall(request);
+   *   // Do something
+   *   Router response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getRouterCallable() { + return stub.getRouterCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves runtime information of the specified router. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   RouterStatusResponse response = routerClient.getRouterStatusRouter(router);
+   * }
+   * 
+ * + * @param router Name of the Router resource to query. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final RouterStatusResponse getRouterStatusRouter(ProjectRegionRouterName router) { + + GetRouterStatusRouterHttpRequest request = + GetRouterStatusRouterHttpRequest.newBuilder() + .setRouter(router == null ? null : router.toString()) + .build(); + return getRouterStatusRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves runtime information of the specified router. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   RouterStatusResponse response = routerClient.getRouterStatusRouter(router.toString());
+   * }
+   * 
+ * + * @param router Name of the Router resource to query. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final RouterStatusResponse getRouterStatusRouter(String router) { + + GetRouterStatusRouterHttpRequest request = + GetRouterStatusRouterHttpRequest.newBuilder().setRouter(router).build(); + return getRouterStatusRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves runtime information of the specified router. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   GetRouterStatusRouterHttpRequest request = GetRouterStatusRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .build();
+   *   RouterStatusResponse response = routerClient.getRouterStatusRouter(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final RouterStatusResponse getRouterStatusRouter( + GetRouterStatusRouterHttpRequest request) { + return getRouterStatusRouterCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves runtime information of the specified router. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   GetRouterStatusRouterHttpRequest request = GetRouterStatusRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .build();
+   *   ApiFuture<RouterStatusResponse> future = routerClient.getRouterStatusRouterCallable().futureCall(request);
+   *   // Do something
+   *   RouterStatusResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getRouterStatusRouterCallable() { + return stub.getRouterStatusRouterCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Router resource in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   Operation response = routerClient.insertRouter(region, routerResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param routerResource Router resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRouter(ProjectRegionName region, Router routerResource) { + + InsertRouterHttpRequest request = + InsertRouterHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setRouterResource(routerResource) + .build(); + return insertRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Router resource in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   Operation response = routerClient.insertRouter(region.toString(), routerResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param routerResource Router resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRouter(String region, Router routerResource) { + + InsertRouterHttpRequest request = + InsertRouterHttpRequest.newBuilder() + .setRegion(region) + .setRouterResource(routerResource) + .build(); + return insertRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Router resource in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   InsertRouterHttpRequest request = InsertRouterHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setRouterResource(routerResource)
+   *     .build();
+   *   Operation response = routerClient.insertRouter(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertRouter(InsertRouterHttpRequest request) { + return insertRouterCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a Router resource in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   InsertRouterHttpRequest request = InsertRouterHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setRouterResource(routerResource)
+   *     .build();
+   *   ApiFuture<Operation> future = routerClient.insertRouterCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertRouterCallable() { + return stub.insertRouterCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Router resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Router element : routerClient.listRouters(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRoutersPagedResponse listRouters(ProjectRegionName region) { + ListRoutersHttpRequest request = + ListRoutersHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listRouters(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Router resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Router element : routerClient.listRouters(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRoutersPagedResponse listRouters(String region) { + ListRoutersHttpRequest request = ListRoutersHttpRequest.newBuilder().setRegion(region).build(); + return listRouters(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Router resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRoutersHttpRequest request = ListRoutersHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (Router element : routerClient.listRouters(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListRoutersPagedResponse listRouters(ListRoutersHttpRequest request) { + return listRoutersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Router resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRoutersHttpRequest request = ListRoutersHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListRoutersPagedResponse> future = routerClient.listRoutersPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Router element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listRoutersPagedCallable() { + return stub.listRoutersPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Router resources available to the specified project. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListRoutersHttpRequest request = ListRoutersHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     RouterList response = routerClient.listRoutersCallable().call(request);
+   *     for (Router element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listRoutersCallable() { + return stub.listRoutersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified Router resource with the data included in the request. This method + * supports PATCH semantics and uses JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   Operation response = routerClient.patchRouter(router, routerResource);
+   * }
+   * 
+ * + * @param router Name of the Router resource to patch. + * @param routerResource Router resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchRouter(ProjectRegionRouterName router, Router routerResource) { + + PatchRouterHttpRequest request = + PatchRouterHttpRequest.newBuilder() + .setRouter(router == null ? null : router.toString()) + .setRouterResource(routerResource) + .build(); + return patchRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified Router resource with the data included in the request. This method + * supports PATCH semantics and uses JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   Operation response = routerClient.patchRouter(router.toString(), routerResource);
+   * }
+   * 
+ * + * @param router Name of the Router resource to patch. + * @param routerResource Router resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchRouter(String router, Router routerResource) { + + PatchRouterHttpRequest request = + PatchRouterHttpRequest.newBuilder() + .setRouter(router) + .setRouterResource(routerResource) + .build(); + return patchRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified Router resource with the data included in the request. This method + * supports PATCH semantics and uses JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   PatchRouterHttpRequest request = PatchRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .setRouterResource(routerResource)
+   *     .build();
+   *   Operation response = routerClient.patchRouter(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchRouter(PatchRouterHttpRequest request) { + return patchRouterCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified Router resource with the data included in the request. This method + * supports PATCH semantics and uses JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   PatchRouterHttpRequest request = PatchRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .setRouterResource(routerResource)
+   *     .build();
+   *   ApiFuture<Operation> future = routerClient.patchRouterCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable patchRouterCallable() { + return stub.patchRouterCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Preview fields auto-generated during router create and update operations. Calling this method + * does NOT create or update the router. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   RoutersPreviewResponse response = routerClient.previewRouter(router, routerResource);
+   * }
+   * 
+ * + * @param router Name of the Router resource to query. + * @param routerResource Router resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final RoutersPreviewResponse previewRouter( + ProjectRegionRouterName router, Router routerResource) { + + PreviewRouterHttpRequest request = + PreviewRouterHttpRequest.newBuilder() + .setRouter(router == null ? null : router.toString()) + .setRouterResource(routerResource) + .build(); + return previewRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Preview fields auto-generated during router create and update operations. Calling this method + * does NOT create or update the router. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   RoutersPreviewResponse response = routerClient.previewRouter(router.toString(), routerResource);
+   * }
+   * 
+ * + * @param router Name of the Router resource to query. + * @param routerResource Router resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final RoutersPreviewResponse previewRouter(String router, Router routerResource) { + + PreviewRouterHttpRequest request = + PreviewRouterHttpRequest.newBuilder() + .setRouter(router) + .setRouterResource(routerResource) + .build(); + return previewRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Preview fields auto-generated during router create and update operations. Calling this method + * does NOT create or update the router. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   PreviewRouterHttpRequest request = PreviewRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .setRouterResource(routerResource)
+   *     .build();
+   *   RoutersPreviewResponse response = routerClient.previewRouter(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final RoutersPreviewResponse previewRouter(PreviewRouterHttpRequest request) { + return previewRouterCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Preview fields auto-generated during router create and update operations. Calling this method + * does NOT create or update the router. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   PreviewRouterHttpRequest request = PreviewRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .setRouterResource(routerResource)
+   *     .build();
+   *   ApiFuture<RoutersPreviewResponse> future = routerClient.previewRouterCallable().futureCall(request);
+   *   // Do something
+   *   RoutersPreviewResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + previewRouterCallable() { + return stub.previewRouterCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified Router resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   Operation response = routerClient.updateRouter(router, routerResource);
+   * }
+   * 
+ * + * @param router Name of the Router resource to update. + * @param routerResource Router resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateRouter(ProjectRegionRouterName router, Router routerResource) { + + UpdateRouterHttpRequest request = + UpdateRouterHttpRequest.newBuilder() + .setRouter(router == null ? null : router.toString()) + .setRouterResource(routerResource) + .build(); + return updateRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified Router resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   Operation response = routerClient.updateRouter(router.toString(), routerResource);
+   * }
+   * 
+ * + * @param router Name of the Router resource to update. + * @param routerResource Router resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateRouter(String router, Router routerResource) { + + UpdateRouterHttpRequest request = + UpdateRouterHttpRequest.newBuilder() + .setRouter(router) + .setRouterResource(routerResource) + .build(); + return updateRouter(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified Router resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   UpdateRouterHttpRequest request = UpdateRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .setRouterResource(routerResource)
+   *     .build();
+   *   Operation response = routerClient.updateRouter(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateRouter(UpdateRouterHttpRequest request) { + return updateRouterCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified Router resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (RouterClient routerClient = RouterClient.create()) {
+   *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+   *   Router routerResource = Router.newBuilder().build();
+   *   UpdateRouterHttpRequest request = UpdateRouterHttpRequest.newBuilder()
+   *     .setRouter(router.toString())
+   *     .setRouterResource(routerResource)
+   *     .build();
+   *   ApiFuture<Operation> future = routerClient.updateRouterCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable updateRouterCallable() { + return stub.updateRouterCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListRoutersPagedResponse + extends AbstractPagedListResponse< + AggregatedListRoutersHttpRequest, RouterAggregatedList, RoutersScopedList, + AggregatedListRoutersPage, AggregatedListRoutersFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListRoutersPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public AggregatedListRoutersPagedResponse apply(AggregatedListRoutersPage input) { + return new AggregatedListRoutersPagedResponse(input); + } + }); + } + + private AggregatedListRoutersPagedResponse(AggregatedListRoutersPage page) { + super(page, AggregatedListRoutersFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListRoutersPage + extends AbstractPage< + AggregatedListRoutersHttpRequest, RouterAggregatedList, RoutersScopedList, + AggregatedListRoutersPage> { + + private AggregatedListRoutersPage( + PageContext + context, + RouterAggregatedList response) { + super(context, response); + } + + private static AggregatedListRoutersPage createEmptyPage() { + return new AggregatedListRoutersPage(null, null); + } + + @Override + protected AggregatedListRoutersPage createPage( + PageContext + context, + RouterAggregatedList response) { + return new AggregatedListRoutersPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListRoutersFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListRoutersHttpRequest, RouterAggregatedList, RoutersScopedList, + AggregatedListRoutersPage, AggregatedListRoutersFixedSizeCollection> { + + private AggregatedListRoutersFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListRoutersFixedSizeCollection createEmptyCollection() { + return new AggregatedListRoutersFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListRoutersFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListRoutersFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListRoutersPagedResponse + extends AbstractPagedListResponse< + ListRoutersHttpRequest, RouterList, Router, ListRoutersPage, + ListRoutersFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRoutersPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListRoutersPagedResponse apply(ListRoutersPage input) { + return new ListRoutersPagedResponse(input); + } + }); + } + + private ListRoutersPagedResponse(ListRoutersPage page) { + super(page, ListRoutersFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRoutersPage + extends AbstractPage { + + private ListRoutersPage( + PageContext context, RouterList response) { + super(context, response); + } + + private static ListRoutersPage createEmptyPage() { + return new ListRoutersPage(null, null); + } + + @Override + protected ListRoutersPage createPage( + PageContext context, RouterList response) { + return new ListRoutersPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRoutersFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRoutersHttpRequest, RouterList, Router, ListRoutersPage, + ListRoutersFixedSizeCollection> { + + private ListRoutersFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRoutersFixedSizeCollection createEmptyCollection() { + return new ListRoutersFixedSizeCollection(null, 0); + } + + @Override + protected ListRoutersFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRoutersFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterInterface.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterInterface.java new file mode 100644 index 000000000000..90b406d53037 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterInterface.java @@ -0,0 +1,235 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RouterInterface implements ApiMessage { + private final String ipRange; + private final String linkedInterconnectAttachment; + private final String linkedVpnTunnel; + private final String name; + + private RouterInterface() { + this.ipRange = null; + this.linkedInterconnectAttachment = null; + this.linkedVpnTunnel = null; + this.name = null; + } + + private RouterInterface( + String ipRange, String linkedInterconnectAttachment, String linkedVpnTunnel, String name) { + this.ipRange = ipRange; + this.linkedInterconnectAttachment = linkedInterconnectAttachment; + this.linkedVpnTunnel = linkedVpnTunnel; + this.name = name; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("ipRange")) { + return ipRange; + } + if (fieldName.equals("linkedInterconnectAttachment")) { + return linkedInterconnectAttachment; + } + if (fieldName.equals("linkedVpnTunnel")) { + return linkedVpnTunnel; + } + if (fieldName.equals("name")) { + return name; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getIpRange() { + return ipRange; + } + + public String getLinkedInterconnectAttachment() { + return linkedInterconnectAttachment; + } + + public String getLinkedVpnTunnel() { + return linkedVpnTunnel; + } + + public String getName() { + return name; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RouterInterface prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RouterInterface getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RouterInterface DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RouterInterface(); + } + + public static class Builder { + private String ipRange; + private String linkedInterconnectAttachment; + private String linkedVpnTunnel; + private String name; + + Builder() {} + + public Builder mergeFrom(RouterInterface other) { + if (other == RouterInterface.getDefaultInstance()) return this; + if (other.getIpRange() != null) { + this.ipRange = other.ipRange; + } + if (other.getLinkedInterconnectAttachment() != null) { + this.linkedInterconnectAttachment = other.linkedInterconnectAttachment; + } + if (other.getLinkedVpnTunnel() != null) { + this.linkedVpnTunnel = other.linkedVpnTunnel; + } + if (other.getName() != null) { + this.name = other.name; + } + return this; + } + + Builder(RouterInterface source) { + this.ipRange = source.ipRange; + this.linkedInterconnectAttachment = source.linkedInterconnectAttachment; + this.linkedVpnTunnel = source.linkedVpnTunnel; + this.name = source.name; + } + + public String getIpRange() { + return ipRange; + } + + public Builder setIpRange(String ipRange) { + this.ipRange = ipRange; + return this; + } + + public String getLinkedInterconnectAttachment() { + return linkedInterconnectAttachment; + } + + public Builder setLinkedInterconnectAttachment(String linkedInterconnectAttachment) { + this.linkedInterconnectAttachment = linkedInterconnectAttachment; + return this; + } + + public String getLinkedVpnTunnel() { + return linkedVpnTunnel; + } + + public Builder setLinkedVpnTunnel(String linkedVpnTunnel) { + this.linkedVpnTunnel = linkedVpnTunnel; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public RouterInterface build() { + + return new RouterInterface(ipRange, linkedInterconnectAttachment, linkedVpnTunnel, name); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setIpRange(this.ipRange); + newBuilder.setLinkedInterconnectAttachment(this.linkedInterconnectAttachment); + newBuilder.setLinkedVpnTunnel(this.linkedVpnTunnel); + newBuilder.setName(this.name); + return newBuilder; + } + } + + @Override + public String toString() { + return "RouterInterface{" + + "ipRange=" + + ipRange + + ", " + + "linkedInterconnectAttachment=" + + linkedInterconnectAttachment + + ", " + + "linkedVpnTunnel=" + + linkedVpnTunnel + + ", " + + "name=" + + name + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RouterInterface) { + RouterInterface that = (RouterInterface) o; + return Objects.equals(this.ipRange, that.getIpRange()) + && Objects.equals( + this.linkedInterconnectAttachment, that.getLinkedInterconnectAttachment()) + && Objects.equals(this.linkedVpnTunnel, that.getLinkedVpnTunnel()) + && Objects.equals(this.name, that.getName()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(ipRange, linkedInterconnectAttachment, linkedVpnTunnel, name); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterList.java new file mode 100644 index 000000000000..cc8bd25b138d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RouterList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private RouterList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private RouterList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RouterList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RouterList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RouterList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RouterList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(RouterList other) { + if (other == RouterList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(RouterList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Router items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public RouterList build() { + + return new RouterList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "RouterList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RouterList) { + RouterList that = (RouterList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterSettings.java new file mode 100644 index 000000000000..a388c432ddf0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterSettings.java @@ -0,0 +1,275 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RouterClient.AggregatedListRoutersPagedResponse; +import static com.google.cloud.compute.v1.RouterClient.ListRoutersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.RouterStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RouterClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteRouter to 30 seconds: + * + *

+ * 
+ * RouterSettings.Builder routerSettingsBuilder =
+ *     RouterSettings.newBuilder();
+ * routerSettingsBuilder.deleteRouterSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RouterSettings routerSettings = routerSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RouterSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListRouters. */ + public PagedCallSettings< + AggregatedListRoutersHttpRequest, RouterAggregatedList, + AggregatedListRoutersPagedResponse> + aggregatedListRoutersSettings() { + return ((RouterStubSettings) getStubSettings()).aggregatedListRoutersSettings(); + } + + /** Returns the object with the settings used for calls to deleteRouter. */ + public UnaryCallSettings deleteRouterSettings() { + return ((RouterStubSettings) getStubSettings()).deleteRouterSettings(); + } + + /** Returns the object with the settings used for calls to getRouter. */ + public UnaryCallSettings getRouterSettings() { + return ((RouterStubSettings) getStubSettings()).getRouterSettings(); + } + + /** Returns the object with the settings used for calls to getRouterStatusRouter. */ + public UnaryCallSettings + getRouterStatusRouterSettings() { + return ((RouterStubSettings) getStubSettings()).getRouterStatusRouterSettings(); + } + + /** Returns the object with the settings used for calls to insertRouter. */ + public UnaryCallSettings insertRouterSettings() { + return ((RouterStubSettings) getStubSettings()).insertRouterSettings(); + } + + /** Returns the object with the settings used for calls to listRouters. */ + public PagedCallSettings + listRoutersSettings() { + return ((RouterStubSettings) getStubSettings()).listRoutersSettings(); + } + + /** Returns the object with the settings used for calls to patchRouter. */ + public UnaryCallSettings patchRouterSettings() { + return ((RouterStubSettings) getStubSettings()).patchRouterSettings(); + } + + /** Returns the object with the settings used for calls to previewRouter. */ + public UnaryCallSettings + previewRouterSettings() { + return ((RouterStubSettings) getStubSettings()).previewRouterSettings(); + } + + /** Returns the object with the settings used for calls to updateRouter. */ + public UnaryCallSettings updateRouterSettings() { + return ((RouterStubSettings) getStubSettings()).updateRouterSettings(); + } + + public static final RouterSettings create(RouterStubSettings stub) throws IOException { + return new RouterSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return RouterStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return RouterStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return RouterStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return RouterStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return RouterStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return RouterStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return RouterStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return RouterStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RouterSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for RouterSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(RouterStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(RouterStubSettings.newBuilder()); + } + + protected Builder(RouterSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(RouterStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public RouterStubSettings.Builder getStubSettingsBuilder() { + return ((RouterStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListRouters. */ + public PagedCallSettings.Builder< + AggregatedListRoutersHttpRequest, RouterAggregatedList, + AggregatedListRoutersPagedResponse> + aggregatedListRoutersSettings() { + return getStubSettingsBuilder().aggregatedListRoutersSettings(); + } + + /** Returns the builder for the settings used for calls to deleteRouter. */ + public UnaryCallSettings.Builder deleteRouterSettings() { + return getStubSettingsBuilder().deleteRouterSettings(); + } + + /** Returns the builder for the settings used for calls to getRouter. */ + public UnaryCallSettings.Builder getRouterSettings() { + return getStubSettingsBuilder().getRouterSettings(); + } + + /** Returns the builder for the settings used for calls to getRouterStatusRouter. */ + public UnaryCallSettings.Builder + getRouterStatusRouterSettings() { + return getStubSettingsBuilder().getRouterStatusRouterSettings(); + } + + /** Returns the builder for the settings used for calls to insertRouter. */ + public UnaryCallSettings.Builder insertRouterSettings() { + return getStubSettingsBuilder().insertRouterSettings(); + } + + /** Returns the builder for the settings used for calls to listRouters. */ + public PagedCallSettings.Builder + listRoutersSettings() { + return getStubSettingsBuilder().listRoutersSettings(); + } + + /** Returns the builder for the settings used for calls to patchRouter. */ + public UnaryCallSettings.Builder patchRouterSettings() { + return getStubSettingsBuilder().patchRouterSettings(); + } + + /** Returns the builder for the settings used for calls to previewRouter. */ + public UnaryCallSettings.Builder + previewRouterSettings() { + return getStubSettingsBuilder().previewRouterSettings(); + } + + /** Returns the builder for the settings used for calls to updateRouter. */ + public UnaryCallSettings.Builder updateRouterSettings() { + return getStubSettingsBuilder().updateRouterSettings(); + } + + @Override + public RouterSettings build() throws IOException { + return new RouterSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterStatus.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterStatus.java new file mode 100644 index 000000000000..ed6892ffe4aa --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterStatus.java @@ -0,0 +1,262 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RouterStatus implements ApiMessage { + private final List bestRoutes; + private final List bestRoutesForRouter; + private final List bgpPeerStatus; + private final String network; + + private RouterStatus() { + this.bestRoutes = null; + this.bestRoutesForRouter = null; + this.bgpPeerStatus = null; + this.network = null; + } + + private RouterStatus( + List bestRoutes, + List bestRoutesForRouter, + List bgpPeerStatus, + String network) { + this.bestRoutes = bestRoutes; + this.bestRoutesForRouter = bestRoutesForRouter; + this.bgpPeerStatus = bgpPeerStatus; + this.network = network; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("bestRoutes")) { + return bestRoutes; + } + if (fieldName.equals("bestRoutesForRouter")) { + return bestRoutesForRouter; + } + if (fieldName.equals("bgpPeerStatus")) { + return bgpPeerStatus; + } + if (fieldName.equals("network")) { + return network; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getBestRoutesList() { + return bestRoutes; + } + + public List getBestRoutesForRouterList() { + return bestRoutesForRouter; + } + + public List getBgpPeerStatusList() { + return bgpPeerStatus; + } + + public String getNetwork() { + return network; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RouterStatus prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RouterStatus getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RouterStatus DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RouterStatus(); + } + + public static class Builder { + private List bestRoutes; + private List bestRoutesForRouter; + private List bgpPeerStatus; + private String network; + + Builder() {} + + public Builder mergeFrom(RouterStatus other) { + if (other == RouterStatus.getDefaultInstance()) return this; + if (other.getBestRoutesList() != null) { + this.bestRoutes = other.bestRoutes; + } + if (other.getBestRoutesForRouterList() != null) { + this.bestRoutesForRouter = other.bestRoutesForRouter; + } + if (other.getBgpPeerStatusList() != null) { + this.bgpPeerStatus = other.bgpPeerStatus; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + return this; + } + + Builder(RouterStatus source) { + this.bestRoutes = source.bestRoutes; + this.bestRoutesForRouter = source.bestRoutesForRouter; + this.bgpPeerStatus = source.bgpPeerStatus; + this.network = source.network; + } + + public List getBestRoutesList() { + return bestRoutes; + } + + public Builder addAllBestRoutes(List bestRoutes) { + if (this.bestRoutes == null) { + this.bestRoutes = new ArrayList<>(bestRoutes.size()); + } + this.bestRoutes.addAll(bestRoutes); + return this; + } + + public Builder addBestRoutes(Route bestRoutes) { + this.bestRoutes.add(bestRoutes); + return this; + } + + public List getBestRoutesForRouterList() { + return bestRoutesForRouter; + } + + public Builder addAllBestRoutesForRouter(List bestRoutesForRouter) { + if (this.bestRoutesForRouter == null) { + this.bestRoutesForRouter = new ArrayList<>(bestRoutesForRouter.size()); + } + this.bestRoutesForRouter.addAll(bestRoutesForRouter); + return this; + } + + public Builder addBestRoutesForRouter(Route bestRoutesForRouter) { + this.bestRoutesForRouter.add(bestRoutesForRouter); + return this; + } + + public List getBgpPeerStatusList() { + return bgpPeerStatus; + } + + public Builder addAllBgpPeerStatus(List bgpPeerStatus) { + if (this.bgpPeerStatus == null) { + this.bgpPeerStatus = new ArrayList<>(bgpPeerStatus.size()); + } + this.bgpPeerStatus.addAll(bgpPeerStatus); + return this; + } + + public Builder addBgpPeerStatus(RouterStatusBgpPeerStatus bgpPeerStatus) { + this.bgpPeerStatus.add(bgpPeerStatus); + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public RouterStatus build() { + + return new RouterStatus(bestRoutes, bestRoutesForRouter, bgpPeerStatus, network); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllBestRoutes(this.bestRoutes); + newBuilder.addAllBestRoutesForRouter(this.bestRoutesForRouter); + newBuilder.addAllBgpPeerStatus(this.bgpPeerStatus); + newBuilder.setNetwork(this.network); + return newBuilder; + } + } + + @Override + public String toString() { + return "RouterStatus{" + + "bestRoutes=" + + bestRoutes + + ", " + + "bestRoutesForRouter=" + + bestRoutesForRouter + + ", " + + "bgpPeerStatus=" + + bgpPeerStatus + + ", " + + "network=" + + network + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RouterStatus) { + RouterStatus that = (RouterStatus) o; + return Objects.equals(this.bestRoutes, that.getBestRoutesList()) + && Objects.equals(this.bestRoutesForRouter, that.getBestRoutesForRouterList()) + && Objects.equals(this.bgpPeerStatus, that.getBgpPeerStatusList()) + && Objects.equals(this.network, that.getNetwork()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(bestRoutes, bestRoutesForRouter, bgpPeerStatus, network); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterStatusBgpPeerStatus.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterStatusBgpPeerStatus.java new file mode 100644 index 000000000000..19e08605fdb3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterStatusBgpPeerStatus.java @@ -0,0 +1,446 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RouterStatusBgpPeerStatus implements ApiMessage { + private final List advertisedRoutes; + private final String ipAddress; + private final String linkedVpnTunnel; + private final String name; + private final Integer numLearnedRoutes; + private final String peerIpAddress; + private final String state; + private final String status; + private final String uptime; + private final String uptimeSeconds; + + private RouterStatusBgpPeerStatus() { + this.advertisedRoutes = null; + this.ipAddress = null; + this.linkedVpnTunnel = null; + this.name = null; + this.numLearnedRoutes = null; + this.peerIpAddress = null; + this.state = null; + this.status = null; + this.uptime = null; + this.uptimeSeconds = null; + } + + private RouterStatusBgpPeerStatus( + List advertisedRoutes, + String ipAddress, + String linkedVpnTunnel, + String name, + Integer numLearnedRoutes, + String peerIpAddress, + String state, + String status, + String uptime, + String uptimeSeconds) { + this.advertisedRoutes = advertisedRoutes; + this.ipAddress = ipAddress; + this.linkedVpnTunnel = linkedVpnTunnel; + this.name = name; + this.numLearnedRoutes = numLearnedRoutes; + this.peerIpAddress = peerIpAddress; + this.state = state; + this.status = status; + this.uptime = uptime; + this.uptimeSeconds = uptimeSeconds; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("advertisedRoutes")) { + return advertisedRoutes; + } + if (fieldName.equals("ipAddress")) { + return ipAddress; + } + if (fieldName.equals("linkedVpnTunnel")) { + return linkedVpnTunnel; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("numLearnedRoutes")) { + return numLearnedRoutes; + } + if (fieldName.equals("peerIpAddress")) { + return peerIpAddress; + } + if (fieldName.equals("state")) { + return state; + } + if (fieldName.equals("status")) { + return status; + } + if (fieldName.equals("uptime")) { + return uptime; + } + if (fieldName.equals("uptimeSeconds")) { + return uptimeSeconds; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getAdvertisedRoutesList() { + return advertisedRoutes; + } + + public String getIpAddress() { + return ipAddress; + } + + public String getLinkedVpnTunnel() { + return linkedVpnTunnel; + } + + public String getName() { + return name; + } + + public Integer getNumLearnedRoutes() { + return numLearnedRoutes; + } + + public String getPeerIpAddress() { + return peerIpAddress; + } + + public String getState() { + return state; + } + + public String getStatus() { + return status; + } + + public String getUptime() { + return uptime; + } + + public String getUptimeSeconds() { + return uptimeSeconds; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RouterStatusBgpPeerStatus prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RouterStatusBgpPeerStatus getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RouterStatusBgpPeerStatus DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RouterStatusBgpPeerStatus(); + } + + public static class Builder { + private List advertisedRoutes; + private String ipAddress; + private String linkedVpnTunnel; + private String name; + private Integer numLearnedRoutes; + private String peerIpAddress; + private String state; + private String status; + private String uptime; + private String uptimeSeconds; + + Builder() {} + + public Builder mergeFrom(RouterStatusBgpPeerStatus other) { + if (other == RouterStatusBgpPeerStatus.getDefaultInstance()) return this; + if (other.getAdvertisedRoutesList() != null) { + this.advertisedRoutes = other.advertisedRoutes; + } + if (other.getIpAddress() != null) { + this.ipAddress = other.ipAddress; + } + if (other.getLinkedVpnTunnel() != null) { + this.linkedVpnTunnel = other.linkedVpnTunnel; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNumLearnedRoutes() != null) { + this.numLearnedRoutes = other.numLearnedRoutes; + } + if (other.getPeerIpAddress() != null) { + this.peerIpAddress = other.peerIpAddress; + } + if (other.getState() != null) { + this.state = other.state; + } + if (other.getStatus() != null) { + this.status = other.status; + } + if (other.getUptime() != null) { + this.uptime = other.uptime; + } + if (other.getUptimeSeconds() != null) { + this.uptimeSeconds = other.uptimeSeconds; + } + return this; + } + + Builder(RouterStatusBgpPeerStatus source) { + this.advertisedRoutes = source.advertisedRoutes; + this.ipAddress = source.ipAddress; + this.linkedVpnTunnel = source.linkedVpnTunnel; + this.name = source.name; + this.numLearnedRoutes = source.numLearnedRoutes; + this.peerIpAddress = source.peerIpAddress; + this.state = source.state; + this.status = source.status; + this.uptime = source.uptime; + this.uptimeSeconds = source.uptimeSeconds; + } + + public List getAdvertisedRoutesList() { + return advertisedRoutes; + } + + public Builder addAllAdvertisedRoutes(List advertisedRoutes) { + if (this.advertisedRoutes == null) { + this.advertisedRoutes = new ArrayList<>(advertisedRoutes.size()); + } + this.advertisedRoutes.addAll(advertisedRoutes); + return this; + } + + public Builder addAdvertisedRoutes(Route advertisedRoutes) { + this.advertisedRoutes.add(advertisedRoutes); + return this; + } + + public String getIpAddress() { + return ipAddress; + } + + public Builder setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + public String getLinkedVpnTunnel() { + return linkedVpnTunnel; + } + + public Builder setLinkedVpnTunnel(String linkedVpnTunnel) { + this.linkedVpnTunnel = linkedVpnTunnel; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Integer getNumLearnedRoutes() { + return numLearnedRoutes; + } + + public Builder setNumLearnedRoutes(Integer numLearnedRoutes) { + this.numLearnedRoutes = numLearnedRoutes; + return this; + } + + public String getPeerIpAddress() { + return peerIpAddress; + } + + public Builder setPeerIpAddress(String peerIpAddress) { + this.peerIpAddress = peerIpAddress; + return this; + } + + public String getState() { + return state; + } + + public Builder setState(String state) { + this.state = state; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public String getUptime() { + return uptime; + } + + public Builder setUptime(String uptime) { + this.uptime = uptime; + return this; + } + + public String getUptimeSeconds() { + return uptimeSeconds; + } + + public Builder setUptimeSeconds(String uptimeSeconds) { + this.uptimeSeconds = uptimeSeconds; + return this; + } + + public RouterStatusBgpPeerStatus build() { + + return new RouterStatusBgpPeerStatus( + advertisedRoutes, + ipAddress, + linkedVpnTunnel, + name, + numLearnedRoutes, + peerIpAddress, + state, + status, + uptime, + uptimeSeconds); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllAdvertisedRoutes(this.advertisedRoutes); + newBuilder.setIpAddress(this.ipAddress); + newBuilder.setLinkedVpnTunnel(this.linkedVpnTunnel); + newBuilder.setName(this.name); + newBuilder.setNumLearnedRoutes(this.numLearnedRoutes); + newBuilder.setPeerIpAddress(this.peerIpAddress); + newBuilder.setState(this.state); + newBuilder.setStatus(this.status); + newBuilder.setUptime(this.uptime); + newBuilder.setUptimeSeconds(this.uptimeSeconds); + return newBuilder; + } + } + + @Override + public String toString() { + return "RouterStatusBgpPeerStatus{" + + "advertisedRoutes=" + + advertisedRoutes + + ", " + + "ipAddress=" + + ipAddress + + ", " + + "linkedVpnTunnel=" + + linkedVpnTunnel + + ", " + + "name=" + + name + + ", " + + "numLearnedRoutes=" + + numLearnedRoutes + + ", " + + "peerIpAddress=" + + peerIpAddress + + ", " + + "state=" + + state + + ", " + + "status=" + + status + + ", " + + "uptime=" + + uptime + + ", " + + "uptimeSeconds=" + + uptimeSeconds + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RouterStatusBgpPeerStatus) { + RouterStatusBgpPeerStatus that = (RouterStatusBgpPeerStatus) o; + return Objects.equals(this.advertisedRoutes, that.getAdvertisedRoutesList()) + && Objects.equals(this.ipAddress, that.getIpAddress()) + && Objects.equals(this.linkedVpnTunnel, that.getLinkedVpnTunnel()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.numLearnedRoutes, that.getNumLearnedRoutes()) + && Objects.equals(this.peerIpAddress, that.getPeerIpAddress()) + && Objects.equals(this.state, that.getState()) + && Objects.equals(this.status, that.getStatus()) + && Objects.equals(this.uptime, that.getUptime()) + && Objects.equals(this.uptimeSeconds, that.getUptimeSeconds()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + advertisedRoutes, + ipAddress, + linkedVpnTunnel, + name, + numLearnedRoutes, + peerIpAddress, + state, + status, + uptime, + uptimeSeconds); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterStatusResponse.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterStatusResponse.java new file mode 100644 index 000000000000..270f2fe8ff9d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterStatusResponse.java @@ -0,0 +1,169 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RouterStatusResponse implements ApiMessage { + private final String kind; + private final RouterStatus result; + + private RouterStatusResponse() { + this.kind = null; + this.result = null; + } + + private RouterStatusResponse(String kind, RouterStatus result) { + this.kind = kind; + this.result = result; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("result")) { + return result; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getKind() { + return kind; + } + + public RouterStatus getResult() { + return result; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RouterStatusResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RouterStatusResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RouterStatusResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RouterStatusResponse(); + } + + public static class Builder { + private String kind; + private RouterStatus result; + + Builder() {} + + public Builder mergeFrom(RouterStatusResponse other) { + if (other == RouterStatusResponse.getDefaultInstance()) return this; + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getResult() != null) { + this.result = other.result; + } + return this; + } + + Builder(RouterStatusResponse source) { + this.kind = source.kind; + this.result = source.result; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public RouterStatus getResult() { + return result; + } + + public Builder setResult(RouterStatus result) { + this.result = result; + return this; + } + + public RouterStatusResponse build() { + + return new RouterStatusResponse(kind, result); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setKind(this.kind); + newBuilder.setResult(this.result); + return newBuilder; + } + } + + @Override + public String toString() { + return "RouterStatusResponse{" + "kind=" + kind + ", " + "result=" + result + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RouterStatusResponse) { + RouterStatusResponse that = (RouterStatusResponse) o; + return Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.result, that.getResult()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(kind, result); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RoutersPreviewResponse.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RoutersPreviewResponse.java new file mode 100644 index 000000000000..cfe2dec432e7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RoutersPreviewResponse.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RoutersPreviewResponse implements ApiMessage { + private final Router resource; + + private RoutersPreviewResponse() { + this.resource = null; + } + + private RoutersPreviewResponse(Router resource) { + this.resource = resource; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("resource")) { + return resource; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Router getResource() { + return resource; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RoutersPreviewResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RoutersPreviewResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RoutersPreviewResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RoutersPreviewResponse(); + } + + public static class Builder { + private Router resource; + + Builder() {} + + public Builder mergeFrom(RoutersPreviewResponse other) { + if (other == RoutersPreviewResponse.getDefaultInstance()) return this; + if (other.getResource() != null) { + this.resource = other.resource; + } + return this; + } + + Builder(RoutersPreviewResponse source) { + this.resource = source.resource; + } + + public Router getResource() { + return resource; + } + + public Builder setResource(Router resource) { + this.resource = resource; + return this; + } + + public RoutersPreviewResponse build() { + return new RoutersPreviewResponse(resource); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setResource(this.resource); + return newBuilder; + } + } + + @Override + public String toString() { + return "RoutersPreviewResponse{" + "resource=" + resource + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RoutersPreviewResponse) { + RoutersPreviewResponse that = (RoutersPreviewResponse) o; + return Objects.equals(this.resource, that.getResource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(resource); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RoutersScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RoutersScopedList.java new file mode 100644 index 000000000000..2b101ef397ac --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RoutersScopedList.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class RoutersScopedList implements ApiMessage { + private final List routers; + private final Warning warning; + + private RoutersScopedList() { + this.routers = null; + this.warning = null; + } + + private RoutersScopedList(List routers, Warning warning) { + this.routers = routers; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("routers")) { + return routers; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getRoutersList() { + return routers; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(RoutersScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static RoutersScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final RoutersScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new RoutersScopedList(); + } + + public static class Builder { + private List routers; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(RoutersScopedList other) { + if (other == RoutersScopedList.getDefaultInstance()) return this; + if (other.getRoutersList() != null) { + this.routers = other.routers; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(RoutersScopedList source) { + this.routers = source.routers; + this.warning = source.warning; + } + + public List getRoutersList() { + return routers; + } + + public Builder addAllRouters(List routers) { + if (this.routers == null) { + this.routers = new ArrayList<>(routers.size()); + } + this.routers.addAll(routers); + return this; + } + + public Builder addRouters(Router routers) { + this.routers.add(routers); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public RoutersScopedList build() { + + return new RoutersScopedList(routers, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllRouters(this.routers); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "RoutersScopedList{" + "routers=" + routers + ", " + "warning=" + warning + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof RoutersScopedList) { + RoutersScopedList that = (RoutersScopedList) o; + return Objects.equals(this.routers, that.getRoutersList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(routers, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SSLHealthCheck.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SSLHealthCheck.java new file mode 100644 index 000000000000..608db5cc07ce --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SSLHealthCheck.java @@ -0,0 +1,263 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SSLHealthCheck implements ApiMessage { + private final Integer port; + private final String portName; + private final String proxyHeader; + private final String request; + private final String response; + + private SSLHealthCheck() { + this.port = null; + this.portName = null; + this.proxyHeader = null; + this.request = null; + this.response = null; + } + + private SSLHealthCheck( + Integer port, String portName, String proxyHeader, String request, String response) { + this.port = port; + this.portName = portName; + this.proxyHeader = proxyHeader; + this.request = request; + this.response = response; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("port")) { + return port; + } + if (fieldName.equals("portName")) { + return portName; + } + if (fieldName.equals("proxyHeader")) { + return proxyHeader; + } + if (fieldName.equals("request")) { + return request; + } + if (fieldName.equals("response")) { + return response; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getPort() { + return port; + } + + public String getPortName() { + return portName; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public String getRequest() { + return request; + } + + public String getResponse() { + return response; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SSLHealthCheck prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SSLHealthCheck getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SSLHealthCheck DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SSLHealthCheck(); + } + + public static class Builder { + private Integer port; + private String portName; + private String proxyHeader; + private String request; + private String response; + + Builder() {} + + public Builder mergeFrom(SSLHealthCheck other) { + if (other == SSLHealthCheck.getDefaultInstance()) return this; + if (other.getPort() != null) { + this.port = other.port; + } + if (other.getPortName() != null) { + this.portName = other.portName; + } + if (other.getProxyHeader() != null) { + this.proxyHeader = other.proxyHeader; + } + if (other.getRequest() != null) { + this.request = other.request; + } + if (other.getResponse() != null) { + this.response = other.response; + } + return this; + } + + Builder(SSLHealthCheck source) { + this.port = source.port; + this.portName = source.portName; + this.proxyHeader = source.proxyHeader; + this.request = source.request; + this.response = source.response; + } + + public Integer getPort() { + return port; + } + + public Builder setPort(Integer port) { + this.port = port; + return this; + } + + public String getPortName() { + return portName; + } + + public Builder setPortName(String portName) { + this.portName = portName; + return this; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public Builder setProxyHeader(String proxyHeader) { + this.proxyHeader = proxyHeader; + return this; + } + + public String getRequest() { + return request; + } + + public Builder setRequest(String request) { + this.request = request; + return this; + } + + public String getResponse() { + return response; + } + + public Builder setResponse(String response) { + this.response = response; + return this; + } + + public SSLHealthCheck build() { + + return new SSLHealthCheck(port, portName, proxyHeader, request, response); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setPort(this.port); + newBuilder.setPortName(this.portName); + newBuilder.setProxyHeader(this.proxyHeader); + newBuilder.setRequest(this.request); + newBuilder.setResponse(this.response); + return newBuilder; + } + } + + @Override + public String toString() { + return "SSLHealthCheck{" + + "port=" + + port + + ", " + + "portName=" + + portName + + ", " + + "proxyHeader=" + + proxyHeader + + ", " + + "request=" + + request + + ", " + + "response=" + + response + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SSLHealthCheck) { + SSLHealthCheck that = (SSLHealthCheck) o; + return Objects.equals(this.port, that.getPort()) + && Objects.equals(this.portName, that.getPortName()) + && Objects.equals(this.proxyHeader, that.getProxyHeader()) + && Objects.equals(this.request, that.getRequest()) + && Objects.equals(this.response, that.getResponse()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(port, portName, proxyHeader, request, response); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Scheduling.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Scheduling.java new file mode 100644 index 000000000000..9b44ee823a01 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Scheduling.java @@ -0,0 +1,204 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Scheduling implements ApiMessage { + private final Boolean automaticRestart; + private final String onHostMaintenance; + private final Boolean preemptible; + + private Scheduling() { + this.automaticRestart = null; + this.onHostMaintenance = null; + this.preemptible = null; + } + + private Scheduling(Boolean automaticRestart, String onHostMaintenance, Boolean preemptible) { + this.automaticRestart = automaticRestart; + this.onHostMaintenance = onHostMaintenance; + this.preemptible = preemptible; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("automaticRestart")) { + return automaticRestart; + } + if (fieldName.equals("onHostMaintenance")) { + return onHostMaintenance; + } + if (fieldName.equals("preemptible")) { + return preemptible; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getAutomaticRestart() { + return automaticRestart; + } + + public String getOnHostMaintenance() { + return onHostMaintenance; + } + + public Boolean getPreemptible() { + return preemptible; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Scheduling prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Scheduling getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Scheduling DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Scheduling(); + } + + public static class Builder { + private Boolean automaticRestart; + private String onHostMaintenance; + private Boolean preemptible; + + Builder() {} + + public Builder mergeFrom(Scheduling other) { + if (other == Scheduling.getDefaultInstance()) return this; + if (other.getAutomaticRestart() != null) { + this.automaticRestart = other.automaticRestart; + } + if (other.getOnHostMaintenance() != null) { + this.onHostMaintenance = other.onHostMaintenance; + } + if (other.getPreemptible() != null) { + this.preemptible = other.preemptible; + } + return this; + } + + Builder(Scheduling source) { + this.automaticRestart = source.automaticRestart; + this.onHostMaintenance = source.onHostMaintenance; + this.preemptible = source.preemptible; + } + + public Boolean getAutomaticRestart() { + return automaticRestart; + } + + public Builder setAutomaticRestart(Boolean automaticRestart) { + this.automaticRestart = automaticRestart; + return this; + } + + public String getOnHostMaintenance() { + return onHostMaintenance; + } + + public Builder setOnHostMaintenance(String onHostMaintenance) { + this.onHostMaintenance = onHostMaintenance; + return this; + } + + public Boolean getPreemptible() { + return preemptible; + } + + public Builder setPreemptible(Boolean preemptible) { + this.preemptible = preemptible; + return this; + } + + public Scheduling build() { + + return new Scheduling(automaticRestart, onHostMaintenance, preemptible); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAutomaticRestart(this.automaticRestart); + newBuilder.setOnHostMaintenance(this.onHostMaintenance); + newBuilder.setPreemptible(this.preemptible); + return newBuilder; + } + } + + @Override + public String toString() { + return "Scheduling{" + + "automaticRestart=" + + automaticRestart + + ", " + + "onHostMaintenance=" + + onHostMaintenance + + ", " + + "preemptible=" + + preemptible + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Scheduling) { + Scheduling that = (Scheduling) o; + return Objects.equals(this.automaticRestart, that.getAutomaticRestart()) + && Objects.equals(this.onHostMaintenance, that.getOnHostMaintenance()) + && Objects.equals(this.preemptible, that.getPreemptible()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(automaticRestart, onHostMaintenance, preemptible); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ScratchDisks.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ScratchDisks.java new file mode 100644 index 000000000000..e806a83522e6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ScratchDisks.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ScratchDisks implements ApiMessage { + private final Integer diskGb; + + private ScratchDisks() { + this.diskGb = null; + } + + private ScratchDisks(Integer diskGb) { + this.diskGb = diskGb; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("diskGb")) { + return diskGb; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getDiskGb() { + return diskGb; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ScratchDisks prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ScratchDisks getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ScratchDisks DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ScratchDisks(); + } + + public static class Builder { + private Integer diskGb; + + Builder() {} + + public Builder mergeFrom(ScratchDisks other) { + if (other == ScratchDisks.getDefaultInstance()) return this; + if (other.getDiskGb() != null) { + this.diskGb = other.diskGb; + } + return this; + } + + Builder(ScratchDisks source) { + this.diskGb = source.diskGb; + } + + public Integer getDiskGb() { + return diskGb; + } + + public Builder setDiskGb(Integer diskGb) { + this.diskGb = diskGb; + return this; + } + + public ScratchDisks build() { + return new ScratchDisks(diskGb); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDiskGb(this.diskGb); + return newBuilder; + } + } + + @Override + public String toString() { + return "ScratchDisks{" + "diskGb=" + diskGb + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ScratchDisks) { + ScratchDisks that = (ScratchDisks) o; + return Objects.equals(this.diskGb, that.getDiskGb()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(diskGb); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SerialPortOutput.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SerialPortOutput.java new file mode 100644 index 000000000000..176456887caf --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SerialPortOutput.java @@ -0,0 +1,263 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SerialPortOutput implements ApiMessage { + private final String contents; + private final String kind; + private final String next; + private final String selfLink; + private final String start; + + private SerialPortOutput() { + this.contents = null; + this.kind = null; + this.next = null; + this.selfLink = null; + this.start = null; + } + + private SerialPortOutput( + String contents, String kind, String next, String selfLink, String start) { + this.contents = contents; + this.kind = kind; + this.next = next; + this.selfLink = selfLink; + this.start = start; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("contents")) { + return contents; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("next")) { + return next; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("start")) { + return start; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getContents() { + return contents; + } + + public String getKind() { + return kind; + } + + public String getNext() { + return next; + } + + public String getSelfLink() { + return selfLink; + } + + public String getStart() { + return start; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SerialPortOutput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SerialPortOutput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SerialPortOutput DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SerialPortOutput(); + } + + public static class Builder { + private String contents; + private String kind; + private String next; + private String selfLink; + private String start; + + Builder() {} + + public Builder mergeFrom(SerialPortOutput other) { + if (other == SerialPortOutput.getDefaultInstance()) return this; + if (other.getContents() != null) { + this.contents = other.contents; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNext() != null) { + this.next = other.next; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getStart() != null) { + this.start = other.start; + } + return this; + } + + Builder(SerialPortOutput source) { + this.contents = source.contents; + this.kind = source.kind; + this.next = source.next; + this.selfLink = source.selfLink; + this.start = source.start; + } + + public String getContents() { + return contents; + } + + public Builder setContents(String contents) { + this.contents = contents; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNext() { + return next; + } + + public Builder setNext(String next) { + this.next = next; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getStart() { + return start; + } + + public Builder setStart(String start) { + this.start = start; + return this; + } + + public SerialPortOutput build() { + + return new SerialPortOutput(contents, kind, next, selfLink, start); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setContents(this.contents); + newBuilder.setKind(this.kind); + newBuilder.setNext(this.next); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setStart(this.start); + return newBuilder; + } + } + + @Override + public String toString() { + return "SerialPortOutput{" + + "contents=" + + contents + + ", " + + "kind=" + + kind + + ", " + + "next=" + + next + + ", " + + "selfLink=" + + selfLink + + ", " + + "start=" + + start + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SerialPortOutput) { + SerialPortOutput that = (SerialPortOutput) o; + return Objects.equals(this.contents, that.getContents()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.next, that.getNext()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.start, that.getStart()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(contents, kind, next, selfLink, start); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ServiceAccount.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ServiceAccount.java new file mode 100644 index 000000000000..b21d731cf495 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ServiceAccount.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ServiceAccount implements ApiMessage { + private final String email; + private final List scopes; + + private ServiceAccount() { + this.email = null; + this.scopes = null; + } + + private ServiceAccount(String email, List scopes) { + this.email = email; + this.scopes = scopes; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("email")) { + return email; + } + if (fieldName.equals("scopes")) { + return scopes; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getEmail() { + return email; + } + + public List getScopesList() { + return scopes; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ServiceAccount prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ServiceAccount getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ServiceAccount DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ServiceAccount(); + } + + public static class Builder { + private String email; + private List scopes; + + Builder() {} + + public Builder mergeFrom(ServiceAccount other) { + if (other == ServiceAccount.getDefaultInstance()) return this; + if (other.getEmail() != null) { + this.email = other.email; + } + if (other.getScopesList() != null) { + this.scopes = other.scopes; + } + return this; + } + + Builder(ServiceAccount source) { + this.email = source.email; + this.scopes = source.scopes; + } + + public String getEmail() { + return email; + } + + public Builder setEmail(String email) { + this.email = email; + return this; + } + + public List getScopesList() { + return scopes; + } + + public Builder addAllScopes(List scopes) { + if (this.scopes == null) { + this.scopes = new ArrayList<>(scopes.size()); + } + this.scopes.addAll(scopes); + return this; + } + + public Builder addScopes(String scopes) { + this.scopes.add(scopes); + return this; + } + + public ServiceAccount build() { + + return new ServiceAccount(email, scopes); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setEmail(this.email); + newBuilder.addAllScopes(this.scopes); + return newBuilder; + } + } + + @Override + public String toString() { + return "ServiceAccount{" + "email=" + email + ", " + "scopes=" + scopes + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ServiceAccount) { + ServiceAccount that = (ServiceAccount) o; + return Objects.equals(this.email, that.getEmail()) + && Objects.equals(this.scopes, that.getScopesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(email, scopes); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetBackendServiceTargetSslProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetBackendServiceTargetSslProxyHttpRequest.java new file mode 100644 index 000000000000..94915ed07aa1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetBackendServiceTargetSslProxyHttpRequest.java @@ -0,0 +1,458 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetBackendServiceTargetSslProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final TargetSslProxiesSetBackendServiceRequest + targetSslProxiesSetBackendServiceRequestResource; + private final String targetSslProxy; + private final String userIp; + + private SetBackendServiceTargetSslProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetSslProxiesSetBackendServiceRequestResource = null; + this.targetSslProxy = null; + this.userIp = null; + } + + private SetBackendServiceTargetSslProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + TargetSslProxiesSetBackendServiceRequest targetSslProxiesSetBackendServiceRequestResource, + String targetSslProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetSslProxiesSetBackendServiceRequestResource = + targetSslProxiesSetBackendServiceRequestResource; + this.targetSslProxy = targetSslProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetSslProxiesSetBackendServiceRequestResource")) { + return targetSslProxiesSetBackendServiceRequestResource; + } + if (fieldName.equals("targetSslProxy")) { + return targetSslProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetSslProxiesSetBackendServiceRequest getApiMessageRequestBody() { + return targetSslProxiesSetBackendServiceRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetSslProxiesSetBackendServiceRequest + getTargetSslProxiesSetBackendServiceRequestResource() { + return targetSslProxiesSetBackendServiceRequestResource; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetBackendServiceTargetSslProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetBackendServiceTargetSslProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetBackendServiceTargetSslProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetBackendServiceTargetSslProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private TargetSslProxiesSetBackendServiceRequest + targetSslProxiesSetBackendServiceRequestResource; + private String targetSslProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetBackendServiceTargetSslProxyHttpRequest other) { + if (other == SetBackendServiceTargetSslProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetSslProxiesSetBackendServiceRequestResource() != null) { + this.targetSslProxiesSetBackendServiceRequestResource = + other.targetSslProxiesSetBackendServiceRequestResource; + } + if (other.getTargetSslProxy() != null) { + this.targetSslProxy = other.targetSslProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetBackendServiceTargetSslProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetSslProxiesSetBackendServiceRequestResource = + source.targetSslProxiesSetBackendServiceRequestResource; + this.targetSslProxy = source.targetSslProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetSslProxiesSetBackendServiceRequest + getTargetSslProxiesSetBackendServiceRequestResource() { + return targetSslProxiesSetBackendServiceRequestResource; + } + + public Builder setTargetSslProxiesSetBackendServiceRequestResource( + TargetSslProxiesSetBackendServiceRequest targetSslProxiesSetBackendServiceRequestResource) { + this.targetSslProxiesSetBackendServiceRequestResource = + targetSslProxiesSetBackendServiceRequestResource; + return this; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public Builder setTargetSslProxy(String targetSslProxy) { + this.targetSslProxy = targetSslProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetBackendServiceTargetSslProxyHttpRequest build() { + String missing = ""; + + if (targetSslProxy == null) { + missing += " targetSslProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetBackendServiceTargetSslProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetSslProxiesSetBackendServiceRequestResource, + targetSslProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetSslProxiesSetBackendServiceRequestResource( + this.targetSslProxiesSetBackendServiceRequestResource); + newBuilder.setTargetSslProxy(this.targetSslProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetBackendServiceTargetSslProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetSslProxiesSetBackendServiceRequestResource=" + + targetSslProxiesSetBackendServiceRequestResource + + ", " + + "targetSslProxy=" + + targetSslProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetBackendServiceTargetSslProxyHttpRequest) { + SetBackendServiceTargetSslProxyHttpRequest that = + (SetBackendServiceTargetSslProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals( + this.targetSslProxiesSetBackendServiceRequestResource, + that.getTargetSslProxiesSetBackendServiceRequestResource()) + && Objects.equals(this.targetSslProxy, that.getTargetSslProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetSslProxiesSetBackendServiceRequestResource, + targetSslProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetBackendServiceTargetTcpProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetBackendServiceTargetTcpProxyHttpRequest.java new file mode 100644 index 000000000000..5a79262f2ebc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetBackendServiceTargetTcpProxyHttpRequest.java @@ -0,0 +1,458 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetBackendServiceTargetTcpProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final TargetTcpProxiesSetBackendServiceRequest + targetTcpProxiesSetBackendServiceRequestResource; + private final String targetTcpProxy; + private final String userIp; + + private SetBackendServiceTargetTcpProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetTcpProxiesSetBackendServiceRequestResource = null; + this.targetTcpProxy = null; + this.userIp = null; + } + + private SetBackendServiceTargetTcpProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource, + String targetTcpProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetTcpProxiesSetBackendServiceRequestResource = + targetTcpProxiesSetBackendServiceRequestResource; + this.targetTcpProxy = targetTcpProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetTcpProxiesSetBackendServiceRequestResource")) { + return targetTcpProxiesSetBackendServiceRequestResource; + } + if (fieldName.equals("targetTcpProxy")) { + return targetTcpProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetTcpProxiesSetBackendServiceRequest getApiMessageRequestBody() { + return targetTcpProxiesSetBackendServiceRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetTcpProxiesSetBackendServiceRequest + getTargetTcpProxiesSetBackendServiceRequestResource() { + return targetTcpProxiesSetBackendServiceRequestResource; + } + + public String getTargetTcpProxy() { + return targetTcpProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetBackendServiceTargetTcpProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetBackendServiceTargetTcpProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetBackendServiceTargetTcpProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetBackendServiceTargetTcpProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private TargetTcpProxiesSetBackendServiceRequest + targetTcpProxiesSetBackendServiceRequestResource; + private String targetTcpProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetBackendServiceTargetTcpProxyHttpRequest other) { + if (other == SetBackendServiceTargetTcpProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetTcpProxiesSetBackendServiceRequestResource() != null) { + this.targetTcpProxiesSetBackendServiceRequestResource = + other.targetTcpProxiesSetBackendServiceRequestResource; + } + if (other.getTargetTcpProxy() != null) { + this.targetTcpProxy = other.targetTcpProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetBackendServiceTargetTcpProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetTcpProxiesSetBackendServiceRequestResource = + source.targetTcpProxiesSetBackendServiceRequestResource; + this.targetTcpProxy = source.targetTcpProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetTcpProxiesSetBackendServiceRequest + getTargetTcpProxiesSetBackendServiceRequestResource() { + return targetTcpProxiesSetBackendServiceRequestResource; + } + + public Builder setTargetTcpProxiesSetBackendServiceRequestResource( + TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource) { + this.targetTcpProxiesSetBackendServiceRequestResource = + targetTcpProxiesSetBackendServiceRequestResource; + return this; + } + + public String getTargetTcpProxy() { + return targetTcpProxy; + } + + public Builder setTargetTcpProxy(String targetTcpProxy) { + this.targetTcpProxy = targetTcpProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetBackendServiceTargetTcpProxyHttpRequest build() { + String missing = ""; + + if (targetTcpProxy == null) { + missing += " targetTcpProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetBackendServiceTargetTcpProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetTcpProxiesSetBackendServiceRequestResource, + targetTcpProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetTcpProxiesSetBackendServiceRequestResource( + this.targetTcpProxiesSetBackendServiceRequestResource); + newBuilder.setTargetTcpProxy(this.targetTcpProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetBackendServiceTargetTcpProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetTcpProxiesSetBackendServiceRequestResource=" + + targetTcpProxiesSetBackendServiceRequestResource + + ", " + + "targetTcpProxy=" + + targetTcpProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetBackendServiceTargetTcpProxyHttpRequest) { + SetBackendServiceTargetTcpProxyHttpRequest that = + (SetBackendServiceTargetTcpProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals( + this.targetTcpProxiesSetBackendServiceRequestResource, + that.getTargetTcpProxiesSetBackendServiceRequestResource()) + && Objects.equals(this.targetTcpProxy, that.getTargetTcpProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetTcpProxiesSetBackendServiceRequestResource, + targetTcpProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetBackupTargetPoolHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetBackupTargetPoolHttpRequest.java new file mode 100644 index 000000000000..a8ff1c84b873 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetBackupTargetPoolHttpRequest.java @@ -0,0 +1,477 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetBackupTargetPoolHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final Float failoverRatio; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetPool; + private final TargetReference targetReferenceResource; + private final String userIp; + + private SetBackupTargetPoolHttpRequest() { + this.access_token = null; + this.callback = null; + this.failoverRatio = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetPool = null; + this.targetReferenceResource = null; + this.userIp = null; + } + + private SetBackupTargetPoolHttpRequest( + String access_token, + String callback, + Float failoverRatio, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetPool, + TargetReference targetReferenceResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.failoverRatio = failoverRatio; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetPool = targetPool; + this.targetReferenceResource = targetReferenceResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("failoverRatio")) { + return failoverRatio; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetPool")) { + return targetPool; + } + if (fieldName.equals("targetReferenceResource")) { + return targetReferenceResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetReference getApiMessageRequestBody() { + return targetReferenceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public Float getFailoverRatio() { + return failoverRatio; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetPool() { + return targetPool; + } + + public TargetReference getTargetReferenceResource() { + return targetReferenceResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetBackupTargetPoolHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetBackupTargetPoolHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetBackupTargetPoolHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetBackupTargetPoolHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private Float failoverRatio; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetPool; + private TargetReference targetReferenceResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetBackupTargetPoolHttpRequest other) { + if (other == SetBackupTargetPoolHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFailoverRatio() != null) { + this.failoverRatio = other.failoverRatio; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetPool() != null) { + this.targetPool = other.targetPool; + } + if (other.getTargetReferenceResource() != null) { + this.targetReferenceResource = other.targetReferenceResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetBackupTargetPoolHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.failoverRatio = source.failoverRatio; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetPool = source.targetPool; + this.targetReferenceResource = source.targetReferenceResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public Float getFailoverRatio() { + return failoverRatio; + } + + public Builder setFailoverRatio(Float failoverRatio) { + this.failoverRatio = failoverRatio; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetPool() { + return targetPool; + } + + public Builder setTargetPool(String targetPool) { + this.targetPool = targetPool; + return this; + } + + public TargetReference getTargetReferenceResource() { + return targetReferenceResource; + } + + public Builder setTargetReferenceResource(TargetReference targetReferenceResource) { + this.targetReferenceResource = targetReferenceResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetBackupTargetPoolHttpRequest build() { + String missing = ""; + + if (targetPool == null) { + missing += " targetPool"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetBackupTargetPoolHttpRequest( + access_token, + callback, + failoverRatio, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetPool, + targetReferenceResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFailoverRatio(this.failoverRatio); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetPool(this.targetPool); + newBuilder.setTargetReferenceResource(this.targetReferenceResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetBackupTargetPoolHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "failoverRatio=" + + failoverRatio + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetPool=" + + targetPool + + ", " + + "targetReferenceResource=" + + targetReferenceResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetBackupTargetPoolHttpRequest) { + SetBackupTargetPoolHttpRequest that = (SetBackupTargetPoolHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.failoverRatio, that.getFailoverRatio()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetPool, that.getTargetPool()) + && Objects.equals(this.targetReferenceResource, that.getTargetReferenceResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + failoverRatio, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetPool, + targetReferenceResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetCommonInstanceMetadataProjectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetCommonInstanceMetadataProjectHttpRequest.java new file mode 100644 index 000000000000..7ef2f549c852 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetCommonInstanceMetadataProjectHttpRequest.java @@ -0,0 +1,446 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetCommonInstanceMetadataProjectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final Metadata metadataResource; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SetCommonInstanceMetadataProjectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.metadataResource = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SetCommonInstanceMetadataProjectHttpRequest( + String access_token, + String callback, + String fields, + String key, + Metadata metadataResource, + String prettyPrint, + String project, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.metadataResource = metadataResource; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("metadataResource")) { + return metadataResource; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Metadata getApiMessageRequestBody() { + return metadataResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public Metadata getMetadataResource() { + return metadataResource; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetCommonInstanceMetadataProjectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetCommonInstanceMetadataProjectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetCommonInstanceMetadataProjectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetCommonInstanceMetadataProjectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private Metadata metadataResource; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetCommonInstanceMetadataProjectHttpRequest other) { + if (other == SetCommonInstanceMetadataProjectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMetadataResource() != null) { + this.metadataResource = other.metadataResource; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetCommonInstanceMetadataProjectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.metadataResource = source.metadataResource; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Metadata getMetadataResource() { + return metadataResource; + } + + public Builder setMetadataResource(Metadata metadataResource) { + this.metadataResource = metadataResource; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetCommonInstanceMetadataProjectHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetCommonInstanceMetadataProjectHttpRequest( + access_token, + callback, + fields, + key, + metadataResource, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setMetadataResource(this.metadataResource); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetCommonInstanceMetadataProjectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "metadataResource=" + + metadataResource + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetCommonInstanceMetadataProjectHttpRequest) { + SetCommonInstanceMetadataProjectHttpRequest that = + (SetCommonInstanceMetadataProjectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.metadataResource, that.getMetadataResource()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + metadataResource, + prettyPrint, + project, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetDeletionProtectionInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetDeletionProtectionInstanceHttpRequest.java new file mode 100644 index 000000000000..25ddb9bee5c3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetDeletionProtectionInstanceHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetDeletionProtectionInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final Boolean deletionProtection; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String resource; + private final String userIp; + + private SetDeletionProtectionInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.deletionProtection = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.resource = null; + this.userIp = null; + } + + private SetDeletionProtectionInstanceHttpRequest( + String access_token, + String callback, + Boolean deletionProtection, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String resource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.deletionProtection = deletionProtection; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.resource = resource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("deletionProtection")) { + return deletionProtection; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("resource")) { + return resource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public Boolean getDeletionProtection() { + return deletionProtection; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getResource() { + return resource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetDeletionProtectionInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetDeletionProtectionInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetDeletionProtectionInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetDeletionProtectionInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private Boolean deletionProtection; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String resource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetDeletionProtectionInstanceHttpRequest other) { + if (other == SetDeletionProtectionInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDeletionProtection() != null) { + this.deletionProtection = other.deletionProtection; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getResource() != null) { + this.resource = other.resource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetDeletionProtectionInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.deletionProtection = source.deletionProtection; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.resource = source.resource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public Boolean getDeletionProtection() { + return deletionProtection; + } + + public Builder setDeletionProtection(Boolean deletionProtection) { + this.deletionProtection = deletionProtection; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getResource() { + return resource; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetDeletionProtectionInstanceHttpRequest build() { + String missing = ""; + + if (resource == null) { + missing += " resource"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetDeletionProtectionInstanceHttpRequest( + access_token, + callback, + deletionProtection, + fields, + key, + prettyPrint, + quotaUser, + requestId, + resource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setDeletionProtection(this.deletionProtection); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setResource(this.resource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetDeletionProtectionInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "deletionProtection=" + + deletionProtection + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "resource=" + + resource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetDeletionProtectionInstanceHttpRequest) { + SetDeletionProtectionInstanceHttpRequest that = (SetDeletionProtectionInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.deletionProtection, that.getDeletionProtection()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.resource, that.getResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + deletionProtection, + fields, + key, + prettyPrint, + quotaUser, + requestId, + resource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetDiskAutoDeleteInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetDiskAutoDeleteInstanceHttpRequest.java new file mode 100644 index 000000000000..1d68a7549b97 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetDiskAutoDeleteInstanceHttpRequest.java @@ -0,0 +1,485 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetDiskAutoDeleteInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final Boolean autoDelete; + private final String callback; + private final String deviceName; + private final String fields; + private final String instance; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SetDiskAutoDeleteInstanceHttpRequest() { + this.access_token = null; + this.autoDelete = null; + this.callback = null; + this.deviceName = null; + this.fields = null; + this.instance = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SetDiskAutoDeleteInstanceHttpRequest( + String access_token, + Boolean autoDelete, + String callback, + String deviceName, + String fields, + String instance, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.autoDelete = autoDelete; + this.callback = callback; + this.deviceName = deviceName; + this.fields = fields; + this.instance = instance; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("autoDelete")) { + return autoDelete; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("deviceName")) { + return deviceName; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public Boolean getAutoDelete() { + return autoDelete; + } + + public String getCallback() { + return callback; + } + + public String getDeviceName() { + return deviceName; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetDiskAutoDeleteInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetDiskAutoDeleteInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetDiskAutoDeleteInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetDiskAutoDeleteInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private Boolean autoDelete; + private String callback; + private String deviceName; + private String fields; + private String instance; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetDiskAutoDeleteInstanceHttpRequest other) { + if (other == SetDiskAutoDeleteInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAutoDelete() != null) { + this.autoDelete = other.autoDelete; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getDeviceName() != null) { + this.deviceName = other.deviceName; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetDiskAutoDeleteInstanceHttpRequest source) { + this.access_token = source.access_token; + this.autoDelete = source.autoDelete; + this.callback = source.callback; + this.deviceName = source.deviceName; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public Boolean getAutoDelete() { + return autoDelete; + } + + public Builder setAutoDelete(Boolean autoDelete) { + this.autoDelete = autoDelete; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getDeviceName() { + return deviceName; + } + + public Builder setDeviceName(String deviceName) { + this.deviceName = deviceName; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetDiskAutoDeleteInstanceHttpRequest build() { + String missing = ""; + + if (autoDelete == null) { + missing += " autoDelete"; + } + + if (deviceName == null) { + missing += " deviceName"; + } + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetDiskAutoDeleteInstanceHttpRequest( + access_token, + autoDelete, + callback, + deviceName, + fields, + instance, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAutoDelete(this.autoDelete); + newBuilder.setCallback(this.callback); + newBuilder.setDeviceName(this.deviceName); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetDiskAutoDeleteInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "autoDelete=" + + autoDelete + + ", " + + "callback=" + + callback + + ", " + + "deviceName=" + + deviceName + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetDiskAutoDeleteInstanceHttpRequest) { + SetDiskAutoDeleteInstanceHttpRequest that = (SetDiskAutoDeleteInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.autoDelete, that.getAutoDelete()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.deviceName, that.getDeviceName()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + autoDelete, + callback, + deviceName, + fields, + instance, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetInstanceTemplateInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetInstanceTemplateInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..4b2b5108df78 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetInstanceTemplateInstanceGroupManagerHttpRequest.java @@ -0,0 +1,461 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetInstanceTemplateInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final InstanceGroupManagersSetInstanceTemplateRequest + instanceGroupManagersSetInstanceTemplateRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SetInstanceTemplateInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.instanceGroupManagersSetInstanceTemplateRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SetInstanceTemplateInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + InstanceGroupManagersSetInstanceTemplateRequest + instanceGroupManagersSetInstanceTemplateRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.instanceGroupManagersSetInstanceTemplateRequestResource = + instanceGroupManagersSetInstanceTemplateRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("instanceGroupManagersSetInstanceTemplateRequestResource")) { + return instanceGroupManagersSetInstanceTemplateRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceGroupManagersSetInstanceTemplateRequest getApiMessageRequestBody() { + return instanceGroupManagersSetInstanceTemplateRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public InstanceGroupManagersSetInstanceTemplateRequest + getInstanceGroupManagersSetInstanceTemplateRequestResource() { + return instanceGroupManagersSetInstanceTemplateRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetInstanceTemplateInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetInstanceTemplateInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetInstanceTemplateInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetInstanceTemplateInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private InstanceGroupManagersSetInstanceTemplateRequest + instanceGroupManagersSetInstanceTemplateRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetInstanceTemplateInstanceGroupManagerHttpRequest other) { + if (other == SetInstanceTemplateInstanceGroupManagerHttpRequest.getDefaultInstance()) + return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getInstanceGroupManagersSetInstanceTemplateRequestResource() != null) { + this.instanceGroupManagersSetInstanceTemplateRequestResource = + other.instanceGroupManagersSetInstanceTemplateRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetInstanceTemplateInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.instanceGroupManagersSetInstanceTemplateRequestResource = + source.instanceGroupManagersSetInstanceTemplateRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public InstanceGroupManagersSetInstanceTemplateRequest + getInstanceGroupManagersSetInstanceTemplateRequestResource() { + return instanceGroupManagersSetInstanceTemplateRequestResource; + } + + public Builder setInstanceGroupManagersSetInstanceTemplateRequestResource( + InstanceGroupManagersSetInstanceTemplateRequest + instanceGroupManagersSetInstanceTemplateRequestResource) { + this.instanceGroupManagersSetInstanceTemplateRequestResource = + instanceGroupManagersSetInstanceTemplateRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetInstanceTemplateInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetInstanceTemplateInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + instanceGroupManagersSetInstanceTemplateRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setInstanceGroupManagersSetInstanceTemplateRequestResource( + this.instanceGroupManagersSetInstanceTemplateRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetInstanceTemplateInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "instanceGroupManagersSetInstanceTemplateRequestResource=" + + instanceGroupManagersSetInstanceTemplateRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetInstanceTemplateInstanceGroupManagerHttpRequest) { + SetInstanceTemplateInstanceGroupManagerHttpRequest that = + (SetInstanceTemplateInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals( + this.instanceGroupManagersSetInstanceTemplateRequestResource, + that.getInstanceGroupManagersSetInstanceTemplateRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + instanceGroupManagersSetInstanceTemplateRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetInstanceTemplateRegionInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetInstanceTemplateRegionInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..6465fd01f274 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetInstanceTemplateRegionInstanceGroupManagerHttpRequest.java @@ -0,0 +1,462 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetInstanceTemplateRegionInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final RegionInstanceGroupManagersSetTemplateRequest + regionInstanceGroupManagersSetTemplateRequestResource; + private final String requestId; + private final String userIp; + + private SetInstanceTemplateRegionInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.regionInstanceGroupManagersSetTemplateRequestResource = null; + this.requestId = null; + this.userIp = null; + } + + private SetInstanceTemplateRegionInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + String key, + String prettyPrint, + String quotaUser, + RegionInstanceGroupManagersSetTemplateRequest + regionInstanceGroupManagersSetTemplateRequestResource, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.regionInstanceGroupManagersSetTemplateRequestResource = + regionInstanceGroupManagersSetTemplateRequestResource; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("regionInstanceGroupManagersSetTemplateRequestResource")) { + return regionInstanceGroupManagersSetTemplateRequestResource; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public RegionInstanceGroupManagersSetTemplateRequest getApiMessageRequestBody() { + return regionInstanceGroupManagersSetTemplateRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public RegionInstanceGroupManagersSetTemplateRequest + getRegionInstanceGroupManagersSetTemplateRequestResource() { + return regionInstanceGroupManagersSetTemplateRequestResource; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetInstanceTemplateRegionInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetInstanceTemplateRegionInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetInstanceTemplateRegionInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private String key; + private String prettyPrint; + private String quotaUser; + private RegionInstanceGroupManagersSetTemplateRequest + regionInstanceGroupManagersSetTemplateRequestResource; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetInstanceTemplateRegionInstanceGroupManagerHttpRequest other) { + if (other == SetInstanceTemplateRegionInstanceGroupManagerHttpRequest.getDefaultInstance()) + return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegionInstanceGroupManagersSetTemplateRequestResource() != null) { + this.regionInstanceGroupManagersSetTemplateRequestResource = + other.regionInstanceGroupManagersSetTemplateRequestResource; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetInstanceTemplateRegionInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.regionInstanceGroupManagersSetTemplateRequestResource = + source.regionInstanceGroupManagersSetTemplateRequestResource; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public RegionInstanceGroupManagersSetTemplateRequest + getRegionInstanceGroupManagersSetTemplateRequestResource() { + return regionInstanceGroupManagersSetTemplateRequestResource; + } + + public Builder setRegionInstanceGroupManagersSetTemplateRequestResource( + RegionInstanceGroupManagersSetTemplateRequest + regionInstanceGroupManagersSetTemplateRequestResource) { + this.regionInstanceGroupManagersSetTemplateRequestResource = + regionInstanceGroupManagersSetTemplateRequestResource; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetInstanceTemplateRegionInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetInstanceTemplateRegionInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + regionInstanceGroupManagersSetTemplateRequestResource, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegionInstanceGroupManagersSetTemplateRequestResource( + this.regionInstanceGroupManagersSetTemplateRequestResource); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetInstanceTemplateRegionInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "regionInstanceGroupManagersSetTemplateRequestResource=" + + regionInstanceGroupManagersSetTemplateRequestResource + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetInstanceTemplateRegionInstanceGroupManagerHttpRequest) { + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest that = + (SetInstanceTemplateRegionInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals( + this.regionInstanceGroupManagersSetTemplateRequestResource, + that.getRegionInstanceGroupManagersSetTemplateRequestResource()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + regionInstanceGroupManagersSetTemplateRequestResource, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsDiskHttpRequest.java new file mode 100644 index 000000000000..5169b551ebaf --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsDiskHttpRequest.java @@ -0,0 +1,447 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetLabelsDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String resource; + private final String userIp; + private final ZoneSetLabelsRequest zoneSetLabelsRequestResource; + + private SetLabelsDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.resource = null; + this.userIp = null; + this.zoneSetLabelsRequestResource = null; + } + + private SetLabelsDiskHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String resource, + String userIp, + ZoneSetLabelsRequest zoneSetLabelsRequestResource) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.resource = resource; + this.userIp = userIp; + this.zoneSetLabelsRequestResource = zoneSetLabelsRequestResource; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("resource")) { + return resource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zoneSetLabelsRequestResource")) { + return zoneSetLabelsRequestResource; + } + return null; + } + + @Nullable + @Override + public ZoneSetLabelsRequest getApiMessageRequestBody() { + return zoneSetLabelsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getResource() { + return resource; + } + + public String getUserIp() { + return userIp; + } + + public ZoneSetLabelsRequest getZoneSetLabelsRequestResource() { + return zoneSetLabelsRequestResource; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetLabelsDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetLabelsDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetLabelsDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetLabelsDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String resource; + private String userIp; + private ZoneSetLabelsRequest zoneSetLabelsRequestResource; + + Builder() {} + + public Builder mergeFrom(SetLabelsDiskHttpRequest other) { + if (other == SetLabelsDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getResource() != null) { + this.resource = other.resource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZoneSetLabelsRequestResource() != null) { + this.zoneSetLabelsRequestResource = other.zoneSetLabelsRequestResource; + } + return this; + } + + Builder(SetLabelsDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.resource = source.resource; + this.userIp = source.userIp; + this.zoneSetLabelsRequestResource = source.zoneSetLabelsRequestResource; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getResource() { + return resource; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ZoneSetLabelsRequest getZoneSetLabelsRequestResource() { + return zoneSetLabelsRequestResource; + } + + public Builder setZoneSetLabelsRequestResource( + ZoneSetLabelsRequest zoneSetLabelsRequestResource) { + this.zoneSetLabelsRequestResource = zoneSetLabelsRequestResource; + return this; + } + + public SetLabelsDiskHttpRequest build() { + String missing = ""; + + if (resource == null) { + missing += " resource"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetLabelsDiskHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + resource, + userIp, + zoneSetLabelsRequestResource); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setResource(this.resource); + newBuilder.setUserIp(this.userIp); + newBuilder.setZoneSetLabelsRequestResource(this.zoneSetLabelsRequestResource); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetLabelsDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "resource=" + + resource + + ", " + + "userIp=" + + userIp + + ", " + + "zoneSetLabelsRequestResource=" + + zoneSetLabelsRequestResource + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetLabelsDiskHttpRequest) { + SetLabelsDiskHttpRequest that = (SetLabelsDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.resource, that.getResource()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals( + this.zoneSetLabelsRequestResource, that.getZoneSetLabelsRequestResource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + resource, + userIp, + zoneSetLabelsRequestResource); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsImageHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsImageHttpRequest.java new file mode 100644 index 000000000000..71baf086694e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsImageHttpRequest.java @@ -0,0 +1,415 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetLabelsImageHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final GlobalSetLabelsRequest globalSetLabelsRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String resource; + private final String userIp; + + private SetLabelsImageHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.globalSetLabelsRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.resource = null; + this.userIp = null; + } + + private SetLabelsImageHttpRequest( + String access_token, + String callback, + String fields, + GlobalSetLabelsRequest globalSetLabelsRequestResource, + String key, + String prettyPrint, + String quotaUser, + String resource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.globalSetLabelsRequestResource = globalSetLabelsRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.resource = resource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("globalSetLabelsRequestResource")) { + return globalSetLabelsRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("resource")) { + return resource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public GlobalSetLabelsRequest getApiMessageRequestBody() { + return globalSetLabelsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public GlobalSetLabelsRequest getGlobalSetLabelsRequestResource() { + return globalSetLabelsRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getResource() { + return resource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetLabelsImageHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetLabelsImageHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetLabelsImageHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetLabelsImageHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private GlobalSetLabelsRequest globalSetLabelsRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String resource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetLabelsImageHttpRequest other) { + if (other == SetLabelsImageHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getGlobalSetLabelsRequestResource() != null) { + this.globalSetLabelsRequestResource = other.globalSetLabelsRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getResource() != null) { + this.resource = other.resource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetLabelsImageHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.globalSetLabelsRequestResource = source.globalSetLabelsRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.resource = source.resource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public GlobalSetLabelsRequest getGlobalSetLabelsRequestResource() { + return globalSetLabelsRequestResource; + } + + public Builder setGlobalSetLabelsRequestResource( + GlobalSetLabelsRequest globalSetLabelsRequestResource) { + this.globalSetLabelsRequestResource = globalSetLabelsRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getResource() { + return resource; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetLabelsImageHttpRequest build() { + String missing = ""; + + if (resource == null) { + missing += " resource"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetLabelsImageHttpRequest( + access_token, + callback, + fields, + globalSetLabelsRequestResource, + key, + prettyPrint, + quotaUser, + resource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setGlobalSetLabelsRequestResource(this.globalSetLabelsRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setResource(this.resource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetLabelsImageHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "globalSetLabelsRequestResource=" + + globalSetLabelsRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "resource=" + + resource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetLabelsImageHttpRequest) { + SetLabelsImageHttpRequest that = (SetLabelsImageHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals( + this.globalSetLabelsRequestResource, that.getGlobalSetLabelsRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.resource, that.getResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + globalSetLabelsRequestResource, + key, + prettyPrint, + quotaUser, + resource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsInstanceHttpRequest.java new file mode 100644 index 000000000000..057e08320ac4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsInstanceHttpRequest.java @@ -0,0 +1,447 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetLabelsInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final InstancesSetLabelsRequest instancesSetLabelsRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SetLabelsInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.instancesSetLabelsRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SetLabelsInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + InstancesSetLabelsRequest instancesSetLabelsRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.instancesSetLabelsRequestResource = instancesSetLabelsRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("instancesSetLabelsRequestResource")) { + return instancesSetLabelsRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstancesSetLabelsRequest getApiMessageRequestBody() { + return instancesSetLabelsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public InstancesSetLabelsRequest getInstancesSetLabelsRequestResource() { + return instancesSetLabelsRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetLabelsInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetLabelsInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetLabelsInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetLabelsInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private InstancesSetLabelsRequest instancesSetLabelsRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetLabelsInstanceHttpRequest other) { + if (other == SetLabelsInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getInstancesSetLabelsRequestResource() != null) { + this.instancesSetLabelsRequestResource = other.instancesSetLabelsRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetLabelsInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.instancesSetLabelsRequestResource = source.instancesSetLabelsRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public InstancesSetLabelsRequest getInstancesSetLabelsRequestResource() { + return instancesSetLabelsRequestResource; + } + + public Builder setInstancesSetLabelsRequestResource( + InstancesSetLabelsRequest instancesSetLabelsRequestResource) { + this.instancesSetLabelsRequestResource = instancesSetLabelsRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetLabelsInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetLabelsInstanceHttpRequest( + access_token, + callback, + fields, + instance, + instancesSetLabelsRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setInstancesSetLabelsRequestResource(this.instancesSetLabelsRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetLabelsInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "instancesSetLabelsRequestResource=" + + instancesSetLabelsRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetLabelsInstanceHttpRequest) { + SetLabelsInstanceHttpRequest that = (SetLabelsInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals( + this.instancesSetLabelsRequestResource, that.getInstancesSetLabelsRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instance, + instancesSetLabelsRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsRegionDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsRegionDiskHttpRequest.java new file mode 100644 index 000000000000..0ee157f7e2fd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsRegionDiskHttpRequest.java @@ -0,0 +1,447 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetLabelsRegionDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final RegionSetLabelsRequest regionSetLabelsRequestResource; + private final String requestId; + private final String resource; + private final String userIp; + + private SetLabelsRegionDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.regionSetLabelsRequestResource = null; + this.requestId = null; + this.resource = null; + this.userIp = null; + } + + private SetLabelsRegionDiskHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + RegionSetLabelsRequest regionSetLabelsRequestResource, + String requestId, + String resource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.regionSetLabelsRequestResource = regionSetLabelsRequestResource; + this.requestId = requestId; + this.resource = resource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("regionSetLabelsRequestResource")) { + return regionSetLabelsRequestResource; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("resource")) { + return resource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public RegionSetLabelsRequest getApiMessageRequestBody() { + return regionSetLabelsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public RegionSetLabelsRequest getRegionSetLabelsRequestResource() { + return regionSetLabelsRequestResource; + } + + public String getRequestId() { + return requestId; + } + + public String getResource() { + return resource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetLabelsRegionDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetLabelsRegionDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetLabelsRegionDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetLabelsRegionDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private RegionSetLabelsRequest regionSetLabelsRequestResource; + private String requestId; + private String resource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetLabelsRegionDiskHttpRequest other) { + if (other == SetLabelsRegionDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegionSetLabelsRequestResource() != null) { + this.regionSetLabelsRequestResource = other.regionSetLabelsRequestResource; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getResource() != null) { + this.resource = other.resource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetLabelsRegionDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.regionSetLabelsRequestResource = source.regionSetLabelsRequestResource; + this.requestId = source.requestId; + this.resource = source.resource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public RegionSetLabelsRequest getRegionSetLabelsRequestResource() { + return regionSetLabelsRequestResource; + } + + public Builder setRegionSetLabelsRequestResource( + RegionSetLabelsRequest regionSetLabelsRequestResource) { + this.regionSetLabelsRequestResource = regionSetLabelsRequestResource; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getResource() { + return resource; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetLabelsRegionDiskHttpRequest build() { + String missing = ""; + + if (resource == null) { + missing += " resource"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetLabelsRegionDiskHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + regionSetLabelsRequestResource, + requestId, + resource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegionSetLabelsRequestResource(this.regionSetLabelsRequestResource); + newBuilder.setRequestId(this.requestId); + newBuilder.setResource(this.resource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetLabelsRegionDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "regionSetLabelsRequestResource=" + + regionSetLabelsRequestResource + + ", " + + "requestId=" + + requestId + + ", " + + "resource=" + + resource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetLabelsRegionDiskHttpRequest) { + SetLabelsRegionDiskHttpRequest that = (SetLabelsRegionDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals( + this.regionSetLabelsRequestResource, that.getRegionSetLabelsRequestResource()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.resource, that.getResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + regionSetLabelsRequestResource, + requestId, + resource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsSnapshotHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsSnapshotHttpRequest.java new file mode 100644 index 000000000000..f61d9205e66d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetLabelsSnapshotHttpRequest.java @@ -0,0 +1,415 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetLabelsSnapshotHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final GlobalSetLabelsRequest globalSetLabelsRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String resource; + private final String userIp; + + private SetLabelsSnapshotHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.globalSetLabelsRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.resource = null; + this.userIp = null; + } + + private SetLabelsSnapshotHttpRequest( + String access_token, + String callback, + String fields, + GlobalSetLabelsRequest globalSetLabelsRequestResource, + String key, + String prettyPrint, + String quotaUser, + String resource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.globalSetLabelsRequestResource = globalSetLabelsRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.resource = resource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("globalSetLabelsRequestResource")) { + return globalSetLabelsRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("resource")) { + return resource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public GlobalSetLabelsRequest getApiMessageRequestBody() { + return globalSetLabelsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public GlobalSetLabelsRequest getGlobalSetLabelsRequestResource() { + return globalSetLabelsRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getResource() { + return resource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetLabelsSnapshotHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetLabelsSnapshotHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetLabelsSnapshotHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetLabelsSnapshotHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private GlobalSetLabelsRequest globalSetLabelsRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String resource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetLabelsSnapshotHttpRequest other) { + if (other == SetLabelsSnapshotHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getGlobalSetLabelsRequestResource() != null) { + this.globalSetLabelsRequestResource = other.globalSetLabelsRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getResource() != null) { + this.resource = other.resource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetLabelsSnapshotHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.globalSetLabelsRequestResource = source.globalSetLabelsRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.resource = source.resource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public GlobalSetLabelsRequest getGlobalSetLabelsRequestResource() { + return globalSetLabelsRequestResource; + } + + public Builder setGlobalSetLabelsRequestResource( + GlobalSetLabelsRequest globalSetLabelsRequestResource) { + this.globalSetLabelsRequestResource = globalSetLabelsRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getResource() { + return resource; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetLabelsSnapshotHttpRequest build() { + String missing = ""; + + if (resource == null) { + missing += " resource"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetLabelsSnapshotHttpRequest( + access_token, + callback, + fields, + globalSetLabelsRequestResource, + key, + prettyPrint, + quotaUser, + resource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setGlobalSetLabelsRequestResource(this.globalSetLabelsRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setResource(this.resource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetLabelsSnapshotHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "globalSetLabelsRequestResource=" + + globalSetLabelsRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "resource=" + + resource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetLabelsSnapshotHttpRequest) { + SetLabelsSnapshotHttpRequest that = (SetLabelsSnapshotHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals( + this.globalSetLabelsRequestResource, that.getGlobalSetLabelsRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.resource, that.getResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + globalSetLabelsRequestResource, + key, + prettyPrint, + quotaUser, + resource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMachineResourcesInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMachineResourcesInstanceHttpRequest.java new file mode 100644 index 000000000000..8f112ba95cea --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMachineResourcesInstanceHttpRequest.java @@ -0,0 +1,452 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetMachineResourcesInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SetMachineResourcesInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.instancesSetMachineResourcesRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SetMachineResourcesInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.instancesSetMachineResourcesRequestResource = instancesSetMachineResourcesRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("instancesSetMachineResourcesRequestResource")) { + return instancesSetMachineResourcesRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstancesSetMachineResourcesRequest getApiMessageRequestBody() { + return instancesSetMachineResourcesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public InstancesSetMachineResourcesRequest getInstancesSetMachineResourcesRequestResource() { + return instancesSetMachineResourcesRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetMachineResourcesInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetMachineResourcesInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetMachineResourcesInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetMachineResourcesInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetMachineResourcesInstanceHttpRequest other) { + if (other == SetMachineResourcesInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getInstancesSetMachineResourcesRequestResource() != null) { + this.instancesSetMachineResourcesRequestResource = + other.instancesSetMachineResourcesRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetMachineResourcesInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.instancesSetMachineResourcesRequestResource = + source.instancesSetMachineResourcesRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public InstancesSetMachineResourcesRequest getInstancesSetMachineResourcesRequestResource() { + return instancesSetMachineResourcesRequestResource; + } + + public Builder setInstancesSetMachineResourcesRequestResource( + InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource) { + this.instancesSetMachineResourcesRequestResource = + instancesSetMachineResourcesRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetMachineResourcesInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetMachineResourcesInstanceHttpRequest( + access_token, + callback, + fields, + instance, + instancesSetMachineResourcesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setInstancesSetMachineResourcesRequestResource( + this.instancesSetMachineResourcesRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetMachineResourcesInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "instancesSetMachineResourcesRequestResource=" + + instancesSetMachineResourcesRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetMachineResourcesInstanceHttpRequest) { + SetMachineResourcesInstanceHttpRequest that = (SetMachineResourcesInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals( + this.instancesSetMachineResourcesRequestResource, + that.getInstancesSetMachineResourcesRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instance, + instancesSetMachineResourcesRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMachineTypeInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMachineTypeInstanceHttpRequest.java new file mode 100644 index 000000000000..7badaf6cfdfe --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMachineTypeInstanceHttpRequest.java @@ -0,0 +1,449 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetMachineTypeInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SetMachineTypeInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.instancesSetMachineTypeRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SetMachineTypeInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.instancesSetMachineTypeRequestResource = instancesSetMachineTypeRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("instancesSetMachineTypeRequestResource")) { + return instancesSetMachineTypeRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstancesSetMachineTypeRequest getApiMessageRequestBody() { + return instancesSetMachineTypeRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public InstancesSetMachineTypeRequest getInstancesSetMachineTypeRequestResource() { + return instancesSetMachineTypeRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetMachineTypeInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetMachineTypeInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetMachineTypeInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetMachineTypeInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetMachineTypeInstanceHttpRequest other) { + if (other == SetMachineTypeInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getInstancesSetMachineTypeRequestResource() != null) { + this.instancesSetMachineTypeRequestResource = other.instancesSetMachineTypeRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetMachineTypeInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.instancesSetMachineTypeRequestResource = source.instancesSetMachineTypeRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public InstancesSetMachineTypeRequest getInstancesSetMachineTypeRequestResource() { + return instancesSetMachineTypeRequestResource; + } + + public Builder setInstancesSetMachineTypeRequestResource( + InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource) { + this.instancesSetMachineTypeRequestResource = instancesSetMachineTypeRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetMachineTypeInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetMachineTypeInstanceHttpRequest( + access_token, + callback, + fields, + instance, + instancesSetMachineTypeRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setInstancesSetMachineTypeRequestResource( + this.instancesSetMachineTypeRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetMachineTypeInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "instancesSetMachineTypeRequestResource=" + + instancesSetMachineTypeRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetMachineTypeInstanceHttpRequest) { + SetMachineTypeInstanceHttpRequest that = (SetMachineTypeInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals( + this.instancesSetMachineTypeRequestResource, + that.getInstancesSetMachineTypeRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instance, + instancesSetMachineTypeRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMetadataInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMetadataInstanceHttpRequest.java new file mode 100644 index 000000000000..55cea5ad9886 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMetadataInstanceHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetMetadataInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final Metadata metadataResource; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SetMetadataInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.metadataResource = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SetMetadataInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + String key, + Metadata metadataResource, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.metadataResource = metadataResource; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("metadataResource")) { + return metadataResource; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Metadata getApiMessageRequestBody() { + return metadataResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public Metadata getMetadataResource() { + return metadataResource; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetMetadataInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetMetadataInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetMetadataInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetMetadataInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private Metadata metadataResource; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetMetadataInstanceHttpRequest other) { + if (other == SetMetadataInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getMetadataResource() != null) { + this.metadataResource = other.metadataResource; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetMetadataInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.metadataResource = source.metadataResource; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Metadata getMetadataResource() { + return metadataResource; + } + + public Builder setMetadataResource(Metadata metadataResource) { + this.metadataResource = metadataResource; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetMetadataInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetMetadataInstanceHttpRequest( + access_token, + callback, + fields, + instance, + key, + metadataResource, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setMetadataResource(this.metadataResource); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetMetadataInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "metadataResource=" + + metadataResource + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetMetadataInstanceHttpRequest) { + SetMetadataInstanceHttpRequest that = (SetMetadataInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.metadataResource, that.getMetadataResource()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instance, + key, + metadataResource, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMinCpuPlatformInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMinCpuPlatformInstanceHttpRequest.java new file mode 100644 index 000000000000..fdbef21a1e7f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetMinCpuPlatformInstanceHttpRequest.java @@ -0,0 +1,451 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetMinCpuPlatformInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SetMinCpuPlatformInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.instancesSetMinCpuPlatformRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SetMinCpuPlatformInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.instancesSetMinCpuPlatformRequestResource = instancesSetMinCpuPlatformRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("instancesSetMinCpuPlatformRequestResource")) { + return instancesSetMinCpuPlatformRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstancesSetMinCpuPlatformRequest getApiMessageRequestBody() { + return instancesSetMinCpuPlatformRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public InstancesSetMinCpuPlatformRequest getInstancesSetMinCpuPlatformRequestResource() { + return instancesSetMinCpuPlatformRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetMinCpuPlatformInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetMinCpuPlatformInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetMinCpuPlatformInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetMinCpuPlatformInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetMinCpuPlatformInstanceHttpRequest other) { + if (other == SetMinCpuPlatformInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getInstancesSetMinCpuPlatformRequestResource() != null) { + this.instancesSetMinCpuPlatformRequestResource = + other.instancesSetMinCpuPlatformRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetMinCpuPlatformInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.instancesSetMinCpuPlatformRequestResource = + source.instancesSetMinCpuPlatformRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public InstancesSetMinCpuPlatformRequest getInstancesSetMinCpuPlatformRequestResource() { + return instancesSetMinCpuPlatformRequestResource; + } + + public Builder setInstancesSetMinCpuPlatformRequestResource( + InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource) { + this.instancesSetMinCpuPlatformRequestResource = instancesSetMinCpuPlatformRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetMinCpuPlatformInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetMinCpuPlatformInstanceHttpRequest( + access_token, + callback, + fields, + instance, + instancesSetMinCpuPlatformRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setInstancesSetMinCpuPlatformRequestResource( + this.instancesSetMinCpuPlatformRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetMinCpuPlatformInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "instancesSetMinCpuPlatformRequestResource=" + + instancesSetMinCpuPlatformRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetMinCpuPlatformInstanceHttpRequest) { + SetMinCpuPlatformInstanceHttpRequest that = (SetMinCpuPlatformInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals( + this.instancesSetMinCpuPlatformRequestResource, + that.getInstancesSetMinCpuPlatformRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instance, + instancesSetMinCpuPlatformRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetNamedPortsInstanceGroupHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetNamedPortsInstanceGroupHttpRequest.java new file mode 100644 index 000000000000..deb3334abff7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetNamedPortsInstanceGroupHttpRequest.java @@ -0,0 +1,451 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetNamedPortsInstanceGroupHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroup; + private final InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SetNamedPortsInstanceGroupHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroup = null; + this.instanceGroupsSetNamedPortsRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SetNamedPortsInstanceGroupHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroup, + InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroup = instanceGroup; + this.instanceGroupsSetNamedPortsRequestResource = instanceGroupsSetNamedPortsRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroup")) { + return instanceGroup; + } + if (fieldName.equals("instanceGroupsSetNamedPortsRequestResource")) { + return instanceGroupsSetNamedPortsRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceGroupsSetNamedPortsRequest getApiMessageRequestBody() { + return instanceGroupsSetNamedPortsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public InstanceGroupsSetNamedPortsRequest getInstanceGroupsSetNamedPortsRequestResource() { + return instanceGroupsSetNamedPortsRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetNamedPortsInstanceGroupHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetNamedPortsInstanceGroupHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetNamedPortsInstanceGroupHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetNamedPortsInstanceGroupHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroup; + private InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetNamedPortsInstanceGroupHttpRequest other) { + if (other == SetNamedPortsInstanceGroupHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroup() != null) { + this.instanceGroup = other.instanceGroup; + } + if (other.getInstanceGroupsSetNamedPortsRequestResource() != null) { + this.instanceGroupsSetNamedPortsRequestResource = + other.instanceGroupsSetNamedPortsRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetNamedPortsInstanceGroupHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroup = source.instanceGroup; + this.instanceGroupsSetNamedPortsRequestResource = + source.instanceGroupsSetNamedPortsRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public InstanceGroupsSetNamedPortsRequest getInstanceGroupsSetNamedPortsRequestResource() { + return instanceGroupsSetNamedPortsRequestResource; + } + + public Builder setInstanceGroupsSetNamedPortsRequestResource( + InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource) { + this.instanceGroupsSetNamedPortsRequestResource = instanceGroupsSetNamedPortsRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetNamedPortsInstanceGroupHttpRequest build() { + String missing = ""; + + if (instanceGroup == null) { + missing += " instanceGroup"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetNamedPortsInstanceGroupHttpRequest( + access_token, + callback, + fields, + instanceGroup, + instanceGroupsSetNamedPortsRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroup(this.instanceGroup); + newBuilder.setInstanceGroupsSetNamedPortsRequestResource( + this.instanceGroupsSetNamedPortsRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetNamedPortsInstanceGroupHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroup=" + + instanceGroup + + ", " + + "instanceGroupsSetNamedPortsRequestResource=" + + instanceGroupsSetNamedPortsRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetNamedPortsInstanceGroupHttpRequest) { + SetNamedPortsInstanceGroupHttpRequest that = (SetNamedPortsInstanceGroupHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals( + this.instanceGroupsSetNamedPortsRequestResource, + that.getInstanceGroupsSetNamedPortsRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroup, + instanceGroupsSetNamedPortsRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetNamedPortsRegionInstanceGroupHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetNamedPortsRegionInstanceGroupHttpRequest.java new file mode 100644 index 000000000000..8557570e6ce3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetNamedPortsRegionInstanceGroupHttpRequest.java @@ -0,0 +1,458 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetNamedPortsRegionInstanceGroupHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroup; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final RegionInstanceGroupsSetNamedPortsRequest + regionInstanceGroupsSetNamedPortsRequestResource; + private final String requestId; + private final String userIp; + + private SetNamedPortsRegionInstanceGroupHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroup = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.regionInstanceGroupsSetNamedPortsRequestResource = null; + this.requestId = null; + this.userIp = null; + } + + private SetNamedPortsRegionInstanceGroupHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroup, + String key, + String prettyPrint, + String quotaUser, + RegionInstanceGroupsSetNamedPortsRequest regionInstanceGroupsSetNamedPortsRequestResource, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroup = instanceGroup; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.regionInstanceGroupsSetNamedPortsRequestResource = + regionInstanceGroupsSetNamedPortsRequestResource; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroup")) { + return instanceGroup; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("regionInstanceGroupsSetNamedPortsRequestResource")) { + return regionInstanceGroupsSetNamedPortsRequestResource; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public RegionInstanceGroupsSetNamedPortsRequest getApiMessageRequestBody() { + return regionInstanceGroupsSetNamedPortsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public RegionInstanceGroupsSetNamedPortsRequest + getRegionInstanceGroupsSetNamedPortsRequestResource() { + return regionInstanceGroupsSetNamedPortsRequestResource; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetNamedPortsRegionInstanceGroupHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetNamedPortsRegionInstanceGroupHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetNamedPortsRegionInstanceGroupHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetNamedPortsRegionInstanceGroupHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroup; + private String key; + private String prettyPrint; + private String quotaUser; + private RegionInstanceGroupsSetNamedPortsRequest + regionInstanceGroupsSetNamedPortsRequestResource; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetNamedPortsRegionInstanceGroupHttpRequest other) { + if (other == SetNamedPortsRegionInstanceGroupHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroup() != null) { + this.instanceGroup = other.instanceGroup; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegionInstanceGroupsSetNamedPortsRequestResource() != null) { + this.regionInstanceGroupsSetNamedPortsRequestResource = + other.regionInstanceGroupsSetNamedPortsRequestResource; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetNamedPortsRegionInstanceGroupHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroup = source.instanceGroup; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.regionInstanceGroupsSetNamedPortsRequestResource = + source.regionInstanceGroupsSetNamedPortsRequestResource; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroup() { + return instanceGroup; + } + + public Builder setInstanceGroup(String instanceGroup) { + this.instanceGroup = instanceGroup; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public RegionInstanceGroupsSetNamedPortsRequest + getRegionInstanceGroupsSetNamedPortsRequestResource() { + return regionInstanceGroupsSetNamedPortsRequestResource; + } + + public Builder setRegionInstanceGroupsSetNamedPortsRequestResource( + RegionInstanceGroupsSetNamedPortsRequest regionInstanceGroupsSetNamedPortsRequestResource) { + this.regionInstanceGroupsSetNamedPortsRequestResource = + regionInstanceGroupsSetNamedPortsRequestResource; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetNamedPortsRegionInstanceGroupHttpRequest build() { + String missing = ""; + + if (instanceGroup == null) { + missing += " instanceGroup"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetNamedPortsRegionInstanceGroupHttpRequest( + access_token, + callback, + fields, + instanceGroup, + key, + prettyPrint, + quotaUser, + regionInstanceGroupsSetNamedPortsRequestResource, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroup(this.instanceGroup); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegionInstanceGroupsSetNamedPortsRequestResource( + this.regionInstanceGroupsSetNamedPortsRequestResource); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetNamedPortsRegionInstanceGroupHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroup=" + + instanceGroup + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "regionInstanceGroupsSetNamedPortsRequestResource=" + + regionInstanceGroupsSetNamedPortsRequestResource + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetNamedPortsRegionInstanceGroupHttpRequest) { + SetNamedPortsRegionInstanceGroupHttpRequest that = + (SetNamedPortsRegionInstanceGroupHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroup, that.getInstanceGroup()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals( + this.regionInstanceGroupsSetNamedPortsRequestResource, + that.getRegionInstanceGroupsSetNamedPortsRequestResource()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroup, + key, + prettyPrint, + quotaUser, + regionInstanceGroupsSetNamedPortsRequestResource, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetPrivateIpGoogleAccessSubnetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetPrivateIpGoogleAccessSubnetworkHttpRequest.java new file mode 100644 index 000000000000..f94b3e6f4f67 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetPrivateIpGoogleAccessSubnetworkHttpRequest.java @@ -0,0 +1,459 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetPrivateIpGoogleAccessSubnetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String subnetwork; + private final SubnetworksSetPrivateIpGoogleAccessRequest + subnetworksSetPrivateIpGoogleAccessRequestResource; + private final String userIp; + + private SetPrivateIpGoogleAccessSubnetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.subnetwork = null; + this.subnetworksSetPrivateIpGoogleAccessRequestResource = null; + this.userIp = null; + } + + private SetPrivateIpGoogleAccessSubnetworkHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String subnetwork, + SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.subnetwork = subnetwork; + this.subnetworksSetPrivateIpGoogleAccessRequestResource = + subnetworksSetPrivateIpGoogleAccessRequestResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("subnetwork")) { + return subnetwork; + } + if (fieldName.equals("subnetworksSetPrivateIpGoogleAccessRequestResource")) { + return subnetworksSetPrivateIpGoogleAccessRequestResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public SubnetworksSetPrivateIpGoogleAccessRequest getApiMessageRequestBody() { + return subnetworksSetPrivateIpGoogleAccessRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getSubnetwork() { + return subnetwork; + } + + public SubnetworksSetPrivateIpGoogleAccessRequest + getSubnetworksSetPrivateIpGoogleAccessRequestResource() { + return subnetworksSetPrivateIpGoogleAccessRequestResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetPrivateIpGoogleAccessSubnetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetPrivateIpGoogleAccessSubnetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetPrivateIpGoogleAccessSubnetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetPrivateIpGoogleAccessSubnetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String subnetwork; + private SubnetworksSetPrivateIpGoogleAccessRequest + subnetworksSetPrivateIpGoogleAccessRequestResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetPrivateIpGoogleAccessSubnetworkHttpRequest other) { + if (other == SetPrivateIpGoogleAccessSubnetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSubnetwork() != null) { + this.subnetwork = other.subnetwork; + } + if (other.getSubnetworksSetPrivateIpGoogleAccessRequestResource() != null) { + this.subnetworksSetPrivateIpGoogleAccessRequestResource = + other.subnetworksSetPrivateIpGoogleAccessRequestResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetPrivateIpGoogleAccessSubnetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.subnetwork = source.subnetwork; + this.subnetworksSetPrivateIpGoogleAccessRequestResource = + source.subnetworksSetPrivateIpGoogleAccessRequestResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getSubnetwork() { + return subnetwork; + } + + public Builder setSubnetwork(String subnetwork) { + this.subnetwork = subnetwork; + return this; + } + + public SubnetworksSetPrivateIpGoogleAccessRequest + getSubnetworksSetPrivateIpGoogleAccessRequestResource() { + return subnetworksSetPrivateIpGoogleAccessRequestResource; + } + + public Builder setSubnetworksSetPrivateIpGoogleAccessRequestResource( + SubnetworksSetPrivateIpGoogleAccessRequest + subnetworksSetPrivateIpGoogleAccessRequestResource) { + this.subnetworksSetPrivateIpGoogleAccessRequestResource = + subnetworksSetPrivateIpGoogleAccessRequestResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetPrivateIpGoogleAccessSubnetworkHttpRequest build() { + String missing = ""; + + if (subnetwork == null) { + missing += " subnetwork"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetPrivateIpGoogleAccessSubnetworkHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + subnetwork, + subnetworksSetPrivateIpGoogleAccessRequestResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSubnetwork(this.subnetwork); + newBuilder.setSubnetworksSetPrivateIpGoogleAccessRequestResource( + this.subnetworksSetPrivateIpGoogleAccessRequestResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetPrivateIpGoogleAccessSubnetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "subnetwork=" + + subnetwork + + ", " + + "subnetworksSetPrivateIpGoogleAccessRequestResource=" + + subnetworksSetPrivateIpGoogleAccessRequestResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetPrivateIpGoogleAccessSubnetworkHttpRequest) { + SetPrivateIpGoogleAccessSubnetworkHttpRequest that = + (SetPrivateIpGoogleAccessSubnetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.subnetwork, that.getSubnetwork()) + && Objects.equals( + this.subnetworksSetPrivateIpGoogleAccessRequestResource, + that.getSubnetworksSetPrivateIpGoogleAccessRequestResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + subnetwork, + subnetworksSetPrivateIpGoogleAccessRequestResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetProxyHeaderTargetSslProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetProxyHeaderTargetSslProxyHttpRequest.java new file mode 100644 index 000000000000..940b1957222d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetProxyHeaderTargetSslProxyHttpRequest.java @@ -0,0 +1,454 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetProxyHeaderTargetSslProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource; + private final String targetSslProxy; + private final String userIp; + + private SetProxyHeaderTargetSslProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetSslProxiesSetProxyHeaderRequestResource = null; + this.targetSslProxy = null; + this.userIp = null; + } + + private SetProxyHeaderTargetSslProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource, + String targetSslProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetSslProxiesSetProxyHeaderRequestResource = + targetSslProxiesSetProxyHeaderRequestResource; + this.targetSslProxy = targetSslProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetSslProxiesSetProxyHeaderRequestResource")) { + return targetSslProxiesSetProxyHeaderRequestResource; + } + if (fieldName.equals("targetSslProxy")) { + return targetSslProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetSslProxiesSetProxyHeaderRequest getApiMessageRequestBody() { + return targetSslProxiesSetProxyHeaderRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetSslProxiesSetProxyHeaderRequest getTargetSslProxiesSetProxyHeaderRequestResource() { + return targetSslProxiesSetProxyHeaderRequestResource; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetProxyHeaderTargetSslProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetProxyHeaderTargetSslProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetProxyHeaderTargetSslProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetProxyHeaderTargetSslProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource; + private String targetSslProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetProxyHeaderTargetSslProxyHttpRequest other) { + if (other == SetProxyHeaderTargetSslProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetSslProxiesSetProxyHeaderRequestResource() != null) { + this.targetSslProxiesSetProxyHeaderRequestResource = + other.targetSslProxiesSetProxyHeaderRequestResource; + } + if (other.getTargetSslProxy() != null) { + this.targetSslProxy = other.targetSslProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetProxyHeaderTargetSslProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetSslProxiesSetProxyHeaderRequestResource = + source.targetSslProxiesSetProxyHeaderRequestResource; + this.targetSslProxy = source.targetSslProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetSslProxiesSetProxyHeaderRequest + getTargetSslProxiesSetProxyHeaderRequestResource() { + return targetSslProxiesSetProxyHeaderRequestResource; + } + + public Builder setTargetSslProxiesSetProxyHeaderRequestResource( + TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource) { + this.targetSslProxiesSetProxyHeaderRequestResource = + targetSslProxiesSetProxyHeaderRequestResource; + return this; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public Builder setTargetSslProxy(String targetSslProxy) { + this.targetSslProxy = targetSslProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetProxyHeaderTargetSslProxyHttpRequest build() { + String missing = ""; + + if (targetSslProxy == null) { + missing += " targetSslProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetProxyHeaderTargetSslProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetSslProxiesSetProxyHeaderRequestResource, + targetSslProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetSslProxiesSetProxyHeaderRequestResource( + this.targetSslProxiesSetProxyHeaderRequestResource); + newBuilder.setTargetSslProxy(this.targetSslProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetProxyHeaderTargetSslProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetSslProxiesSetProxyHeaderRequestResource=" + + targetSslProxiesSetProxyHeaderRequestResource + + ", " + + "targetSslProxy=" + + targetSslProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetProxyHeaderTargetSslProxyHttpRequest) { + SetProxyHeaderTargetSslProxyHttpRequest that = (SetProxyHeaderTargetSslProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals( + this.targetSslProxiesSetProxyHeaderRequestResource, + that.getTargetSslProxiesSetProxyHeaderRequestResource()) + && Objects.equals(this.targetSslProxy, that.getTargetSslProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetSslProxiesSetProxyHeaderRequestResource, + targetSslProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetProxyHeaderTargetTcpProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetProxyHeaderTargetTcpProxyHttpRequest.java new file mode 100644 index 000000000000..97bcded5875d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetProxyHeaderTargetTcpProxyHttpRequest.java @@ -0,0 +1,454 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetProxyHeaderTargetTcpProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource; + private final String targetTcpProxy; + private final String userIp; + + private SetProxyHeaderTargetTcpProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetTcpProxiesSetProxyHeaderRequestResource = null; + this.targetTcpProxy = null; + this.userIp = null; + } + + private SetProxyHeaderTargetTcpProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource, + String targetTcpProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetTcpProxiesSetProxyHeaderRequestResource = + targetTcpProxiesSetProxyHeaderRequestResource; + this.targetTcpProxy = targetTcpProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetTcpProxiesSetProxyHeaderRequestResource")) { + return targetTcpProxiesSetProxyHeaderRequestResource; + } + if (fieldName.equals("targetTcpProxy")) { + return targetTcpProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetTcpProxiesSetProxyHeaderRequest getApiMessageRequestBody() { + return targetTcpProxiesSetProxyHeaderRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetTcpProxiesSetProxyHeaderRequest getTargetTcpProxiesSetProxyHeaderRequestResource() { + return targetTcpProxiesSetProxyHeaderRequestResource; + } + + public String getTargetTcpProxy() { + return targetTcpProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetProxyHeaderTargetTcpProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetProxyHeaderTargetTcpProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetProxyHeaderTargetTcpProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetProxyHeaderTargetTcpProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource; + private String targetTcpProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetProxyHeaderTargetTcpProxyHttpRequest other) { + if (other == SetProxyHeaderTargetTcpProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetTcpProxiesSetProxyHeaderRequestResource() != null) { + this.targetTcpProxiesSetProxyHeaderRequestResource = + other.targetTcpProxiesSetProxyHeaderRequestResource; + } + if (other.getTargetTcpProxy() != null) { + this.targetTcpProxy = other.targetTcpProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetProxyHeaderTargetTcpProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetTcpProxiesSetProxyHeaderRequestResource = + source.targetTcpProxiesSetProxyHeaderRequestResource; + this.targetTcpProxy = source.targetTcpProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetTcpProxiesSetProxyHeaderRequest + getTargetTcpProxiesSetProxyHeaderRequestResource() { + return targetTcpProxiesSetProxyHeaderRequestResource; + } + + public Builder setTargetTcpProxiesSetProxyHeaderRequestResource( + TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource) { + this.targetTcpProxiesSetProxyHeaderRequestResource = + targetTcpProxiesSetProxyHeaderRequestResource; + return this; + } + + public String getTargetTcpProxy() { + return targetTcpProxy; + } + + public Builder setTargetTcpProxy(String targetTcpProxy) { + this.targetTcpProxy = targetTcpProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetProxyHeaderTargetTcpProxyHttpRequest build() { + String missing = ""; + + if (targetTcpProxy == null) { + missing += " targetTcpProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetProxyHeaderTargetTcpProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetTcpProxiesSetProxyHeaderRequestResource, + targetTcpProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetTcpProxiesSetProxyHeaderRequestResource( + this.targetTcpProxiesSetProxyHeaderRequestResource); + newBuilder.setTargetTcpProxy(this.targetTcpProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetProxyHeaderTargetTcpProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetTcpProxiesSetProxyHeaderRequestResource=" + + targetTcpProxiesSetProxyHeaderRequestResource + + ", " + + "targetTcpProxy=" + + targetTcpProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetProxyHeaderTargetTcpProxyHttpRequest) { + SetProxyHeaderTargetTcpProxyHttpRequest that = (SetProxyHeaderTargetTcpProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals( + this.targetTcpProxiesSetProxyHeaderRequestResource, + that.getTargetTcpProxiesSetProxyHeaderRequestResource()) + && Objects.equals(this.targetTcpProxy, that.getTargetTcpProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetTcpProxiesSetProxyHeaderRequestResource, + targetTcpProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSchedulingInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSchedulingInstanceHttpRequest.java new file mode 100644 index 000000000000..ab2132538887 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSchedulingInstanceHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetSchedulingInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final Scheduling schedulingResource; + private final String userIp; + + private SetSchedulingInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.schedulingResource = null; + this.userIp = null; + } + + private SetSchedulingInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + String key, + String prettyPrint, + String quotaUser, + String requestId, + Scheduling schedulingResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.schedulingResource = schedulingResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("schedulingResource")) { + return schedulingResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Scheduling getApiMessageRequestBody() { + return schedulingResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public Scheduling getSchedulingResource() { + return schedulingResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetSchedulingInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetSchedulingInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetSchedulingInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetSchedulingInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private Scheduling schedulingResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetSchedulingInstanceHttpRequest other) { + if (other == SetSchedulingInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSchedulingResource() != null) { + this.schedulingResource = other.schedulingResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetSchedulingInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.schedulingResource = source.schedulingResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Scheduling getSchedulingResource() { + return schedulingResource; + } + + public Builder setSchedulingResource(Scheduling schedulingResource) { + this.schedulingResource = schedulingResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetSchedulingInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetSchedulingInstanceHttpRequest( + access_token, + callback, + fields, + instance, + key, + prettyPrint, + quotaUser, + requestId, + schedulingResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSchedulingResource(this.schedulingResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetSchedulingInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "schedulingResource=" + + schedulingResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetSchedulingInstanceHttpRequest) { + SetSchedulingInstanceHttpRequest that = (SetSchedulingInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.schedulingResource, that.getSchedulingResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instance, + key, + prettyPrint, + quotaUser, + requestId, + schedulingResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetServiceAccountInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetServiceAccountInstanceHttpRequest.java new file mode 100644 index 000000000000..913fb653a488 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetServiceAccountInstanceHttpRequest.java @@ -0,0 +1,451 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetServiceAccountInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SetServiceAccountInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.instancesSetServiceAccountRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SetServiceAccountInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.instancesSetServiceAccountRequestResource = instancesSetServiceAccountRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("instancesSetServiceAccountRequestResource")) { + return instancesSetServiceAccountRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstancesSetServiceAccountRequest getApiMessageRequestBody() { + return instancesSetServiceAccountRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public InstancesSetServiceAccountRequest getInstancesSetServiceAccountRequestResource() { + return instancesSetServiceAccountRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetServiceAccountInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetServiceAccountInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetServiceAccountInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetServiceAccountInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetServiceAccountInstanceHttpRequest other) { + if (other == SetServiceAccountInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getInstancesSetServiceAccountRequestResource() != null) { + this.instancesSetServiceAccountRequestResource = + other.instancesSetServiceAccountRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetServiceAccountInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.instancesSetServiceAccountRequestResource = + source.instancesSetServiceAccountRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public InstancesSetServiceAccountRequest getInstancesSetServiceAccountRequestResource() { + return instancesSetServiceAccountRequestResource; + } + + public Builder setInstancesSetServiceAccountRequestResource( + InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource) { + this.instancesSetServiceAccountRequestResource = instancesSetServiceAccountRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetServiceAccountInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetServiceAccountInstanceHttpRequest( + access_token, + callback, + fields, + instance, + instancesSetServiceAccountRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setInstancesSetServiceAccountRequestResource( + this.instancesSetServiceAccountRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetServiceAccountInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "instancesSetServiceAccountRequestResource=" + + instancesSetServiceAccountRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetServiceAccountInstanceHttpRequest) { + SetServiceAccountInstanceHttpRequest that = (SetServiceAccountInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals( + this.instancesSetServiceAccountRequestResource, + that.getInstancesSetServiceAccountRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instance, + instancesSetServiceAccountRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslCertificatesTargetHttpsProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslCertificatesTargetHttpsProxyHttpRequest.java new file mode 100644 index 000000000000..b754e5a5f75a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslCertificatesTargetHttpsProxyHttpRequest.java @@ -0,0 +1,460 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetSslCertificatesTargetHttpsProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final TargetHttpsProxiesSetSslCertificatesRequest + targetHttpsProxiesSetSslCertificatesRequestResource; + private final String targetHttpsProxy; + private final String userIp; + + private SetSslCertificatesTargetHttpsProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetHttpsProxiesSetSslCertificatesRequestResource = null; + this.targetHttpsProxy = null; + this.userIp = null; + } + + private SetSslCertificatesTargetHttpsProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + TargetHttpsProxiesSetSslCertificatesRequest + targetHttpsProxiesSetSslCertificatesRequestResource, + String targetHttpsProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetHttpsProxiesSetSslCertificatesRequestResource = + targetHttpsProxiesSetSslCertificatesRequestResource; + this.targetHttpsProxy = targetHttpsProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetHttpsProxiesSetSslCertificatesRequestResource")) { + return targetHttpsProxiesSetSslCertificatesRequestResource; + } + if (fieldName.equals("targetHttpsProxy")) { + return targetHttpsProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetHttpsProxiesSetSslCertificatesRequest getApiMessageRequestBody() { + return targetHttpsProxiesSetSslCertificatesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetHttpsProxiesSetSslCertificatesRequest + getTargetHttpsProxiesSetSslCertificatesRequestResource() { + return targetHttpsProxiesSetSslCertificatesRequestResource; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetSslCertificatesTargetHttpsProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetSslCertificatesTargetHttpsProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetSslCertificatesTargetHttpsProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetSslCertificatesTargetHttpsProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private TargetHttpsProxiesSetSslCertificatesRequest + targetHttpsProxiesSetSslCertificatesRequestResource; + private String targetHttpsProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetSslCertificatesTargetHttpsProxyHttpRequest other) { + if (other == SetSslCertificatesTargetHttpsProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetHttpsProxiesSetSslCertificatesRequestResource() != null) { + this.targetHttpsProxiesSetSslCertificatesRequestResource = + other.targetHttpsProxiesSetSslCertificatesRequestResource; + } + if (other.getTargetHttpsProxy() != null) { + this.targetHttpsProxy = other.targetHttpsProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetSslCertificatesTargetHttpsProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetHttpsProxiesSetSslCertificatesRequestResource = + source.targetHttpsProxiesSetSslCertificatesRequestResource; + this.targetHttpsProxy = source.targetHttpsProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetHttpsProxiesSetSslCertificatesRequest + getTargetHttpsProxiesSetSslCertificatesRequestResource() { + return targetHttpsProxiesSetSslCertificatesRequestResource; + } + + public Builder setTargetHttpsProxiesSetSslCertificatesRequestResource( + TargetHttpsProxiesSetSslCertificatesRequest + targetHttpsProxiesSetSslCertificatesRequestResource) { + this.targetHttpsProxiesSetSslCertificatesRequestResource = + targetHttpsProxiesSetSslCertificatesRequestResource; + return this; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public Builder setTargetHttpsProxy(String targetHttpsProxy) { + this.targetHttpsProxy = targetHttpsProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetSslCertificatesTargetHttpsProxyHttpRequest build() { + String missing = ""; + + if (targetHttpsProxy == null) { + missing += " targetHttpsProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetSslCertificatesTargetHttpsProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetHttpsProxiesSetSslCertificatesRequestResource, + targetHttpsProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetHttpsProxiesSetSslCertificatesRequestResource( + this.targetHttpsProxiesSetSslCertificatesRequestResource); + newBuilder.setTargetHttpsProxy(this.targetHttpsProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetSslCertificatesTargetHttpsProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetHttpsProxiesSetSslCertificatesRequestResource=" + + targetHttpsProxiesSetSslCertificatesRequestResource + + ", " + + "targetHttpsProxy=" + + targetHttpsProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetSslCertificatesTargetHttpsProxyHttpRequest) { + SetSslCertificatesTargetHttpsProxyHttpRequest that = + (SetSslCertificatesTargetHttpsProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals( + this.targetHttpsProxiesSetSslCertificatesRequestResource, + that.getTargetHttpsProxiesSetSslCertificatesRequestResource()) + && Objects.equals(this.targetHttpsProxy, that.getTargetHttpsProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetHttpsProxiesSetSslCertificatesRequestResource, + targetHttpsProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslCertificatesTargetSslProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslCertificatesTargetSslProxyHttpRequest.java new file mode 100644 index 000000000000..ce3278ac073e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslCertificatesTargetSslProxyHttpRequest.java @@ -0,0 +1,459 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetSslCertificatesTargetSslProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final TargetSslProxiesSetSslCertificatesRequest + targetSslProxiesSetSslCertificatesRequestResource; + private final String targetSslProxy; + private final String userIp; + + private SetSslCertificatesTargetSslProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetSslProxiesSetSslCertificatesRequestResource = null; + this.targetSslProxy = null; + this.userIp = null; + } + + private SetSslCertificatesTargetSslProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + TargetSslProxiesSetSslCertificatesRequest targetSslProxiesSetSslCertificatesRequestResource, + String targetSslProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetSslProxiesSetSslCertificatesRequestResource = + targetSslProxiesSetSslCertificatesRequestResource; + this.targetSslProxy = targetSslProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetSslProxiesSetSslCertificatesRequestResource")) { + return targetSslProxiesSetSslCertificatesRequestResource; + } + if (fieldName.equals("targetSslProxy")) { + return targetSslProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetSslProxiesSetSslCertificatesRequest getApiMessageRequestBody() { + return targetSslProxiesSetSslCertificatesRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetSslProxiesSetSslCertificatesRequest + getTargetSslProxiesSetSslCertificatesRequestResource() { + return targetSslProxiesSetSslCertificatesRequestResource; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetSslCertificatesTargetSslProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetSslCertificatesTargetSslProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetSslCertificatesTargetSslProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetSslCertificatesTargetSslProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private TargetSslProxiesSetSslCertificatesRequest + targetSslProxiesSetSslCertificatesRequestResource; + private String targetSslProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetSslCertificatesTargetSslProxyHttpRequest other) { + if (other == SetSslCertificatesTargetSslProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetSslProxiesSetSslCertificatesRequestResource() != null) { + this.targetSslProxiesSetSslCertificatesRequestResource = + other.targetSslProxiesSetSslCertificatesRequestResource; + } + if (other.getTargetSslProxy() != null) { + this.targetSslProxy = other.targetSslProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetSslCertificatesTargetSslProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetSslProxiesSetSslCertificatesRequestResource = + source.targetSslProxiesSetSslCertificatesRequestResource; + this.targetSslProxy = source.targetSslProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetSslProxiesSetSslCertificatesRequest + getTargetSslProxiesSetSslCertificatesRequestResource() { + return targetSslProxiesSetSslCertificatesRequestResource; + } + + public Builder setTargetSslProxiesSetSslCertificatesRequestResource( + TargetSslProxiesSetSslCertificatesRequest + targetSslProxiesSetSslCertificatesRequestResource) { + this.targetSslProxiesSetSslCertificatesRequestResource = + targetSslProxiesSetSslCertificatesRequestResource; + return this; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public Builder setTargetSslProxy(String targetSslProxy) { + this.targetSslProxy = targetSslProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetSslCertificatesTargetSslProxyHttpRequest build() { + String missing = ""; + + if (targetSslProxy == null) { + missing += " targetSslProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetSslCertificatesTargetSslProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetSslProxiesSetSslCertificatesRequestResource, + targetSslProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetSslProxiesSetSslCertificatesRequestResource( + this.targetSslProxiesSetSslCertificatesRequestResource); + newBuilder.setTargetSslProxy(this.targetSslProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetSslCertificatesTargetSslProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetSslProxiesSetSslCertificatesRequestResource=" + + targetSslProxiesSetSslCertificatesRequestResource + + ", " + + "targetSslProxy=" + + targetSslProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetSslCertificatesTargetSslProxyHttpRequest) { + SetSslCertificatesTargetSslProxyHttpRequest that = + (SetSslCertificatesTargetSslProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals( + this.targetSslProxiesSetSslCertificatesRequestResource, + that.getTargetSslProxiesSetSslCertificatesRequestResource()) + && Objects.equals(this.targetSslProxy, that.getTargetSslProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetSslProxiesSetSslCertificatesRequestResource, + targetSslProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslPolicyTargetHttpsProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslPolicyTargetHttpsProxyHttpRequest.java new file mode 100644 index 000000000000..2b355c09bdc8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslPolicyTargetHttpsProxyHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetSslPolicyTargetHttpsProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final SslPolicyReference sslPolicyReferenceResource; + private final String targetHttpsProxy; + private final String userIp; + + private SetSslPolicyTargetHttpsProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.sslPolicyReferenceResource = null; + this.targetHttpsProxy = null; + this.userIp = null; + } + + private SetSslPolicyTargetHttpsProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + SslPolicyReference sslPolicyReferenceResource, + String targetHttpsProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.sslPolicyReferenceResource = sslPolicyReferenceResource; + this.targetHttpsProxy = targetHttpsProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("sslPolicyReferenceResource")) { + return sslPolicyReferenceResource; + } + if (fieldName.equals("targetHttpsProxy")) { + return targetHttpsProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public SslPolicyReference getApiMessageRequestBody() { + return sslPolicyReferenceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public SslPolicyReference getSslPolicyReferenceResource() { + return sslPolicyReferenceResource; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetSslPolicyTargetHttpsProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetSslPolicyTargetHttpsProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetSslPolicyTargetHttpsProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetSslPolicyTargetHttpsProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private SslPolicyReference sslPolicyReferenceResource; + private String targetHttpsProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetSslPolicyTargetHttpsProxyHttpRequest other) { + if (other == SetSslPolicyTargetHttpsProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSslPolicyReferenceResource() != null) { + this.sslPolicyReferenceResource = other.sslPolicyReferenceResource; + } + if (other.getTargetHttpsProxy() != null) { + this.targetHttpsProxy = other.targetHttpsProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetSslPolicyTargetHttpsProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.sslPolicyReferenceResource = source.sslPolicyReferenceResource; + this.targetHttpsProxy = source.targetHttpsProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public SslPolicyReference getSslPolicyReferenceResource() { + return sslPolicyReferenceResource; + } + + public Builder setSslPolicyReferenceResource(SslPolicyReference sslPolicyReferenceResource) { + this.sslPolicyReferenceResource = sslPolicyReferenceResource; + return this; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public Builder setTargetHttpsProxy(String targetHttpsProxy) { + this.targetHttpsProxy = targetHttpsProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetSslPolicyTargetHttpsProxyHttpRequest build() { + String missing = ""; + + if (targetHttpsProxy == null) { + missing += " targetHttpsProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetSslPolicyTargetHttpsProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + sslPolicyReferenceResource, + targetHttpsProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSslPolicyReferenceResource(this.sslPolicyReferenceResource); + newBuilder.setTargetHttpsProxy(this.targetHttpsProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetSslPolicyTargetHttpsProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "sslPolicyReferenceResource=" + + sslPolicyReferenceResource + + ", " + + "targetHttpsProxy=" + + targetHttpsProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetSslPolicyTargetHttpsProxyHttpRequest) { + SetSslPolicyTargetHttpsProxyHttpRequest that = (SetSslPolicyTargetHttpsProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.sslPolicyReferenceResource, that.getSslPolicyReferenceResource()) + && Objects.equals(this.targetHttpsProxy, that.getTargetHttpsProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + sslPolicyReferenceResource, + targetHttpsProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslPolicyTargetSslProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslPolicyTargetSslProxyHttpRequest.java new file mode 100644 index 000000000000..187704c3d2dd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetSslPolicyTargetSslProxyHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetSslPolicyTargetSslProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final SslPolicyReference sslPolicyReferenceResource; + private final String targetSslProxy; + private final String userIp; + + private SetSslPolicyTargetSslProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.sslPolicyReferenceResource = null; + this.targetSslProxy = null; + this.userIp = null; + } + + private SetSslPolicyTargetSslProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + SslPolicyReference sslPolicyReferenceResource, + String targetSslProxy, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.sslPolicyReferenceResource = sslPolicyReferenceResource; + this.targetSslProxy = targetSslProxy; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("sslPolicyReferenceResource")) { + return sslPolicyReferenceResource; + } + if (fieldName.equals("targetSslProxy")) { + return targetSslProxy; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public SslPolicyReference getApiMessageRequestBody() { + return sslPolicyReferenceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public SslPolicyReference getSslPolicyReferenceResource() { + return sslPolicyReferenceResource; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetSslPolicyTargetSslProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetSslPolicyTargetSslProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetSslPolicyTargetSslProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetSslPolicyTargetSslProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private SslPolicyReference sslPolicyReferenceResource; + private String targetSslProxy; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetSslPolicyTargetSslProxyHttpRequest other) { + if (other == SetSslPolicyTargetSslProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getSslPolicyReferenceResource() != null) { + this.sslPolicyReferenceResource = other.sslPolicyReferenceResource; + } + if (other.getTargetSslProxy() != null) { + this.targetSslProxy = other.targetSslProxy; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetSslPolicyTargetSslProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.sslPolicyReferenceResource = source.sslPolicyReferenceResource; + this.targetSslProxy = source.targetSslProxy; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public SslPolicyReference getSslPolicyReferenceResource() { + return sslPolicyReferenceResource; + } + + public Builder setSslPolicyReferenceResource(SslPolicyReference sslPolicyReferenceResource) { + this.sslPolicyReferenceResource = sslPolicyReferenceResource; + return this; + } + + public String getTargetSslProxy() { + return targetSslProxy; + } + + public Builder setTargetSslProxy(String targetSslProxy) { + this.targetSslProxy = targetSslProxy; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetSslPolicyTargetSslProxyHttpRequest build() { + String missing = ""; + + if (targetSslProxy == null) { + missing += " targetSslProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetSslPolicyTargetSslProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + sslPolicyReferenceResource, + targetSslProxy, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setSslPolicyReferenceResource(this.sslPolicyReferenceResource); + newBuilder.setTargetSslProxy(this.targetSslProxy); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetSslPolicyTargetSslProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "sslPolicyReferenceResource=" + + sslPolicyReferenceResource + + ", " + + "targetSslProxy=" + + targetSslProxy + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetSslPolicyTargetSslProxyHttpRequest) { + SetSslPolicyTargetSslProxyHttpRequest that = (SetSslPolicyTargetSslProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.sslPolicyReferenceResource, that.getSslPolicyReferenceResource()) + && Objects.equals(this.targetSslProxy, that.getTargetSslProxy()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + sslPolicyReferenceResource, + targetSslProxy, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTagsInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTagsInstanceHttpRequest.java new file mode 100644 index 000000000000..c04373e8a529 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTagsInstanceHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetTagsInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final Tags tagsResource; + private final String userIp; + + private SetTagsInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.tagsResource = null; + this.userIp = null; + } + + private SetTagsInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + String key, + String prettyPrint, + String quotaUser, + String requestId, + Tags tagsResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.tagsResource = tagsResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("tagsResource")) { + return tagsResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Tags getApiMessageRequestBody() { + return tagsResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public Tags getTagsResource() { + return tagsResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetTagsInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetTagsInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetTagsInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetTagsInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private Tags tagsResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetTagsInstanceHttpRequest other) { + if (other == SetTagsInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTagsResource() != null) { + this.tagsResource = other.tagsResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetTagsInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.tagsResource = source.tagsResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Tags getTagsResource() { + return tagsResource; + } + + public Builder setTagsResource(Tags tagsResource) { + this.tagsResource = tagsResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetTagsInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetTagsInstanceHttpRequest( + access_token, + callback, + fields, + instance, + key, + prettyPrint, + quotaUser, + requestId, + tagsResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTagsResource(this.tagsResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetTagsInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "tagsResource=" + + tagsResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetTagsInstanceHttpRequest) { + SetTagsInstanceHttpRequest that = (SetTagsInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.tagsResource, that.getTagsResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instance, + key, + prettyPrint, + quotaUser, + requestId, + tagsResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetForwardingRuleHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetForwardingRuleHttpRequest.java new file mode 100644 index 000000000000..0f4011f2ca43 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetForwardingRuleHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetTargetForwardingRuleHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String forwardingRule; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final TargetReference targetReferenceResource; + private final String userIp; + + private SetTargetForwardingRuleHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.forwardingRule = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetReferenceResource = null; + this.userIp = null; + } + + private SetTargetForwardingRuleHttpRequest( + String access_token, + String callback, + String fields, + String forwardingRule, + String key, + String prettyPrint, + String quotaUser, + String requestId, + TargetReference targetReferenceResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.forwardingRule = forwardingRule; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetReferenceResource = targetReferenceResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("forwardingRule")) { + return forwardingRule; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetReferenceResource")) { + return targetReferenceResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetReference getApiMessageRequestBody() { + return targetReferenceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetReference getTargetReferenceResource() { + return targetReferenceResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetTargetForwardingRuleHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetTargetForwardingRuleHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetTargetForwardingRuleHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetTargetForwardingRuleHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String forwardingRule; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private TargetReference targetReferenceResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetTargetForwardingRuleHttpRequest other) { + if (other == SetTargetForwardingRuleHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getForwardingRule() != null) { + this.forwardingRule = other.forwardingRule; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetReferenceResource() != null) { + this.targetReferenceResource = other.targetReferenceResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetTargetForwardingRuleHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.forwardingRule = source.forwardingRule; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetReferenceResource = source.targetReferenceResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public Builder setForwardingRule(String forwardingRule) { + this.forwardingRule = forwardingRule; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetReference getTargetReferenceResource() { + return targetReferenceResource; + } + + public Builder setTargetReferenceResource(TargetReference targetReferenceResource) { + this.targetReferenceResource = targetReferenceResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetTargetForwardingRuleHttpRequest build() { + String missing = ""; + + if (forwardingRule == null) { + missing += " forwardingRule"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetTargetForwardingRuleHttpRequest( + access_token, + callback, + fields, + forwardingRule, + key, + prettyPrint, + quotaUser, + requestId, + targetReferenceResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setForwardingRule(this.forwardingRule); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetReferenceResource(this.targetReferenceResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetTargetForwardingRuleHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "forwardingRule=" + + forwardingRule + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetReferenceResource=" + + targetReferenceResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetTargetForwardingRuleHttpRequest) { + SetTargetForwardingRuleHttpRequest that = (SetTargetForwardingRuleHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.forwardingRule, that.getForwardingRule()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetReferenceResource, that.getTargetReferenceResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + forwardingRule, + key, + prettyPrint, + quotaUser, + requestId, + targetReferenceResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetGlobalForwardingRuleHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetGlobalForwardingRuleHttpRequest.java new file mode 100644 index 000000000000..591c84ce4079 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetGlobalForwardingRuleHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetTargetGlobalForwardingRuleHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String forwardingRule; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final TargetReference targetReferenceResource; + private final String userIp; + + private SetTargetGlobalForwardingRuleHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.forwardingRule = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetReferenceResource = null; + this.userIp = null; + } + + private SetTargetGlobalForwardingRuleHttpRequest( + String access_token, + String callback, + String fields, + String forwardingRule, + String key, + String prettyPrint, + String quotaUser, + String requestId, + TargetReference targetReferenceResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.forwardingRule = forwardingRule; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetReferenceResource = targetReferenceResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("forwardingRule")) { + return forwardingRule; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetReferenceResource")) { + return targetReferenceResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TargetReference getApiMessageRequestBody() { + return targetReferenceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public TargetReference getTargetReferenceResource() { + return targetReferenceResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetTargetGlobalForwardingRuleHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetTargetGlobalForwardingRuleHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetTargetGlobalForwardingRuleHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetTargetGlobalForwardingRuleHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String forwardingRule; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private TargetReference targetReferenceResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetTargetGlobalForwardingRuleHttpRequest other) { + if (other == SetTargetGlobalForwardingRuleHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getForwardingRule() != null) { + this.forwardingRule = other.forwardingRule; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetReferenceResource() != null) { + this.targetReferenceResource = other.targetReferenceResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetTargetGlobalForwardingRuleHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.forwardingRule = source.forwardingRule; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetReferenceResource = source.targetReferenceResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getForwardingRule() { + return forwardingRule; + } + + public Builder setForwardingRule(String forwardingRule) { + this.forwardingRule = forwardingRule; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public TargetReference getTargetReferenceResource() { + return targetReferenceResource; + } + + public Builder setTargetReferenceResource(TargetReference targetReferenceResource) { + this.targetReferenceResource = targetReferenceResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetTargetGlobalForwardingRuleHttpRequest build() { + String missing = ""; + + if (forwardingRule == null) { + missing += " forwardingRule"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetTargetGlobalForwardingRuleHttpRequest( + access_token, + callback, + fields, + forwardingRule, + key, + prettyPrint, + quotaUser, + requestId, + targetReferenceResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setForwardingRule(this.forwardingRule); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetReferenceResource(this.targetReferenceResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetTargetGlobalForwardingRuleHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "forwardingRule=" + + forwardingRule + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetReferenceResource=" + + targetReferenceResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetTargetGlobalForwardingRuleHttpRequest) { + SetTargetGlobalForwardingRuleHttpRequest that = (SetTargetGlobalForwardingRuleHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.forwardingRule, that.getForwardingRule()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetReferenceResource, that.getTargetReferenceResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + forwardingRule, + key, + prettyPrint, + quotaUser, + requestId, + targetReferenceResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetPoolsInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetPoolsInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..de3e6724cc64 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetPoolsInstanceGroupManagerHttpRequest.java @@ -0,0 +1,459 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetTargetPoolsInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final InstanceGroupManagersSetTargetPoolsRequest + instanceGroupManagersSetTargetPoolsRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SetTargetPoolsInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.instanceGroupManagersSetTargetPoolsRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SetTargetPoolsInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.instanceGroupManagersSetTargetPoolsRequestResource = + instanceGroupManagersSetTargetPoolsRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("instanceGroupManagersSetTargetPoolsRequestResource")) { + return instanceGroupManagersSetTargetPoolsRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstanceGroupManagersSetTargetPoolsRequest getApiMessageRequestBody() { + return instanceGroupManagersSetTargetPoolsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public InstanceGroupManagersSetTargetPoolsRequest + getInstanceGroupManagersSetTargetPoolsRequestResource() { + return instanceGroupManagersSetTargetPoolsRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetTargetPoolsInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetTargetPoolsInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetTargetPoolsInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetTargetPoolsInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private InstanceGroupManagersSetTargetPoolsRequest + instanceGroupManagersSetTargetPoolsRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetTargetPoolsInstanceGroupManagerHttpRequest other) { + if (other == SetTargetPoolsInstanceGroupManagerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getInstanceGroupManagersSetTargetPoolsRequestResource() != null) { + this.instanceGroupManagersSetTargetPoolsRequestResource = + other.instanceGroupManagersSetTargetPoolsRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetTargetPoolsInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.instanceGroupManagersSetTargetPoolsRequestResource = + source.instanceGroupManagersSetTargetPoolsRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public InstanceGroupManagersSetTargetPoolsRequest + getInstanceGroupManagersSetTargetPoolsRequestResource() { + return instanceGroupManagersSetTargetPoolsRequestResource; + } + + public Builder setInstanceGroupManagersSetTargetPoolsRequestResource( + InstanceGroupManagersSetTargetPoolsRequest + instanceGroupManagersSetTargetPoolsRequestResource) { + this.instanceGroupManagersSetTargetPoolsRequestResource = + instanceGroupManagersSetTargetPoolsRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetTargetPoolsInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetTargetPoolsInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + instanceGroupManagersSetTargetPoolsRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setInstanceGroupManagersSetTargetPoolsRequestResource( + this.instanceGroupManagersSetTargetPoolsRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetTargetPoolsInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "instanceGroupManagersSetTargetPoolsRequestResource=" + + instanceGroupManagersSetTargetPoolsRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetTargetPoolsInstanceGroupManagerHttpRequest) { + SetTargetPoolsInstanceGroupManagerHttpRequest that = + (SetTargetPoolsInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals( + this.instanceGroupManagersSetTargetPoolsRequestResource, + that.getInstanceGroupManagersSetTargetPoolsRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + instanceGroupManagersSetTargetPoolsRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetPoolsRegionInstanceGroupManagerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetPoolsRegionInstanceGroupManagerHttpRequest.java new file mode 100644 index 000000000000..b99e289db6b9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetTargetPoolsRegionInstanceGroupManagerHttpRequest.java @@ -0,0 +1,461 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetTargetPoolsRegionInstanceGroupManagerHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instanceGroupManager; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final RegionInstanceGroupManagersSetTargetPoolsRequest + regionInstanceGroupManagersSetTargetPoolsRequestResource; + private final String requestId; + private final String userIp; + + private SetTargetPoolsRegionInstanceGroupManagerHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instanceGroupManager = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.regionInstanceGroupManagersSetTargetPoolsRequestResource = null; + this.requestId = null; + this.userIp = null; + } + + private SetTargetPoolsRegionInstanceGroupManagerHttpRequest( + String access_token, + String callback, + String fields, + String instanceGroupManager, + String key, + String prettyPrint, + String quotaUser, + RegionInstanceGroupManagersSetTargetPoolsRequest + regionInstanceGroupManagersSetTargetPoolsRequestResource, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instanceGroupManager = instanceGroupManager; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.regionInstanceGroupManagersSetTargetPoolsRequestResource = + regionInstanceGroupManagersSetTargetPoolsRequestResource; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instanceGroupManager")) { + return instanceGroupManager; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("regionInstanceGroupManagersSetTargetPoolsRequestResource")) { + return regionInstanceGroupManagersSetTargetPoolsRequestResource; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public RegionInstanceGroupManagersSetTargetPoolsRequest getApiMessageRequestBody() { + return regionInstanceGroupManagersSetTargetPoolsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public RegionInstanceGroupManagersSetTargetPoolsRequest + getRegionInstanceGroupManagersSetTargetPoolsRequestResource() { + return regionInstanceGroupManagersSetTargetPoolsRequestResource; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetTargetPoolsRegionInstanceGroupManagerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetTargetPoolsRegionInstanceGroupManagerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetTargetPoolsRegionInstanceGroupManagerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetTargetPoolsRegionInstanceGroupManagerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instanceGroupManager; + private String key; + private String prettyPrint; + private String quotaUser; + private RegionInstanceGroupManagersSetTargetPoolsRequest + regionInstanceGroupManagersSetTargetPoolsRequestResource; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetTargetPoolsRegionInstanceGroupManagerHttpRequest other) { + if (other == SetTargetPoolsRegionInstanceGroupManagerHttpRequest.getDefaultInstance()) + return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstanceGroupManager() != null) { + this.instanceGroupManager = other.instanceGroupManager; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegionInstanceGroupManagersSetTargetPoolsRequestResource() != null) { + this.regionInstanceGroupManagersSetTargetPoolsRequestResource = + other.regionInstanceGroupManagersSetTargetPoolsRequestResource; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetTargetPoolsRegionInstanceGroupManagerHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instanceGroupManager = source.instanceGroupManager; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.regionInstanceGroupManagersSetTargetPoolsRequestResource = + source.regionInstanceGroupManagersSetTargetPoolsRequestResource; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstanceGroupManager() { + return instanceGroupManager; + } + + public Builder setInstanceGroupManager(String instanceGroupManager) { + this.instanceGroupManager = instanceGroupManager; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public RegionInstanceGroupManagersSetTargetPoolsRequest + getRegionInstanceGroupManagersSetTargetPoolsRequestResource() { + return regionInstanceGroupManagersSetTargetPoolsRequestResource; + } + + public Builder setRegionInstanceGroupManagersSetTargetPoolsRequestResource( + RegionInstanceGroupManagersSetTargetPoolsRequest + regionInstanceGroupManagersSetTargetPoolsRequestResource) { + this.regionInstanceGroupManagersSetTargetPoolsRequestResource = + regionInstanceGroupManagersSetTargetPoolsRequestResource; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetTargetPoolsRegionInstanceGroupManagerHttpRequest build() { + String missing = ""; + + if (instanceGroupManager == null) { + missing += " instanceGroupManager"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetTargetPoolsRegionInstanceGroupManagerHttpRequest( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + regionInstanceGroupManagersSetTargetPoolsRequestResource, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstanceGroupManager(this.instanceGroupManager); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegionInstanceGroupManagersSetTargetPoolsRequestResource( + this.regionInstanceGroupManagersSetTargetPoolsRequestResource); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetTargetPoolsRegionInstanceGroupManagerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instanceGroupManager=" + + instanceGroupManager + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "regionInstanceGroupManagersSetTargetPoolsRequestResource=" + + regionInstanceGroupManagersSetTargetPoolsRequestResource + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetTargetPoolsRegionInstanceGroupManagerHttpRequest) { + SetTargetPoolsRegionInstanceGroupManagerHttpRequest that = + (SetTargetPoolsRegionInstanceGroupManagerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instanceGroupManager, that.getInstanceGroupManager()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals( + this.regionInstanceGroupManagersSetTargetPoolsRequestResource, + that.getRegionInstanceGroupManagersSetTargetPoolsRequestResource()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instanceGroupManager, + key, + prettyPrint, + quotaUser, + regionInstanceGroupManagersSetTargetPoolsRequestResource, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetUrlMapTargetHttpProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetUrlMapTargetHttpProxyHttpRequest.java new file mode 100644 index 000000000000..fc43374f5e9f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetUrlMapTargetHttpProxyHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetUrlMapTargetHttpProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetHttpProxy; + private final UrlMapReference urlMapReferenceResource; + private final String userIp; + + private SetUrlMapTargetHttpProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetHttpProxy = null; + this.urlMapReferenceResource = null; + this.userIp = null; + } + + private SetUrlMapTargetHttpProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetHttpProxy, + UrlMapReference urlMapReferenceResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetHttpProxy = targetHttpProxy; + this.urlMapReferenceResource = urlMapReferenceResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetHttpProxy")) { + return targetHttpProxy; + } + if (fieldName.equals("urlMapReferenceResource")) { + return urlMapReferenceResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public UrlMapReference getApiMessageRequestBody() { + return urlMapReferenceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetHttpProxy() { + return targetHttpProxy; + } + + public UrlMapReference getUrlMapReferenceResource() { + return urlMapReferenceResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetUrlMapTargetHttpProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetUrlMapTargetHttpProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetUrlMapTargetHttpProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetUrlMapTargetHttpProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetHttpProxy; + private UrlMapReference urlMapReferenceResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetUrlMapTargetHttpProxyHttpRequest other) { + if (other == SetUrlMapTargetHttpProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetHttpProxy() != null) { + this.targetHttpProxy = other.targetHttpProxy; + } + if (other.getUrlMapReferenceResource() != null) { + this.urlMapReferenceResource = other.urlMapReferenceResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetUrlMapTargetHttpProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetHttpProxy = source.targetHttpProxy; + this.urlMapReferenceResource = source.urlMapReferenceResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetHttpProxy() { + return targetHttpProxy; + } + + public Builder setTargetHttpProxy(String targetHttpProxy) { + this.targetHttpProxy = targetHttpProxy; + return this; + } + + public UrlMapReference getUrlMapReferenceResource() { + return urlMapReferenceResource; + } + + public Builder setUrlMapReferenceResource(UrlMapReference urlMapReferenceResource) { + this.urlMapReferenceResource = urlMapReferenceResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetUrlMapTargetHttpProxyHttpRequest build() { + String missing = ""; + + if (targetHttpProxy == null) { + missing += " targetHttpProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetUrlMapTargetHttpProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetHttpProxy, + urlMapReferenceResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetHttpProxy(this.targetHttpProxy); + newBuilder.setUrlMapReferenceResource(this.urlMapReferenceResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetUrlMapTargetHttpProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetHttpProxy=" + + targetHttpProxy + + ", " + + "urlMapReferenceResource=" + + urlMapReferenceResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetUrlMapTargetHttpProxyHttpRequest) { + SetUrlMapTargetHttpProxyHttpRequest that = (SetUrlMapTargetHttpProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetHttpProxy, that.getTargetHttpProxy()) + && Objects.equals(this.urlMapReferenceResource, that.getUrlMapReferenceResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetHttpProxy, + urlMapReferenceResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetUrlMapTargetHttpsProxyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetUrlMapTargetHttpsProxyHttpRequest.java new file mode 100644 index 000000000000..c886f963980f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetUrlMapTargetHttpsProxyHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetUrlMapTargetHttpsProxyHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String targetHttpsProxy; + private final UrlMapReference urlMapReferenceResource; + private final String userIp; + + private SetUrlMapTargetHttpsProxyHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.targetHttpsProxy = null; + this.urlMapReferenceResource = null; + this.userIp = null; + } + + private SetUrlMapTargetHttpsProxyHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String targetHttpsProxy, + UrlMapReference urlMapReferenceResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.targetHttpsProxy = targetHttpsProxy; + this.urlMapReferenceResource = urlMapReferenceResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("targetHttpsProxy")) { + return targetHttpsProxy; + } + if (fieldName.equals("urlMapReferenceResource")) { + return urlMapReferenceResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public UrlMapReference getApiMessageRequestBody() { + return urlMapReferenceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public UrlMapReference getUrlMapReferenceResource() { + return urlMapReferenceResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetUrlMapTargetHttpsProxyHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetUrlMapTargetHttpsProxyHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetUrlMapTargetHttpsProxyHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetUrlMapTargetHttpsProxyHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String targetHttpsProxy; + private UrlMapReference urlMapReferenceResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetUrlMapTargetHttpsProxyHttpRequest other) { + if (other == SetUrlMapTargetHttpsProxyHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getTargetHttpsProxy() != null) { + this.targetHttpsProxy = other.targetHttpsProxy; + } + if (other.getUrlMapReferenceResource() != null) { + this.urlMapReferenceResource = other.urlMapReferenceResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetUrlMapTargetHttpsProxyHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.targetHttpsProxy = source.targetHttpsProxy; + this.urlMapReferenceResource = source.urlMapReferenceResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getTargetHttpsProxy() { + return targetHttpsProxy; + } + + public Builder setTargetHttpsProxy(String targetHttpsProxy) { + this.targetHttpsProxy = targetHttpsProxy; + return this; + } + + public UrlMapReference getUrlMapReferenceResource() { + return urlMapReferenceResource; + } + + public Builder setUrlMapReferenceResource(UrlMapReference urlMapReferenceResource) { + this.urlMapReferenceResource = urlMapReferenceResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetUrlMapTargetHttpsProxyHttpRequest build() { + String missing = ""; + + if (targetHttpsProxy == null) { + missing += " targetHttpsProxy"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetUrlMapTargetHttpsProxyHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetHttpsProxy, + urlMapReferenceResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setTargetHttpsProxy(this.targetHttpsProxy); + newBuilder.setUrlMapReferenceResource(this.urlMapReferenceResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetUrlMapTargetHttpsProxyHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "targetHttpsProxy=" + + targetHttpsProxy + + ", " + + "urlMapReferenceResource=" + + urlMapReferenceResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetUrlMapTargetHttpsProxyHttpRequest) { + SetUrlMapTargetHttpsProxyHttpRequest that = (SetUrlMapTargetHttpsProxyHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.targetHttpsProxy, that.getTargetHttpsProxy()) + && Objects.equals(this.urlMapReferenceResource, that.getUrlMapReferenceResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + requestId, + targetHttpsProxy, + urlMapReferenceResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetUsageExportBucketProjectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetUsageExportBucketProjectHttpRequest.java new file mode 100644 index 000000000000..4190be522ba5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SetUsageExportBucketProjectHttpRequest.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SetUsageExportBucketProjectHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String project; + private final String quotaUser; + private final String requestId; + private final UsageExportLocation usageExportLocationResource; + private final String userIp; + + private SetUsageExportBucketProjectHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.project = null; + this.quotaUser = null; + this.requestId = null; + this.usageExportLocationResource = null; + this.userIp = null; + } + + private SetUsageExportBucketProjectHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String project, + String quotaUser, + String requestId, + UsageExportLocation usageExportLocationResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.project = project; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.usageExportLocationResource = usageExportLocationResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("project")) { + return project; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("usageExportLocationResource")) { + return usageExportLocationResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public UsageExportLocation getApiMessageRequestBody() { + return usageExportLocationResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getProject() { + return project; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public UsageExportLocation getUsageExportLocationResource() { + return usageExportLocationResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SetUsageExportBucketProjectHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SetUsageExportBucketProjectHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SetUsageExportBucketProjectHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SetUsageExportBucketProjectHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String project; + private String quotaUser; + private String requestId; + private UsageExportLocation usageExportLocationResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SetUsageExportBucketProjectHttpRequest other) { + if (other == SetUsageExportBucketProjectHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getProject() != null) { + this.project = other.project; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUsageExportLocationResource() != null) { + this.usageExportLocationResource = other.usageExportLocationResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SetUsageExportBucketProjectHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.project = source.project; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.usageExportLocationResource = source.usageExportLocationResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public UsageExportLocation getUsageExportLocationResource() { + return usageExportLocationResource; + } + + public Builder setUsageExportLocationResource(UsageExportLocation usageExportLocationResource) { + this.usageExportLocationResource = usageExportLocationResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SetUsageExportBucketProjectHttpRequest build() { + String missing = ""; + + if (project == null) { + missing += " project"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SetUsageExportBucketProjectHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + usageExportLocationResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setProject(this.project); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUsageExportLocationResource(this.usageExportLocationResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SetUsageExportBucketProjectHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "project=" + + project + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "usageExportLocationResource=" + + usageExportLocationResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SetUsageExportBucketProjectHttpRequest) { + SetUsageExportBucketProjectHttpRequest that = (SetUsageExportBucketProjectHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.project, that.getProject()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.usageExportLocationResource, that.getUsageExportLocationResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + project, + quotaUser, + requestId, + usageExportLocationResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Snapshot.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Snapshot.java new file mode 100644 index 000000000000..4be6f4617e06 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Snapshot.java @@ -0,0 +1,711 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Snapshot implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String diskSizeGb; + private final String id; + private final String kind; + private final String labelFingerprint; + private final Map labels; + private final List licenseCodes; + private final List licenses; + private final String name; + private final String selfLink; + private final CustomerEncryptionKey snapshotEncryptionKey; + private final String sourceDisk; + private final CustomerEncryptionKey sourceDiskEncryptionKey; + private final String sourceDiskId; + private final String status; + private final String storageBytes; + private final String storageBytesStatus; + + private Snapshot() { + this.creationTimestamp = null; + this.description = null; + this.diskSizeGb = null; + this.id = null; + this.kind = null; + this.labelFingerprint = null; + this.labels = null; + this.licenseCodes = null; + this.licenses = null; + this.name = null; + this.selfLink = null; + this.snapshotEncryptionKey = null; + this.sourceDisk = null; + this.sourceDiskEncryptionKey = null; + this.sourceDiskId = null; + this.status = null; + this.storageBytes = null; + this.storageBytesStatus = null; + } + + private Snapshot( + String creationTimestamp, + String description, + String diskSizeGb, + String id, + String kind, + String labelFingerprint, + Map labels, + List licenseCodes, + List licenses, + String name, + String selfLink, + CustomerEncryptionKey snapshotEncryptionKey, + String sourceDisk, + CustomerEncryptionKey sourceDiskEncryptionKey, + String sourceDiskId, + String status, + String storageBytes, + String storageBytesStatus) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.diskSizeGb = diskSizeGb; + this.id = id; + this.kind = kind; + this.labelFingerprint = labelFingerprint; + this.labels = labels; + this.licenseCodes = licenseCodes; + this.licenses = licenses; + this.name = name; + this.selfLink = selfLink; + this.snapshotEncryptionKey = snapshotEncryptionKey; + this.sourceDisk = sourceDisk; + this.sourceDiskEncryptionKey = sourceDiskEncryptionKey; + this.sourceDiskId = sourceDiskId; + this.status = status; + this.storageBytes = storageBytes; + this.storageBytesStatus = storageBytesStatus; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("diskSizeGb")) { + return diskSizeGb; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("labelFingerprint")) { + return labelFingerprint; + } + if (fieldName.equals("labels")) { + return labels; + } + if (fieldName.equals("licenseCodes")) { + return licenseCodes; + } + if (fieldName.equals("licenses")) { + return licenses; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("snapshotEncryptionKey")) { + return snapshotEncryptionKey; + } + if (fieldName.equals("sourceDisk")) { + return sourceDisk; + } + if (fieldName.equals("sourceDiskEncryptionKey")) { + return sourceDiskEncryptionKey; + } + if (fieldName.equals("sourceDiskId")) { + return sourceDiskId; + } + if (fieldName.equals("status")) { + return status; + } + if (fieldName.equals("storageBytes")) { + return storageBytes; + } + if (fieldName.equals("storageBytesStatus")) { + return storageBytesStatus; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getDiskSizeGb() { + return diskSizeGb; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Map getLabelsMap() { + return labels; + } + + public List getLicenseCodesList() { + return licenseCodes; + } + + public List getLicensesList() { + return licenses; + } + + public String getName() { + return name; + } + + public String getSelfLink() { + return selfLink; + } + + public CustomerEncryptionKey getSnapshotEncryptionKey() { + return snapshotEncryptionKey; + } + + public String getSourceDisk() { + return sourceDisk; + } + + public CustomerEncryptionKey getSourceDiskEncryptionKey() { + return sourceDiskEncryptionKey; + } + + public String getSourceDiskId() { + return sourceDiskId; + } + + public String getStatus() { + return status; + } + + public String getStorageBytes() { + return storageBytes; + } + + public String getStorageBytesStatus() { + return storageBytesStatus; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Snapshot prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Snapshot getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Snapshot DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Snapshot(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String diskSizeGb; + private String id; + private String kind; + private String labelFingerprint; + private Map labels; + private List licenseCodes; + private List licenses; + private String name; + private String selfLink; + private CustomerEncryptionKey snapshotEncryptionKey; + private String sourceDisk; + private CustomerEncryptionKey sourceDiskEncryptionKey; + private String sourceDiskId; + private String status; + private String storageBytes; + private String storageBytesStatus; + + Builder() {} + + public Builder mergeFrom(Snapshot other) { + if (other == Snapshot.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getDiskSizeGb() != null) { + this.diskSizeGb = other.diskSizeGb; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getLabelFingerprint() != null) { + this.labelFingerprint = other.labelFingerprint; + } + if (other.getLabelsMap() != null) { + this.labels = other.labels; + } + if (other.getLicenseCodesList() != null) { + this.licenseCodes = other.licenseCodes; + } + if (other.getLicensesList() != null) { + this.licenses = other.licenses; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSnapshotEncryptionKey() != null) { + this.snapshotEncryptionKey = other.snapshotEncryptionKey; + } + if (other.getSourceDisk() != null) { + this.sourceDisk = other.sourceDisk; + } + if (other.getSourceDiskEncryptionKey() != null) { + this.sourceDiskEncryptionKey = other.sourceDiskEncryptionKey; + } + if (other.getSourceDiskId() != null) { + this.sourceDiskId = other.sourceDiskId; + } + if (other.getStatus() != null) { + this.status = other.status; + } + if (other.getStorageBytes() != null) { + this.storageBytes = other.storageBytes; + } + if (other.getStorageBytesStatus() != null) { + this.storageBytesStatus = other.storageBytesStatus; + } + return this; + } + + Builder(Snapshot source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.diskSizeGb = source.diskSizeGb; + this.id = source.id; + this.kind = source.kind; + this.labelFingerprint = source.labelFingerprint; + this.labels = source.labels; + this.licenseCodes = source.licenseCodes; + this.licenses = source.licenses; + this.name = source.name; + this.selfLink = source.selfLink; + this.snapshotEncryptionKey = source.snapshotEncryptionKey; + this.sourceDisk = source.sourceDisk; + this.sourceDiskEncryptionKey = source.sourceDiskEncryptionKey; + this.sourceDiskId = source.sourceDiskId; + this.status = source.status; + this.storageBytes = source.storageBytes; + this.storageBytesStatus = source.storageBytesStatus; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getDiskSizeGb() { + return diskSizeGb; + } + + public Builder setDiskSizeGb(String diskSizeGb) { + this.diskSizeGb = diskSizeGb; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Builder setLabelFingerprint(String labelFingerprint) { + this.labelFingerprint = labelFingerprint; + return this; + } + + public Map getLabelsMap() { + return labels; + } + + public Builder putAllLabels(Map labels) { + this.labels = labels; + return this; + } + + public List getLicenseCodesList() { + return licenseCodes; + } + + public Builder addAllLicenseCodes(List licenseCodes) { + if (this.licenseCodes == null) { + this.licenseCodes = new ArrayList<>(licenseCodes.size()); + } + this.licenseCodes.addAll(licenseCodes); + return this; + } + + public Builder addLicenseCodes(String licenseCodes) { + this.licenseCodes.add(licenseCodes); + return this; + } + + public List getLicensesList() { + return licenses; + } + + public Builder addAllLicenses(List licenses) { + if (this.licenses == null) { + this.licenses = new ArrayList<>(licenses.size()); + } + this.licenses.addAll(licenses); + return this; + } + + public Builder addLicenses(String licenses) { + this.licenses.add(licenses); + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public CustomerEncryptionKey getSnapshotEncryptionKey() { + return snapshotEncryptionKey; + } + + public Builder setSnapshotEncryptionKey(CustomerEncryptionKey snapshotEncryptionKey) { + this.snapshotEncryptionKey = snapshotEncryptionKey; + return this; + } + + public String getSourceDisk() { + return sourceDisk; + } + + public Builder setSourceDisk(String sourceDisk) { + this.sourceDisk = sourceDisk; + return this; + } + + public CustomerEncryptionKey getSourceDiskEncryptionKey() { + return sourceDiskEncryptionKey; + } + + public Builder setSourceDiskEncryptionKey(CustomerEncryptionKey sourceDiskEncryptionKey) { + this.sourceDiskEncryptionKey = sourceDiskEncryptionKey; + return this; + } + + public String getSourceDiskId() { + return sourceDiskId; + } + + public Builder setSourceDiskId(String sourceDiskId) { + this.sourceDiskId = sourceDiskId; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public String getStorageBytes() { + return storageBytes; + } + + public Builder setStorageBytes(String storageBytes) { + this.storageBytes = storageBytes; + return this; + } + + public String getStorageBytesStatus() { + return storageBytesStatus; + } + + public Builder setStorageBytesStatus(String storageBytesStatus) { + this.storageBytesStatus = storageBytesStatus; + return this; + } + + public Snapshot build() { + + return new Snapshot( + creationTimestamp, + description, + diskSizeGb, + id, + kind, + labelFingerprint, + labels, + licenseCodes, + licenses, + name, + selfLink, + snapshotEncryptionKey, + sourceDisk, + sourceDiskEncryptionKey, + sourceDiskId, + status, + storageBytes, + storageBytesStatus); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setDiskSizeGb(this.diskSizeGb); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setLabelFingerprint(this.labelFingerprint); + newBuilder.putAllLabels(this.labels); + newBuilder.addAllLicenseCodes(this.licenseCodes); + newBuilder.addAllLicenses(this.licenses); + newBuilder.setName(this.name); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setSnapshotEncryptionKey(this.snapshotEncryptionKey); + newBuilder.setSourceDisk(this.sourceDisk); + newBuilder.setSourceDiskEncryptionKey(this.sourceDiskEncryptionKey); + newBuilder.setSourceDiskId(this.sourceDiskId); + newBuilder.setStatus(this.status); + newBuilder.setStorageBytes(this.storageBytes); + newBuilder.setStorageBytesStatus(this.storageBytesStatus); + return newBuilder; + } + } + + @Override + public String toString() { + return "Snapshot{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "diskSizeGb=" + + diskSizeGb + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "labelFingerprint=" + + labelFingerprint + + ", " + + "labels=" + + labels + + ", " + + "licenseCodes=" + + licenseCodes + + ", " + + "licenses=" + + licenses + + ", " + + "name=" + + name + + ", " + + "selfLink=" + + selfLink + + ", " + + "snapshotEncryptionKey=" + + snapshotEncryptionKey + + ", " + + "sourceDisk=" + + sourceDisk + + ", " + + "sourceDiskEncryptionKey=" + + sourceDiskEncryptionKey + + ", " + + "sourceDiskId=" + + sourceDiskId + + ", " + + "status=" + + status + + ", " + + "storageBytes=" + + storageBytes + + ", " + + "storageBytesStatus=" + + storageBytesStatus + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Snapshot) { + Snapshot that = (Snapshot) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.diskSizeGb, that.getDiskSizeGb()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.labelFingerprint, that.getLabelFingerprint()) + && Objects.equals(this.labels, that.getLabelsMap()) + && Objects.equals(this.licenseCodes, that.getLicenseCodesList()) + && Objects.equals(this.licenses, that.getLicensesList()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.snapshotEncryptionKey, that.getSnapshotEncryptionKey()) + && Objects.equals(this.sourceDisk, that.getSourceDisk()) + && Objects.equals(this.sourceDiskEncryptionKey, that.getSourceDiskEncryptionKey()) + && Objects.equals(this.sourceDiskId, that.getSourceDiskId()) + && Objects.equals(this.status, that.getStatus()) + && Objects.equals(this.storageBytes, that.getStorageBytes()) + && Objects.equals(this.storageBytesStatus, that.getStorageBytesStatus()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + description, + diskSizeGb, + id, + kind, + labelFingerprint, + labels, + licenseCodes, + licenses, + name, + selfLink, + snapshotEncryptionKey, + sourceDisk, + sourceDiskEncryptionKey, + sourceDiskId, + status, + storageBytes, + storageBytesStatus); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SnapshotClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SnapshotClient.java new file mode 100644 index 000000000000..d9df2eb33fd3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SnapshotClient.java @@ -0,0 +1,725 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.SnapshotStub; +import com.google.cloud.compute.v1.stub.SnapshotStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+ *   ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+ *   Operation response = snapshotClient.deleteSnapshot(snapshot);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the snapshotClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of SnapshotSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * SnapshotSettings snapshotSettings =
+ *     SnapshotSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * SnapshotClient snapshotClient =
+ *     SnapshotClient.create(snapshotSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * SnapshotSettings snapshotSettings =
+ *     SnapshotSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * SnapshotClient snapshotClient =
+ *     SnapshotClient.create(snapshotSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SnapshotClient implements BackgroundResource { + private final SnapshotSettings settings; + private final SnapshotStub stub; + + /** Constructs an instance of SnapshotClient with default settings. */ + public static final SnapshotClient create() throws IOException { + return create(SnapshotSettings.newBuilder().build()); + } + + /** + * Constructs an instance of SnapshotClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final SnapshotClient create(SnapshotSettings settings) throws IOException { + return new SnapshotClient(settings); + } + + /** + * Constructs an instance of SnapshotClient, using the given stub for making calls. This is for + * advanced usage - prefer to use SnapshotSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final SnapshotClient create(SnapshotStub stub) { + return new SnapshotClient(stub); + } + + /** + * Constructs an instance of SnapshotClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected SnapshotClient(SnapshotSettings settings) throws IOException { + this.settings = settings; + this.stub = ((SnapshotStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected SnapshotClient(SnapshotStub stub) { + this.settings = null; + this.stub = stub; + } + + public final SnapshotSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public SnapshotStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not + * necessarily delete all the data on that snapshot. If any data on the snapshot that is marked + * for deletion is needed for subsequent snapshots, the data will be moved to the next + * corresponding snapshot. + * + *

For more information, see Deleting snaphots. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   Operation response = snapshotClient.deleteSnapshot(snapshot);
+   * }
+   * 
+ * + * @param snapshot Name of the Snapshot resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSnapshot(ProjectGlobalSnapshotName snapshot) { + + DeleteSnapshotHttpRequest request = + DeleteSnapshotHttpRequest.newBuilder() + .setSnapshot(snapshot == null ? null : snapshot.toString()) + .build(); + return deleteSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not + * necessarily delete all the data on that snapshot. If any data on the snapshot that is marked + * for deletion is needed for subsequent snapshots, the data will be moved to the next + * corresponding snapshot. + * + *

For more information, see Deleting snaphots. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   Operation response = snapshotClient.deleteSnapshot(snapshot.toString());
+   * }
+   * 
+ * + * @param snapshot Name of the Snapshot resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSnapshot(String snapshot) { + + DeleteSnapshotHttpRequest request = + DeleteSnapshotHttpRequest.newBuilder().setSnapshot(snapshot).build(); + return deleteSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not + * necessarily delete all the data on that snapshot. If any data on the snapshot that is marked + * for deletion is needed for subsequent snapshots, the data will be moved to the next + * corresponding snapshot. + * + *

For more information, see Deleting snaphots. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   DeleteSnapshotHttpRequest request = DeleteSnapshotHttpRequest.newBuilder()
+   *     .setSnapshot(snapshot.toString())
+   *     .build();
+   *   Operation response = snapshotClient.deleteSnapshot(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSnapshot(DeleteSnapshotHttpRequest request) { + return deleteSnapshotCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not + * necessarily delete all the data on that snapshot. If any data on the snapshot that is marked + * for deletion is needed for subsequent snapshots, the data will be moved to the next + * corresponding snapshot. + * + *

For more information, see Deleting snaphots. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   DeleteSnapshotHttpRequest request = DeleteSnapshotHttpRequest.newBuilder()
+   *     .setSnapshot(snapshot.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = snapshotClient.deleteSnapshotCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteSnapshotCallable() { + return stub.deleteSnapshotCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Snapshot resource. Gets a list of available snapshots by making a list() + * request. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   Snapshot response = snapshotClient.getSnapshot(snapshot);
+   * }
+   * 
+ * + * @param snapshot Name of the Snapshot resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Snapshot getSnapshot(ProjectGlobalSnapshotName snapshot) { + + GetSnapshotHttpRequest request = + GetSnapshotHttpRequest.newBuilder() + .setSnapshot(snapshot == null ? null : snapshot.toString()) + .build(); + return getSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Snapshot resource. Gets a list of available snapshots by making a list() + * request. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   Snapshot response = snapshotClient.getSnapshot(snapshot.toString());
+   * }
+   * 
+ * + * @param snapshot Name of the Snapshot resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Snapshot getSnapshot(String snapshot) { + + GetSnapshotHttpRequest request = + GetSnapshotHttpRequest.newBuilder().setSnapshot(snapshot).build(); + return getSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Snapshot resource. Gets a list of available snapshots by making a list() + * request. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   GetSnapshotHttpRequest request = GetSnapshotHttpRequest.newBuilder()
+   *     .setSnapshot(snapshot.toString())
+   *     .build();
+   *   Snapshot response = snapshotClient.getSnapshot(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Snapshot getSnapshot(GetSnapshotHttpRequest request) { + return getSnapshotCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Snapshot resource. Gets a list of available snapshots by making a list() + * request. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   GetSnapshotHttpRequest request = GetSnapshotHttpRequest.newBuilder()
+   *     .setSnapshot(snapshot.toString())
+   *     .build();
+   *   ApiFuture<Snapshot> future = snapshotClient.getSnapshotCallable().futureCall(request);
+   *   // Do something
+   *   Snapshot response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getSnapshotCallable() { + return stub.getSnapshotCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Snapshot resources contained within the specified project. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Snapshot element : snapshotClient.listSnapshots(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSnapshotsPagedResponse listSnapshots(ProjectName project) { + ListSnapshotsHttpRequest request = + ListSnapshotsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listSnapshots(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Snapshot resources contained within the specified project. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Snapshot element : snapshotClient.listSnapshots(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSnapshotsPagedResponse listSnapshots(String project) { + ListSnapshotsHttpRequest request = + ListSnapshotsHttpRequest.newBuilder().setProject(project).build(); + return listSnapshots(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Snapshot resources contained within the specified project. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListSnapshotsHttpRequest request = ListSnapshotsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (Snapshot element : snapshotClient.listSnapshots(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsHttpRequest request) { + return listSnapshotsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Snapshot resources contained within the specified project. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListSnapshotsHttpRequest request = ListSnapshotsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListSnapshotsPagedResponse> future = snapshotClient.listSnapshotsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Snapshot element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listSnapshotsPagedCallable() { + return stub.listSnapshotsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Snapshot resources contained within the specified project. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListSnapshotsHttpRequest request = ListSnapshotsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     SnapshotList response = snapshotClient.listSnapshotsCallable().call(request);
+   *     for (Snapshot element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listSnapshotsCallable() { + return stub.listSnapshotsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on a snapshot. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotResourceName resource = ProjectGlobalSnapshotResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
+   *   Operation response = snapshotClient.setLabelsSnapshot(resource, globalSetLabelsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param globalSetLabelsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsSnapshot( + ProjectGlobalSnapshotResourceName resource, + GlobalSetLabelsRequest globalSetLabelsRequestResource) { + + SetLabelsSnapshotHttpRequest request = + SetLabelsSnapshotHttpRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setGlobalSetLabelsRequestResource(globalSetLabelsRequestResource) + .build(); + return setLabelsSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on a snapshot. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotResourceName resource = ProjectGlobalSnapshotResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
+   *   Operation response = snapshotClient.setLabelsSnapshot(resource.toString(), globalSetLabelsRequestResource);
+   * }
+   * 
+ * + * @param resource Name of the resource for this request. + * @param globalSetLabelsRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsSnapshot( + String resource, GlobalSetLabelsRequest globalSetLabelsRequestResource) { + + SetLabelsSnapshotHttpRequest request = + SetLabelsSnapshotHttpRequest.newBuilder() + .setResource(resource) + .setGlobalSetLabelsRequestResource(globalSetLabelsRequestResource) + .build(); + return setLabelsSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on a snapshot. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotResourceName resource = ProjectGlobalSnapshotResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
+   *   SetLabelsSnapshotHttpRequest request = SetLabelsSnapshotHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setGlobalSetLabelsRequestResource(globalSetLabelsRequestResource)
+   *     .build();
+   *   Operation response = snapshotClient.setLabelsSnapshot(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setLabelsSnapshot(SetLabelsSnapshotHttpRequest request) { + return setLabelsSnapshotCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the labels on a snapshot. To learn more about labels, read the Labeling Resources + * documentation. + * + *

Sample code: + * + *


+   * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+   *   ProjectGlobalSnapshotResourceName resource = ProjectGlobalSnapshotResourceName.of("[PROJECT]", "[RESOURCE]");
+   *   GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
+   *   SetLabelsSnapshotHttpRequest request = SetLabelsSnapshotHttpRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setGlobalSetLabelsRequestResource(globalSetLabelsRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = snapshotClient.setLabelsSnapshotCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable setLabelsSnapshotCallable() { + return stub.setLabelsSnapshotCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListSnapshotsPagedResponse + extends AbstractPagedListResponse< + ListSnapshotsHttpRequest, SnapshotList, Snapshot, ListSnapshotsPage, + ListSnapshotsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListSnapshotsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListSnapshotsPagedResponse apply(ListSnapshotsPage input) { + return new ListSnapshotsPagedResponse(input); + } + }); + } + + private ListSnapshotsPagedResponse(ListSnapshotsPage page) { + super(page, ListSnapshotsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListSnapshotsPage + extends AbstractPage { + + private ListSnapshotsPage( + PageContext context, + SnapshotList response) { + super(context, response); + } + + private static ListSnapshotsPage createEmptyPage() { + return new ListSnapshotsPage(null, null); + } + + @Override + protected ListSnapshotsPage createPage( + PageContext context, + SnapshotList response) { + return new ListSnapshotsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListSnapshotsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListSnapshotsHttpRequest, SnapshotList, Snapshot, ListSnapshotsPage, + ListSnapshotsFixedSizeCollection> { + + private ListSnapshotsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListSnapshotsFixedSizeCollection createEmptyCollection() { + return new ListSnapshotsFixedSizeCollection(null, 0); + } + + @Override + protected ListSnapshotsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListSnapshotsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SnapshotList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SnapshotList.java new file mode 100644 index 000000000000..f1f7ce3efa18 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SnapshotList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SnapshotList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private SnapshotList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private SnapshotList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SnapshotList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SnapshotList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SnapshotList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SnapshotList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(SnapshotList other) { + if (other == SnapshotList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(SnapshotList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Snapshot items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public SnapshotList build() { + + return new SnapshotList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "SnapshotList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SnapshotList) { + SnapshotList that = (SnapshotList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SnapshotSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SnapshotSettings.java new file mode 100644 index 000000000000..a34412a40b85 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SnapshotSettings.java @@ -0,0 +1,217 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.SnapshotClient.ListSnapshotsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.SnapshotStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link SnapshotClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteSnapshot to 30 seconds: + * + *

+ * 
+ * SnapshotSettings.Builder snapshotSettingsBuilder =
+ *     SnapshotSettings.newBuilder();
+ * snapshotSettingsBuilder.deleteSnapshotSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * SnapshotSettings snapshotSettings = snapshotSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SnapshotSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteSnapshot. */ + public UnaryCallSettings deleteSnapshotSettings() { + return ((SnapshotStubSettings) getStubSettings()).deleteSnapshotSettings(); + } + + /** Returns the object with the settings used for calls to getSnapshot. */ + public UnaryCallSettings getSnapshotSettings() { + return ((SnapshotStubSettings) getStubSettings()).getSnapshotSettings(); + } + + /** Returns the object with the settings used for calls to listSnapshots. */ + public PagedCallSettings + listSnapshotsSettings() { + return ((SnapshotStubSettings) getStubSettings()).listSnapshotsSettings(); + } + + /** Returns the object with the settings used for calls to setLabelsSnapshot. */ + public UnaryCallSettings setLabelsSnapshotSettings() { + return ((SnapshotStubSettings) getStubSettings()).setLabelsSnapshotSettings(); + } + + public static final SnapshotSettings create(SnapshotStubSettings stub) throws IOException { + return new SnapshotSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return SnapshotStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return SnapshotStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return SnapshotStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return SnapshotStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return SnapshotStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return SnapshotStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return SnapshotStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SnapshotStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SnapshotSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for SnapshotSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(SnapshotStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(SnapshotStubSettings.newBuilder()); + } + + protected Builder(SnapshotSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(SnapshotStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public SnapshotStubSettings.Builder getStubSettingsBuilder() { + return ((SnapshotStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteSnapshot. */ + public UnaryCallSettings.Builder + deleteSnapshotSettings() { + return getStubSettingsBuilder().deleteSnapshotSettings(); + } + + /** Returns the builder for the settings used for calls to getSnapshot. */ + public UnaryCallSettings.Builder getSnapshotSettings() { + return getStubSettingsBuilder().getSnapshotSettings(); + } + + /** Returns the builder for the settings used for calls to listSnapshots. */ + public PagedCallSettings.Builder< + ListSnapshotsHttpRequest, SnapshotList, ListSnapshotsPagedResponse> + listSnapshotsSettings() { + return getStubSettingsBuilder().listSnapshotsSettings(); + } + + /** Returns the builder for the settings used for calls to setLabelsSnapshot. */ + public UnaryCallSettings.Builder + setLabelsSnapshotSettings() { + return getStubSettingsBuilder().setLabelsSnapshotSettings(); + } + + @Override + public SnapshotSettings build() throws IOException { + return new SnapshotSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificate.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificate.java new file mode 100644 index 000000000000..3894f3103963 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificate.java @@ -0,0 +1,359 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SslCertificate implements ApiMessage { + private final String certificate; + private final String creationTimestamp; + private final String description; + private final String id; + private final String kind; + private final String name; + private final String privateKey; + private final String selfLink; + + private SslCertificate() { + this.certificate = null; + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.kind = null; + this.name = null; + this.privateKey = null; + this.selfLink = null; + } + + private SslCertificate( + String certificate, + String creationTimestamp, + String description, + String id, + String kind, + String name, + String privateKey, + String selfLink) { + this.certificate = certificate; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.kind = kind; + this.name = name; + this.privateKey = privateKey; + this.selfLink = selfLink; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("certificate")) { + return certificate; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("privateKey")) { + return privateKey; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCertificate() { + return certificate; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getPrivateKey() { + return privateKey; + } + + public String getSelfLink() { + return selfLink; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SslCertificate prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SslCertificate getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SslCertificate DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SslCertificate(); + } + + public static class Builder { + private String certificate; + private String creationTimestamp; + private String description; + private String id; + private String kind; + private String name; + private String privateKey; + private String selfLink; + + Builder() {} + + public Builder mergeFrom(SslCertificate other) { + if (other == SslCertificate.getDefaultInstance()) return this; + if (other.getCertificate() != null) { + this.certificate = other.certificate; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPrivateKey() != null) { + this.privateKey = other.privateKey; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + return this; + } + + Builder(SslCertificate source) { + this.certificate = source.certificate; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.privateKey = source.privateKey; + this.selfLink = source.selfLink; + } + + public String getCertificate() { + return certificate; + } + + public Builder setCertificate(String certificate) { + this.certificate = certificate; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getPrivateKey() { + return privateKey; + } + + public Builder setPrivateKey(String privateKey) { + this.privateKey = privateKey; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public SslCertificate build() { + + return new SslCertificate( + certificate, creationTimestamp, description, id, kind, name, privateKey, selfLink); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCertificate(this.certificate); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setPrivateKey(this.privateKey); + newBuilder.setSelfLink(this.selfLink); + return newBuilder; + } + } + + @Override + public String toString() { + return "SslCertificate{" + + "certificate=" + + certificate + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "privateKey=" + + privateKey + + ", " + + "selfLink=" + + selfLink + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SslCertificate) { + SslCertificate that = (SslCertificate) o; + return Objects.equals(this.certificate, that.getCertificate()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.privateKey, that.getPrivateKey()) + && Objects.equals(this.selfLink, that.getSelfLink()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + certificate, creationTimestamp, description, id, kind, name, privateKey, selfLink); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificateClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificateClient.java new file mode 100644 index 000000000000..f6167e2d26a5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificateClient.java @@ -0,0 +1,718 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.SslCertificateStub; +import com.google.cloud.compute.v1.stub.SslCertificateStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+ *   ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
+ *   Operation response = sslCertificateClient.deleteSslCertificate(sslCertificate);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the sslCertificateClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of SslCertificateSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * SslCertificateSettings sslCertificateSettings =
+ *     SslCertificateSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * SslCertificateClient sslCertificateClient =
+ *     SslCertificateClient.create(sslCertificateSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * SslCertificateSettings sslCertificateSettings =
+ *     SslCertificateSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * SslCertificateClient sslCertificateClient =
+ *     SslCertificateClient.create(sslCertificateSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SslCertificateClient implements BackgroundResource { + private final SslCertificateSettings settings; + private final SslCertificateStub stub; + + /** Constructs an instance of SslCertificateClient with default settings. */ + public static final SslCertificateClient create() throws IOException { + return create(SslCertificateSettings.newBuilder().build()); + } + + /** + * Constructs an instance of SslCertificateClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final SslCertificateClient create(SslCertificateSettings settings) + throws IOException { + return new SslCertificateClient(settings); + } + + /** + * Constructs an instance of SslCertificateClient, using the given stub for making calls. This is + * for advanced usage - prefer to use SslCertificateSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final SslCertificateClient create(SslCertificateStub stub) { + return new SslCertificateClient(stub); + } + + /** + * Constructs an instance of SslCertificateClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected SslCertificateClient(SslCertificateSettings settings) throws IOException { + this.settings = settings; + this.stub = ((SslCertificateStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected SslCertificateClient(SslCertificateStub stub) { + this.settings = null; + this.stub = stub; + } + + public final SslCertificateSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public SslCertificateStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified SslCertificate resource. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
+   *   Operation response = sslCertificateClient.deleteSslCertificate(sslCertificate);
+   * }
+   * 
+ * + * @param sslCertificate Name of the SslCertificate resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSslCertificate(ProjectGlobalSslCertificateName sslCertificate) { + + DeleteSslCertificateHttpRequest request = + DeleteSslCertificateHttpRequest.newBuilder() + .setSslCertificate(sslCertificate == null ? null : sslCertificate.toString()) + .build(); + return deleteSslCertificate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified SslCertificate resource. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
+   *   Operation response = sslCertificateClient.deleteSslCertificate(sslCertificate.toString());
+   * }
+   * 
+ * + * @param sslCertificate Name of the SslCertificate resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSslCertificate(String sslCertificate) { + + DeleteSslCertificateHttpRequest request = + DeleteSslCertificateHttpRequest.newBuilder().setSslCertificate(sslCertificate).build(); + return deleteSslCertificate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified SslCertificate resource. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
+   *   DeleteSslCertificateHttpRequest request = DeleteSslCertificateHttpRequest.newBuilder()
+   *     .setSslCertificate(sslCertificate.toString())
+   *     .build();
+   *   Operation response = sslCertificateClient.deleteSslCertificate(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSslCertificate(DeleteSslCertificateHttpRequest request) { + return deleteSslCertificateCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified SslCertificate resource. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
+   *   DeleteSslCertificateHttpRequest request = DeleteSslCertificateHttpRequest.newBuilder()
+   *     .setSslCertificate(sslCertificate.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = sslCertificateClient.deleteSslCertificateCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteSslCertificateCallable() { + return stub.deleteSslCertificateCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified SslCertificate resource. Gets a list of available SSL certificates by + * making a list() request. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
+   *   SslCertificate response = sslCertificateClient.getSslCertificate(sslCertificate);
+   * }
+   * 
+ * + * @param sslCertificate Name of the SslCertificate resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SslCertificate getSslCertificate(ProjectGlobalSslCertificateName sslCertificate) { + + GetSslCertificateHttpRequest request = + GetSslCertificateHttpRequest.newBuilder() + .setSslCertificate(sslCertificate == null ? null : sslCertificate.toString()) + .build(); + return getSslCertificate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified SslCertificate resource. Gets a list of available SSL certificates by + * making a list() request. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
+   *   SslCertificate response = sslCertificateClient.getSslCertificate(sslCertificate.toString());
+   * }
+   * 
+ * + * @param sslCertificate Name of the SslCertificate resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SslCertificate getSslCertificate(String sslCertificate) { + + GetSslCertificateHttpRequest request = + GetSslCertificateHttpRequest.newBuilder().setSslCertificate(sslCertificate).build(); + return getSslCertificate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified SslCertificate resource. Gets a list of available SSL certificates by + * making a list() request. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
+   *   GetSslCertificateHttpRequest request = GetSslCertificateHttpRequest.newBuilder()
+   *     .setSslCertificate(sslCertificate.toString())
+   *     .build();
+   *   SslCertificate response = sslCertificateClient.getSslCertificate(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SslCertificate getSslCertificate(GetSslCertificateHttpRequest request) { + return getSslCertificateCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified SslCertificate resource. Gets a list of available SSL certificates by + * making a list() request. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
+   *   GetSslCertificateHttpRequest request = GetSslCertificateHttpRequest.newBuilder()
+   *     .setSslCertificate(sslCertificate.toString())
+   *     .build();
+   *   ApiFuture<SslCertificate> future = sslCertificateClient.getSslCertificateCallable().futureCall(request);
+   *   // Do something
+   *   SslCertificate response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getSslCertificateCallable() { + return stub.getSslCertificateCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a SslCertificate resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   SslCertificate sslCertificateResource = SslCertificate.newBuilder().build();
+   *   Operation response = sslCertificateClient.insertSslCertificate(project, sslCertificateResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param sslCertificateResource An SslCertificate resource. This resource provides a mechanism to + * upload an SSL key and certificate to the load balancer to serve secure connections from the + * user. (== resource_for beta.sslCertificates ==) (== resource_for v1.sslCertificates ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertSslCertificate( + ProjectName project, SslCertificate sslCertificateResource) { + + InsertSslCertificateHttpRequest request = + InsertSslCertificateHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setSslCertificateResource(sslCertificateResource) + .build(); + return insertSslCertificate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a SslCertificate resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   SslCertificate sslCertificateResource = SslCertificate.newBuilder().build();
+   *   Operation response = sslCertificateClient.insertSslCertificate(project.toString(), sslCertificateResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param sslCertificateResource An SslCertificate resource. This resource provides a mechanism to + * upload an SSL key and certificate to the load balancer to serve secure connections from the + * user. (== resource_for beta.sslCertificates ==) (== resource_for v1.sslCertificates ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertSslCertificate( + String project, SslCertificate sslCertificateResource) { + + InsertSslCertificateHttpRequest request = + InsertSslCertificateHttpRequest.newBuilder() + .setProject(project) + .setSslCertificateResource(sslCertificateResource) + .build(); + return insertSslCertificate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a SslCertificate resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   SslCertificate sslCertificateResource = SslCertificate.newBuilder().build();
+   *   InsertSslCertificateHttpRequest request = InsertSslCertificateHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setSslCertificateResource(sslCertificateResource)
+   *     .build();
+   *   Operation response = sslCertificateClient.insertSslCertificate(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertSslCertificate(InsertSslCertificateHttpRequest request) { + return insertSslCertificateCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a SslCertificate resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   SslCertificate sslCertificateResource = SslCertificate.newBuilder().build();
+   *   InsertSslCertificateHttpRequest request = InsertSslCertificateHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setSslCertificateResource(sslCertificateResource)
+   *     .build();
+   *   ApiFuture<Operation> future = sslCertificateClient.insertSslCertificateCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertSslCertificateCallable() { + return stub.insertSslCertificateCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of SslCertificate resources available to the specified project. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (SslCertificate element : sslCertificateClient.listSslCertificates(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSslCertificatesPagedResponse listSslCertificates(ProjectName project) { + ListSslCertificatesHttpRequest request = + ListSslCertificatesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listSslCertificates(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of SslCertificate resources available to the specified project. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (SslCertificate element : sslCertificateClient.listSslCertificates(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSslCertificatesPagedResponse listSslCertificates(String project) { + ListSslCertificatesHttpRequest request = + ListSslCertificatesHttpRequest.newBuilder().setProject(project).build(); + return listSslCertificates(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of SslCertificate resources available to the specified project. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListSslCertificatesHttpRequest request = ListSslCertificatesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (SslCertificate element : sslCertificateClient.listSslCertificates(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSslCertificatesPagedResponse listSslCertificates( + ListSslCertificatesHttpRequest request) { + return listSslCertificatesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of SslCertificate resources available to the specified project. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListSslCertificatesHttpRequest request = ListSslCertificatesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListSslCertificatesPagedResponse> future = sslCertificateClient.listSslCertificatesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (SslCertificate element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listSslCertificatesPagedCallable() { + return stub.listSslCertificatesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of SslCertificate resources available to the specified project. + * + *

Sample code: + * + *


+   * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListSslCertificatesHttpRequest request = ListSslCertificatesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     SslCertificateList response = sslCertificateClient.listSslCertificatesCallable().call(request);
+   *     for (SslCertificate element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listSslCertificatesCallable() { + return stub.listSslCertificatesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListSslCertificatesPagedResponse + extends AbstractPagedListResponse< + ListSslCertificatesHttpRequest, SslCertificateList, SslCertificate, + ListSslCertificatesPage, ListSslCertificatesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListSslCertificatesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListSslCertificatesPagedResponse apply(ListSslCertificatesPage input) { + return new ListSslCertificatesPagedResponse(input); + } + }); + } + + private ListSslCertificatesPagedResponse(ListSslCertificatesPage page) { + super(page, ListSslCertificatesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListSslCertificatesPage + extends AbstractPage< + ListSslCertificatesHttpRequest, SslCertificateList, SslCertificate, + ListSslCertificatesPage> { + + private ListSslCertificatesPage( + PageContext context, + SslCertificateList response) { + super(context, response); + } + + private static ListSslCertificatesPage createEmptyPage() { + return new ListSslCertificatesPage(null, null); + } + + @Override + protected ListSslCertificatesPage createPage( + PageContext context, + SslCertificateList response) { + return new ListSslCertificatesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListSslCertificatesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListSslCertificatesHttpRequest, SslCertificateList, SslCertificate, + ListSslCertificatesPage, ListSslCertificatesFixedSizeCollection> { + + private ListSslCertificatesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListSslCertificatesFixedSizeCollection createEmptyCollection() { + return new ListSslCertificatesFixedSizeCollection(null, 0); + } + + @Override + protected ListSslCertificatesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListSslCertificatesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificateList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificateList.java new file mode 100644 index 000000000000..a787ee087c2c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificateList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SslCertificateList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private SslCertificateList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private SslCertificateList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SslCertificateList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SslCertificateList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SslCertificateList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SslCertificateList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(SslCertificateList other) { + if (other == SslCertificateList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(SslCertificateList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(SslCertificate items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public SslCertificateList build() { + + return new SslCertificateList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "SslCertificateList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SslCertificateList) { + SslCertificateList that = (SslCertificateList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificateSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificateSettings.java new file mode 100644 index 000000000000..0943dad381ca --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslCertificateSettings.java @@ -0,0 +1,223 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.SslCertificateClient.ListSslCertificatesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.SslCertificateStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link SslCertificateClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteSslCertificate to 30 seconds: + * + *

+ * 
+ * SslCertificateSettings.Builder sslCertificateSettingsBuilder =
+ *     SslCertificateSettings.newBuilder();
+ * sslCertificateSettingsBuilder.deleteSslCertificateSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * SslCertificateSettings sslCertificateSettings = sslCertificateSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SslCertificateSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteSslCertificate. */ + public UnaryCallSettings + deleteSslCertificateSettings() { + return ((SslCertificateStubSettings) getStubSettings()).deleteSslCertificateSettings(); + } + + /** Returns the object with the settings used for calls to getSslCertificate. */ + public UnaryCallSettings + getSslCertificateSettings() { + return ((SslCertificateStubSettings) getStubSettings()).getSslCertificateSettings(); + } + + /** Returns the object with the settings used for calls to insertSslCertificate. */ + public UnaryCallSettings + insertSslCertificateSettings() { + return ((SslCertificateStubSettings) getStubSettings()).insertSslCertificateSettings(); + } + + /** Returns the object with the settings used for calls to listSslCertificates. */ + public PagedCallSettings< + ListSslCertificatesHttpRequest, SslCertificateList, ListSslCertificatesPagedResponse> + listSslCertificatesSettings() { + return ((SslCertificateStubSettings) getStubSettings()).listSslCertificatesSettings(); + } + + public static final SslCertificateSettings create(SslCertificateStubSettings stub) + throws IOException { + return new SslCertificateSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return SslCertificateStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return SslCertificateStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return SslCertificateStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return SslCertificateStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return SslCertificateStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return SslCertificateStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return SslCertificateStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SslCertificateStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SslCertificateSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for SslCertificateSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(SslCertificateStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(SslCertificateStubSettings.newBuilder()); + } + + protected Builder(SslCertificateSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(SslCertificateStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public SslCertificateStubSettings.Builder getStubSettingsBuilder() { + return ((SslCertificateStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteSslCertificate. */ + public UnaryCallSettings.Builder + deleteSslCertificateSettings() { + return getStubSettingsBuilder().deleteSslCertificateSettings(); + } + + /** Returns the builder for the settings used for calls to getSslCertificate. */ + public UnaryCallSettings.Builder + getSslCertificateSettings() { + return getStubSettingsBuilder().getSslCertificateSettings(); + } + + /** Returns the builder for the settings used for calls to insertSslCertificate. */ + public UnaryCallSettings.Builder + insertSslCertificateSettings() { + return getStubSettingsBuilder().insertSslCertificateSettings(); + } + + /** Returns the builder for the settings used for calls to listSslCertificates. */ + public PagedCallSettings.Builder< + ListSslCertificatesHttpRequest, SslCertificateList, ListSslCertificatesPagedResponse> + listSslCertificatesSettings() { + return getStubSettingsBuilder().listSslCertificatesSettings(); + } + + @Override + public SslCertificateSettings build() throws IOException { + return new SslCertificateSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPoliciesList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPoliciesList.java new file mode 100644 index 000000000000..01888013fbf9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPoliciesList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SslPoliciesList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private SslPoliciesList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private SslPoliciesList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SslPoliciesList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SslPoliciesList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SslPoliciesList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SslPoliciesList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(SslPoliciesList other) { + if (other == SslPoliciesList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(SslPoliciesList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(SslPolicy items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public SslPoliciesList build() { + + return new SslPoliciesList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "SslPoliciesList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SslPoliciesList) { + SslPoliciesList that = (SslPoliciesList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPoliciesListAvailableFeaturesResponse.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPoliciesListAvailableFeaturesResponse.java new file mode 100644 index 000000000000..83ff4bdd015d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPoliciesListAvailableFeaturesResponse.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SslPoliciesListAvailableFeaturesResponse implements ApiMessage { + private final List features; + + private SslPoliciesListAvailableFeaturesResponse() { + this.features = null; + } + + private SslPoliciesListAvailableFeaturesResponse(List features) { + this.features = features; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("features")) { + return features; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getFeaturesList() { + return features; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SslPoliciesListAvailableFeaturesResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SslPoliciesListAvailableFeaturesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SslPoliciesListAvailableFeaturesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SslPoliciesListAvailableFeaturesResponse(); + } + + public static class Builder { + private List features; + + Builder() {} + + public Builder mergeFrom(SslPoliciesListAvailableFeaturesResponse other) { + if (other == SslPoliciesListAvailableFeaturesResponse.getDefaultInstance()) return this; + if (other.getFeaturesList() != null) { + this.features = other.features; + } + return this; + } + + Builder(SslPoliciesListAvailableFeaturesResponse source) { + this.features = source.features; + } + + public List getFeaturesList() { + return features; + } + + public Builder addAllFeatures(List features) { + if (this.features == null) { + this.features = new ArrayList<>(features.size()); + } + this.features.addAll(features); + return this; + } + + public Builder addFeatures(String features) { + this.features.add(features); + return this; + } + + public SslPoliciesListAvailableFeaturesResponse build() { + return new SslPoliciesListAvailableFeaturesResponse(features); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllFeatures(this.features); + return newBuilder; + } + } + + @Override + public String toString() { + return "SslPoliciesListAvailableFeaturesResponse{" + "features=" + features + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SslPoliciesListAvailableFeaturesResponse) { + SslPoliciesListAvailableFeaturesResponse that = (SslPoliciesListAvailableFeaturesResponse) o; + return Objects.equals(this.features, that.getFeaturesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(features); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicy.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicy.java new file mode 100644 index 000000000000..ae708f653f4c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicy.java @@ -0,0 +1,526 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SslPolicy implements ApiMessage { + private final String creationTimestamp; + private final List customFeatures; + private final String description; + private final List enabledFeatures; + private final String fingerprint; + private final String id; + private final String kind; + private final String minTlsVersion; + private final String name; + private final String profile; + private final String selfLink; + private final List warnings; + + private SslPolicy() { + this.creationTimestamp = null; + this.customFeatures = null; + this.description = null; + this.enabledFeatures = null; + this.fingerprint = null; + this.id = null; + this.kind = null; + this.minTlsVersion = null; + this.name = null; + this.profile = null; + this.selfLink = null; + this.warnings = null; + } + + private SslPolicy( + String creationTimestamp, + List customFeatures, + String description, + List enabledFeatures, + String fingerprint, + String id, + String kind, + String minTlsVersion, + String name, + String profile, + String selfLink, + List warnings) { + this.creationTimestamp = creationTimestamp; + this.customFeatures = customFeatures; + this.description = description; + this.enabledFeatures = enabledFeatures; + this.fingerprint = fingerprint; + this.id = id; + this.kind = kind; + this.minTlsVersion = minTlsVersion; + this.name = name; + this.profile = profile; + this.selfLink = selfLink; + this.warnings = warnings; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("customFeatures")) { + return customFeatures; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("enabledFeatures")) { + return enabledFeatures; + } + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("minTlsVersion")) { + return minTlsVersion; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("profile")) { + return profile; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warnings")) { + return warnings; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public List getCustomFeaturesList() { + return customFeatures; + } + + public String getDescription() { + return description; + } + + public List getEnabledFeaturesList() { + return enabledFeatures; + } + + public String getFingerprint() { + return fingerprint; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getMinTlsVersion() { + return minTlsVersion; + } + + public String getName() { + return name; + } + + public String getProfile() { + return profile; + } + + public String getSelfLink() { + return selfLink; + } + + public List getWarningsList() { + return warnings; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SslPolicy prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SslPolicy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SslPolicy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SslPolicy(); + } + + public static class Builder { + private String creationTimestamp; + private List customFeatures; + private String description; + private List enabledFeatures; + private String fingerprint; + private String id; + private String kind; + private String minTlsVersion; + private String name; + private String profile; + private String selfLink; + private List warnings; + + Builder() {} + + public Builder mergeFrom(SslPolicy other) { + if (other == SslPolicy.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getCustomFeaturesList() != null) { + this.customFeatures = other.customFeatures; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getEnabledFeaturesList() != null) { + this.enabledFeatures = other.enabledFeatures; + } + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getMinTlsVersion() != null) { + this.minTlsVersion = other.minTlsVersion; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getProfile() != null) { + this.profile = other.profile; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarningsList() != null) { + this.warnings = other.warnings; + } + return this; + } + + Builder(SslPolicy source) { + this.creationTimestamp = source.creationTimestamp; + this.customFeatures = source.customFeatures; + this.description = source.description; + this.enabledFeatures = source.enabledFeatures; + this.fingerprint = source.fingerprint; + this.id = source.id; + this.kind = source.kind; + this.minTlsVersion = source.minTlsVersion; + this.name = source.name; + this.profile = source.profile; + this.selfLink = source.selfLink; + this.warnings = source.warnings; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public List getCustomFeaturesList() { + return customFeatures; + } + + public Builder addAllCustomFeatures(List customFeatures) { + if (this.customFeatures == null) { + this.customFeatures = new ArrayList<>(customFeatures.size()); + } + this.customFeatures.addAll(customFeatures); + return this; + } + + public Builder addCustomFeatures(String customFeatures) { + this.customFeatures.add(customFeatures); + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public List getEnabledFeaturesList() { + return enabledFeatures; + } + + public Builder addAllEnabledFeatures(List enabledFeatures) { + if (this.enabledFeatures == null) { + this.enabledFeatures = new ArrayList<>(enabledFeatures.size()); + } + this.enabledFeatures.addAll(enabledFeatures); + return this; + } + + public Builder addEnabledFeatures(String enabledFeatures) { + this.enabledFeatures.add(enabledFeatures); + return this; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getMinTlsVersion() { + return minTlsVersion; + } + + public Builder setMinTlsVersion(String minTlsVersion) { + this.minTlsVersion = minTlsVersion; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getProfile() { + return profile; + } + + public Builder setProfile(String profile) { + this.profile = profile; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public List getWarningsList() { + return warnings; + } + + public Builder addAllWarnings(List warnings) { + if (this.warnings == null) { + this.warnings = new ArrayList<>(warnings.size()); + } + this.warnings.addAll(warnings); + return this; + } + + public Builder addWarnings(Warnings warnings) { + this.warnings.add(warnings); + return this; + } + + public SslPolicy build() { + + return new SslPolicy( + creationTimestamp, + customFeatures, + description, + enabledFeatures, + fingerprint, + id, + kind, + minTlsVersion, + name, + profile, + selfLink, + warnings); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.addAllCustomFeatures(this.customFeatures); + newBuilder.setDescription(this.description); + newBuilder.addAllEnabledFeatures(this.enabledFeatures); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setMinTlsVersion(this.minTlsVersion); + newBuilder.setName(this.name); + newBuilder.setProfile(this.profile); + newBuilder.setSelfLink(this.selfLink); + newBuilder.addAllWarnings(this.warnings); + return newBuilder; + } + } + + @Override + public String toString() { + return "SslPolicy{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "customFeatures=" + + customFeatures + + ", " + + "description=" + + description + + ", " + + "enabledFeatures=" + + enabledFeatures + + ", " + + "fingerprint=" + + fingerprint + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "minTlsVersion=" + + minTlsVersion + + ", " + + "name=" + + name + + ", " + + "profile=" + + profile + + ", " + + "selfLink=" + + selfLink + + ", " + + "warnings=" + + warnings + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SslPolicy) { + SslPolicy that = (SslPolicy) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.customFeatures, that.getCustomFeaturesList()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.enabledFeatures, that.getEnabledFeaturesList()) + && Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.minTlsVersion, that.getMinTlsVersion()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.profile, that.getProfile()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warnings, that.getWarningsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + customFeatures, + description, + enabledFeatures, + fingerprint, + id, + kind, + minTlsVersion, + name, + profile, + selfLink, + warnings); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyClient.java new file mode 100644 index 000000000000..cdf291995cdc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyClient.java @@ -0,0 +1,935 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.SslPolicyStub; +import com.google.cloud.compute.v1.stub.SslPolicyStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+ *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+ *   Operation response = sslPolicyClient.deleteSslPolicy(sslPolicy);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the sslPolicyClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of SslPolicySettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * SslPolicySettings sslPolicySettings =
+ *     SslPolicySettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * SslPolicyClient sslPolicyClient =
+ *     SslPolicyClient.create(sslPolicySettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * SslPolicySettings sslPolicySettings =
+ *     SslPolicySettings.newBuilder().setEndpoint(myEndpoint).build();
+ * SslPolicyClient sslPolicyClient =
+ *     SslPolicyClient.create(sslPolicySettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SslPolicyClient implements BackgroundResource { + private final SslPolicySettings settings; + private final SslPolicyStub stub; + + /** Constructs an instance of SslPolicyClient with default settings. */ + public static final SslPolicyClient create() throws IOException { + return create(SslPolicySettings.newBuilder().build()); + } + + /** + * Constructs an instance of SslPolicyClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final SslPolicyClient create(SslPolicySettings settings) throws IOException { + return new SslPolicyClient(settings); + } + + /** + * Constructs an instance of SslPolicyClient, using the given stub for making calls. This is for + * advanced usage - prefer to use SslPolicySettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final SslPolicyClient create(SslPolicyStub stub) { + return new SslPolicyClient(stub); + } + + /** + * Constructs an instance of SslPolicyClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected SslPolicyClient(SslPolicySettings settings) throws IOException { + this.settings = settings; + this.stub = ((SslPolicyStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected SslPolicyClient(SslPolicyStub stub) { + this.settings = null; + this.stub = stub; + } + + public final SslPolicySettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public SslPolicyStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in + * use by any TargetHttpsProxy or TargetSslProxy resources. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   Operation response = sslPolicyClient.deleteSslPolicy(sslPolicy);
+   * }
+   * 
+ * + * @param sslPolicy Name of the SSL policy to delete. The name must be 1-63 characters long, and + * comply with RFC1035. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSslPolicy(ProjectGlobalSslPolicyName sslPolicy) { + + DeleteSslPolicyHttpRequest request = + DeleteSslPolicyHttpRequest.newBuilder() + .setSslPolicy(sslPolicy == null ? null : sslPolicy.toString()) + .build(); + return deleteSslPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in + * use by any TargetHttpsProxy or TargetSslProxy resources. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   Operation response = sslPolicyClient.deleteSslPolicy(sslPolicy.toString());
+   * }
+   * 
+ * + * @param sslPolicy Name of the SSL policy to delete. The name must be 1-63 characters long, and + * comply with RFC1035. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSslPolicy(String sslPolicy) { + + DeleteSslPolicyHttpRequest request = + DeleteSslPolicyHttpRequest.newBuilder().setSslPolicy(sslPolicy).build(); + return deleteSslPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in + * use by any TargetHttpsProxy or TargetSslProxy resources. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   DeleteSslPolicyHttpRequest request = DeleteSslPolicyHttpRequest.newBuilder()
+   *     .setSslPolicy(sslPolicy.toString())
+   *     .build();
+   *   Operation response = sslPolicyClient.deleteSslPolicy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSslPolicy(DeleteSslPolicyHttpRequest request) { + return deleteSslPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in + * use by any TargetHttpsProxy or TargetSslProxy resources. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   DeleteSslPolicyHttpRequest request = DeleteSslPolicyHttpRequest.newBuilder()
+   *     .setSslPolicy(sslPolicy.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = sslPolicyClient.deleteSslPolicyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteSslPolicyCallable() { + return stub.deleteSslPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all of the ordered rules present in a single specified policy. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   SslPolicy response = sslPolicyClient.getSslPolicy(sslPolicy);
+   * }
+   * 
+ * + * @param sslPolicy Name of the SSL policy to update. The name must be 1-63 characters long, and + * comply with RFC1035. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SslPolicy getSslPolicy(ProjectGlobalSslPolicyName sslPolicy) { + + GetSslPolicyHttpRequest request = + GetSslPolicyHttpRequest.newBuilder() + .setSslPolicy(sslPolicy == null ? null : sslPolicy.toString()) + .build(); + return getSslPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all of the ordered rules present in a single specified policy. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   SslPolicy response = sslPolicyClient.getSslPolicy(sslPolicy.toString());
+   * }
+   * 
+ * + * @param sslPolicy Name of the SSL policy to update. The name must be 1-63 characters long, and + * comply with RFC1035. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SslPolicy getSslPolicy(String sslPolicy) { + + GetSslPolicyHttpRequest request = + GetSslPolicyHttpRequest.newBuilder().setSslPolicy(sslPolicy).build(); + return getSslPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all of the ordered rules present in a single specified policy. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   GetSslPolicyHttpRequest request = GetSslPolicyHttpRequest.newBuilder()
+   *     .setSslPolicy(sslPolicy.toString())
+   *     .build();
+   *   SslPolicy response = sslPolicyClient.getSslPolicy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SslPolicy getSslPolicy(GetSslPolicyHttpRequest request) { + return getSslPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all of the ordered rules present in a single specified policy. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   GetSslPolicyHttpRequest request = GetSslPolicyHttpRequest.newBuilder()
+   *     .setSslPolicy(sslPolicy.toString())
+   *     .build();
+   *   ApiFuture<SslPolicy> future = sslPolicyClient.getSslPolicyCallable().futureCall(request);
+   *   // Do something
+   *   SslPolicy response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getSslPolicyCallable() { + return stub.getSslPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified SSL policy resource. Gets a list of available SSL policies by making a + * list() request. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   SslPolicy sslPolicyResource = SslPolicy.newBuilder().build();
+   *   Operation response = sslPolicyClient.insertSslPolicy(project, sslPolicyResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param sslPolicyResource A SSL policy specifies the server-side support for SSL features. This + * can be attached to a TargetHttpsProxy or a TargetSslProxy. This affects connections between + * clients and the HTTPS or SSL proxy load balancer. They do not affect the connection between + * the load balancers and the backends. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertSslPolicy(ProjectName project, SslPolicy sslPolicyResource) { + + InsertSslPolicyHttpRequest request = + InsertSslPolicyHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setSslPolicyResource(sslPolicyResource) + .build(); + return insertSslPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified SSL policy resource. Gets a list of available SSL policies by making a + * list() request. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   SslPolicy sslPolicyResource = SslPolicy.newBuilder().build();
+   *   Operation response = sslPolicyClient.insertSslPolicy(project.toString(), sslPolicyResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param sslPolicyResource A SSL policy specifies the server-side support for SSL features. This + * can be attached to a TargetHttpsProxy or a TargetSslProxy. This affects connections between + * clients and the HTTPS or SSL proxy load balancer. They do not affect the connection between + * the load balancers and the backends. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertSslPolicy(String project, SslPolicy sslPolicyResource) { + + InsertSslPolicyHttpRequest request = + InsertSslPolicyHttpRequest.newBuilder() + .setProject(project) + .setSslPolicyResource(sslPolicyResource) + .build(); + return insertSslPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified SSL policy resource. Gets a list of available SSL policies by making a + * list() request. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   SslPolicy sslPolicyResource = SslPolicy.newBuilder().build();
+   *   InsertSslPolicyHttpRequest request = InsertSslPolicyHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setSslPolicyResource(sslPolicyResource)
+   *     .build();
+   *   Operation response = sslPolicyClient.insertSslPolicy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertSslPolicy(InsertSslPolicyHttpRequest request) { + return insertSslPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified SSL policy resource. Gets a list of available SSL policies by making a + * list() request. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   SslPolicy sslPolicyResource = SslPolicy.newBuilder().build();
+   *   InsertSslPolicyHttpRequest request = InsertSslPolicyHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setSslPolicyResource(sslPolicyResource)
+   *     .build();
+   *   ApiFuture<Operation> future = sslPolicyClient.insertSslPolicyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertSslPolicyCallable() { + return stub.insertSslPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the SSL policies that have been configured for the specified project. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (SslPolicy element : sslPolicyClient.listSslPolicies(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSslPoliciesPagedResponse listSslPolicies(ProjectName project) { + ListSslPoliciesHttpRequest request = + ListSslPoliciesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listSslPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the SSL policies that have been configured for the specified project. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (SslPolicy element : sslPolicyClient.listSslPolicies(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSslPoliciesPagedResponse listSslPolicies(String project) { + ListSslPoliciesHttpRequest request = + ListSslPoliciesHttpRequest.newBuilder().setProject(project).build(); + return listSslPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the SSL policies that have been configured for the specified project. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListSslPoliciesHttpRequest request = ListSslPoliciesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (SslPolicy element : sslPolicyClient.listSslPolicies(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSslPoliciesPagedResponse listSslPolicies(ListSslPoliciesHttpRequest request) { + return listSslPoliciesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the SSL policies that have been configured for the specified project. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListSslPoliciesHttpRequest request = ListSslPoliciesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListSslPoliciesPagedResponse> future = sslPolicyClient.listSslPoliciesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (SslPolicy element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listSslPoliciesPagedCallable() { + return stub.listSslPoliciesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the SSL policies that have been configured for the specified project. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListSslPoliciesHttpRequest request = ListSslPoliciesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     SslPoliciesList response = sslPolicyClient.listSslPoliciesCallable().call(request);
+   *     for (SslPolicy element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listSslPoliciesCallable() { + return stub.listSslPoliciesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all features that can be specified in the SSL policy when using custom profile. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   SslPoliciesListAvailableFeaturesResponse response = sslPolicyClient.listAvailableFeaturesSslPolicies(project);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SslPoliciesListAvailableFeaturesResponse listAvailableFeaturesSslPolicies( + ProjectName project) { + + ListAvailableFeaturesSslPoliciesHttpRequest request = + ListAvailableFeaturesSslPoliciesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listAvailableFeaturesSslPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all features that can be specified in the SSL policy when using custom profile. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   SslPoliciesListAvailableFeaturesResponse response = sslPolicyClient.listAvailableFeaturesSslPolicies(project.toString());
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SslPoliciesListAvailableFeaturesResponse listAvailableFeaturesSslPolicies( + String project) { + + ListAvailableFeaturesSslPoliciesHttpRequest request = + ListAvailableFeaturesSslPoliciesHttpRequest.newBuilder().setProject(project).build(); + return listAvailableFeaturesSslPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all features that can be specified in the SSL policy when using custom profile. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListAvailableFeaturesSslPoliciesHttpRequest request = ListAvailableFeaturesSslPoliciesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   SslPoliciesListAvailableFeaturesResponse response = sslPolicyClient.listAvailableFeaturesSslPolicies(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final SslPoliciesListAvailableFeaturesResponse listAvailableFeaturesSslPolicies( + ListAvailableFeaturesSslPoliciesHttpRequest request) { + return listAvailableFeaturesSslPoliciesCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all features that can be specified in the SSL policy when using custom profile. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListAvailableFeaturesSslPoliciesHttpRequest request = ListAvailableFeaturesSslPoliciesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<SslPoliciesListAvailableFeaturesResponse> future = sslPolicyClient.listAvailableFeaturesSslPoliciesCallable().futureCall(request);
+   *   // Do something
+   *   SslPoliciesListAvailableFeaturesResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesCallable() { + return stub.listAvailableFeaturesSslPoliciesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified SSL policy with the data included in the request. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   SslPolicy sslPolicyResource = SslPolicy.newBuilder().build();
+   *   Operation response = sslPolicyClient.patchSslPolicy(sslPolicy, sslPolicyResource);
+   * }
+   * 
+ * + * @param sslPolicy Name of the SSL policy to update. The name must be 1-63 characters long, and + * comply with RFC1035. + * @param sslPolicyResource A SSL policy specifies the server-side support for SSL features. This + * can be attached to a TargetHttpsProxy or a TargetSslProxy. This affects connections between + * clients and the HTTPS or SSL proxy load balancer. They do not affect the connection between + * the load balancers and the backends. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchSslPolicy( + ProjectGlobalSslPolicyName sslPolicy, SslPolicy sslPolicyResource) { + + PatchSslPolicyHttpRequest request = + PatchSslPolicyHttpRequest.newBuilder() + .setSslPolicy(sslPolicy == null ? null : sslPolicy.toString()) + .setSslPolicyResource(sslPolicyResource) + .build(); + return patchSslPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified SSL policy with the data included in the request. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   SslPolicy sslPolicyResource = SslPolicy.newBuilder().build();
+   *   Operation response = sslPolicyClient.patchSslPolicy(sslPolicy.toString(), sslPolicyResource);
+   * }
+   * 
+ * + * @param sslPolicy Name of the SSL policy to update. The name must be 1-63 characters long, and + * comply with RFC1035. + * @param sslPolicyResource A SSL policy specifies the server-side support for SSL features. This + * can be attached to a TargetHttpsProxy or a TargetSslProxy. This affects connections between + * clients and the HTTPS or SSL proxy load balancer. They do not affect the connection between + * the load balancers and the backends. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchSslPolicy(String sslPolicy, SslPolicy sslPolicyResource) { + + PatchSslPolicyHttpRequest request = + PatchSslPolicyHttpRequest.newBuilder() + .setSslPolicy(sslPolicy) + .setSslPolicyResource(sslPolicyResource) + .build(); + return patchSslPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified SSL policy with the data included in the request. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   SslPolicy sslPolicyResource = SslPolicy.newBuilder().build();
+   *   PatchSslPolicyHttpRequest request = PatchSslPolicyHttpRequest.newBuilder()
+   *     .setSslPolicy(sslPolicy.toString())
+   *     .setSslPolicyResource(sslPolicyResource)
+   *     .build();
+   *   Operation response = sslPolicyClient.patchSslPolicy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchSslPolicy(PatchSslPolicyHttpRequest request) { + return patchSslPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified SSL policy with the data included in the request. + * + *

Sample code: + * + *


+   * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+   *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+   *   SslPolicy sslPolicyResource = SslPolicy.newBuilder().build();
+   *   PatchSslPolicyHttpRequest request = PatchSslPolicyHttpRequest.newBuilder()
+   *     .setSslPolicy(sslPolicy.toString())
+   *     .setSslPolicyResource(sslPolicyResource)
+   *     .build();
+   *   ApiFuture<Operation> future = sslPolicyClient.patchSslPolicyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable patchSslPolicyCallable() { + return stub.patchSslPolicyCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListSslPoliciesPagedResponse + extends AbstractPagedListResponse< + ListSslPoliciesHttpRequest, SslPoliciesList, SslPolicy, ListSslPoliciesPage, + ListSslPoliciesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListSslPoliciesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListSslPoliciesPagedResponse apply(ListSslPoliciesPage input) { + return new ListSslPoliciesPagedResponse(input); + } + }); + } + + private ListSslPoliciesPagedResponse(ListSslPoliciesPage page) { + super(page, ListSslPoliciesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListSslPoliciesPage + extends AbstractPage< + ListSslPoliciesHttpRequest, SslPoliciesList, SslPolicy, ListSslPoliciesPage> { + + private ListSslPoliciesPage( + PageContext context, + SslPoliciesList response) { + super(context, response); + } + + private static ListSslPoliciesPage createEmptyPage() { + return new ListSslPoliciesPage(null, null); + } + + @Override + protected ListSslPoliciesPage createPage( + PageContext context, + SslPoliciesList response) { + return new ListSslPoliciesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListSslPoliciesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListSslPoliciesHttpRequest, SslPoliciesList, SslPolicy, ListSslPoliciesPage, + ListSslPoliciesFixedSizeCollection> { + + private ListSslPoliciesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListSslPoliciesFixedSizeCollection createEmptyCollection() { + return new ListSslPoliciesFixedSizeCollection(null, 0); + } + + @Override + protected ListSslPoliciesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListSslPoliciesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyReference.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyReference.java new file mode 100644 index 000000000000..39637920f887 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyReference.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SslPolicyReference implements ApiMessage { + private final String sslPolicy; + + private SslPolicyReference() { + this.sslPolicy = null; + } + + private SslPolicyReference(String sslPolicy) { + this.sslPolicy = sslPolicy; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("sslPolicy")) { + return sslPolicy; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SslPolicyReference prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SslPolicyReference getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SslPolicyReference DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SslPolicyReference(); + } + + public static class Builder { + private String sslPolicy; + + Builder() {} + + public Builder mergeFrom(SslPolicyReference other) { + if (other == SslPolicyReference.getDefaultInstance()) return this; + if (other.getSslPolicy() != null) { + this.sslPolicy = other.sslPolicy; + } + return this; + } + + Builder(SslPolicyReference source) { + this.sslPolicy = source.sslPolicy; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public Builder setSslPolicy(String sslPolicy) { + this.sslPolicy = sslPolicy; + return this; + } + + public SslPolicyReference build() { + return new SslPolicyReference(sslPolicy); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setSslPolicy(this.sslPolicy); + return newBuilder; + } + } + + @Override + public String toString() { + return "SslPolicyReference{" + "sslPolicy=" + sslPolicy + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SslPolicyReference) { + SslPolicyReference that = (SslPolicyReference) o; + return Objects.equals(this.sslPolicy, that.getSslPolicy()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(sslPolicy); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicySettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicySettings.java new file mode 100644 index 000000000000..98e32a6f559e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicySettings.java @@ -0,0 +1,243 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.SslPolicyClient.ListSslPoliciesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.SslPolicyStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link SslPolicyClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteSslPolicy to 30 seconds: + * + *

+ * 
+ * SslPolicySettings.Builder sslPolicySettingsBuilder =
+ *     SslPolicySettings.newBuilder();
+ * sslPolicySettingsBuilder.deleteSslPolicySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * SslPolicySettings sslPolicySettings = sslPolicySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SslPolicySettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteSslPolicy. */ + public UnaryCallSettings deleteSslPolicySettings() { + return ((SslPolicyStubSettings) getStubSettings()).deleteSslPolicySettings(); + } + + /** Returns the object with the settings used for calls to getSslPolicy. */ + public UnaryCallSettings getSslPolicySettings() { + return ((SslPolicyStubSettings) getStubSettings()).getSslPolicySettings(); + } + + /** Returns the object with the settings used for calls to insertSslPolicy. */ + public UnaryCallSettings insertSslPolicySettings() { + return ((SslPolicyStubSettings) getStubSettings()).insertSslPolicySettings(); + } + + /** Returns the object with the settings used for calls to listSslPolicies. */ + public PagedCallSettings< + ListSslPoliciesHttpRequest, SslPoliciesList, ListSslPoliciesPagedResponse> + listSslPoliciesSettings() { + return ((SslPolicyStubSettings) getStubSettings()).listSslPoliciesSettings(); + } + + /** Returns the object with the settings used for calls to listAvailableFeaturesSslPolicies. */ + public UnaryCallSettings< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesSettings() { + return ((SslPolicyStubSettings) getStubSettings()).listAvailableFeaturesSslPoliciesSettings(); + } + + /** Returns the object with the settings used for calls to patchSslPolicy. */ + public UnaryCallSettings patchSslPolicySettings() { + return ((SslPolicyStubSettings) getStubSettings()).patchSslPolicySettings(); + } + + public static final SslPolicySettings create(SslPolicyStubSettings stub) throws IOException { + return new SslPolicySettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return SslPolicyStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return SslPolicyStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return SslPolicyStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return SslPolicyStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return SslPolicyStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return SslPolicyStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return SslPolicyStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SslPolicyStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SslPolicySettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for SslPolicySettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(SslPolicyStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(SslPolicyStubSettings.newBuilder()); + } + + protected Builder(SslPolicySettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(SslPolicyStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public SslPolicyStubSettings.Builder getStubSettingsBuilder() { + return ((SslPolicyStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteSslPolicy. */ + public UnaryCallSettings.Builder + deleteSslPolicySettings() { + return getStubSettingsBuilder().deleteSslPolicySettings(); + } + + /** Returns the builder for the settings used for calls to getSslPolicy. */ + public UnaryCallSettings.Builder getSslPolicySettings() { + return getStubSettingsBuilder().getSslPolicySettings(); + } + + /** Returns the builder for the settings used for calls to insertSslPolicy. */ + public UnaryCallSettings.Builder + insertSslPolicySettings() { + return getStubSettingsBuilder().insertSslPolicySettings(); + } + + /** Returns the builder for the settings used for calls to listSslPolicies. */ + public PagedCallSettings.Builder< + ListSslPoliciesHttpRequest, SslPoliciesList, ListSslPoliciesPagedResponse> + listSslPoliciesSettings() { + return getStubSettingsBuilder().listSslPoliciesSettings(); + } + + /** Returns the builder for the settings used for calls to listAvailableFeaturesSslPolicies. */ + public UnaryCallSettings.Builder< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesSettings() { + return getStubSettingsBuilder().listAvailableFeaturesSslPoliciesSettings(); + } + + /** Returns the builder for the settings used for calls to patchSslPolicy. */ + public UnaryCallSettings.Builder + patchSslPolicySettings() { + return getStubSettingsBuilder().patchSslPolicySettings(); + } + + @Override + public SslPolicySettings build() throws IOException { + return new SslPolicySettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/StartInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/StartInstanceHttpRequest.java new file mode 100644 index 000000000000..4f3f05adc1a0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/StartInstanceHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class StartInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private StartInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private StartInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(StartInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static StartInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final StartInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new StartInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(StartInstanceHttpRequest other) { + if (other == StartInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(StartInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public StartInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new StartInstanceHttpRequest( + access_token, callback, fields, instance, key, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "StartInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof StartInstanceHttpRequest) { + StartInstanceHttpRequest that = (StartInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, instance, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/StartWithEncryptionKeyInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/StartWithEncryptionKeyInstanceHttpRequest.java new file mode 100644 index 000000000000..b120c69e1c47 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/StartWithEncryptionKeyInstanceHttpRequest.java @@ -0,0 +1,457 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class StartWithEncryptionKeyInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final InstancesStartWithEncryptionKeyRequest + instancesStartWithEncryptionKeyRequestResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private StartWithEncryptionKeyInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.instancesStartWithEncryptionKeyRequestResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private StartWithEncryptionKeyInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.instancesStartWithEncryptionKeyRequestResource = + instancesStartWithEncryptionKeyRequestResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("instancesStartWithEncryptionKeyRequestResource")) { + return instancesStartWithEncryptionKeyRequestResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public InstancesStartWithEncryptionKeyRequest getApiMessageRequestBody() { + return instancesStartWithEncryptionKeyRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public InstancesStartWithEncryptionKeyRequest + getInstancesStartWithEncryptionKeyRequestResource() { + return instancesStartWithEncryptionKeyRequestResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(StartWithEncryptionKeyInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static StartWithEncryptionKeyInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final StartWithEncryptionKeyInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new StartWithEncryptionKeyInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(StartWithEncryptionKeyInstanceHttpRequest other) { + if (other == StartWithEncryptionKeyInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getInstancesStartWithEncryptionKeyRequestResource() != null) { + this.instancesStartWithEncryptionKeyRequestResource = + other.instancesStartWithEncryptionKeyRequestResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(StartWithEncryptionKeyInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.instancesStartWithEncryptionKeyRequestResource = + source.instancesStartWithEncryptionKeyRequestResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public InstancesStartWithEncryptionKeyRequest + getInstancesStartWithEncryptionKeyRequestResource() { + return instancesStartWithEncryptionKeyRequestResource; + } + + public Builder setInstancesStartWithEncryptionKeyRequestResource( + InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource) { + this.instancesStartWithEncryptionKeyRequestResource = + instancesStartWithEncryptionKeyRequestResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public StartWithEncryptionKeyInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new StartWithEncryptionKeyInstanceHttpRequest( + access_token, + callback, + fields, + instance, + instancesStartWithEncryptionKeyRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setInstancesStartWithEncryptionKeyRequestResource( + this.instancesStartWithEncryptionKeyRequestResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "StartWithEncryptionKeyInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "instancesStartWithEncryptionKeyRequestResource=" + + instancesStartWithEncryptionKeyRequestResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof StartWithEncryptionKeyInstanceHttpRequest) { + StartWithEncryptionKeyInstanceHttpRequest that = + (StartWithEncryptionKeyInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals( + this.instancesStartWithEncryptionKeyRequestResource, + that.getInstancesStartWithEncryptionKeyRequestResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + instance, + instancesStartWithEncryptionKeyRequestResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/StopInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/StopInstanceHttpRequest.java new file mode 100644 index 000000000000..5d126ad32e95 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/StopInstanceHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class StopInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private StopInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private StopInstanceHttpRequest( + String access_token, + String callback, + String fields, + String instance, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(StopInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static StopInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final StopInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new StopInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(StopInstanceHttpRequest other) { + if (other == StopInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(StopInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public StopInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new StopInstanceHttpRequest( + access_token, callback, fields, instance, key, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "StopInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof StopInstanceHttpRequest) { + StopInstanceHttpRequest that = (StopInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, instance, key, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Subnetwork.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Subnetwork.java new file mode 100644 index 000000000000..091edb2fb777 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Subnetwork.java @@ -0,0 +1,574 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Subnetwork implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final Boolean enableFlowLogs; + private final String fingerprint; + private final String gatewayAddress; + private final String id; + private final String ipCidrRange; + private final String kind; + private final String name; + private final String network; + private final Boolean privateIpGoogleAccess; + private final String region; + private final List secondaryIpRanges; + private final String selfLink; + + private Subnetwork() { + this.creationTimestamp = null; + this.description = null; + this.enableFlowLogs = null; + this.fingerprint = null; + this.gatewayAddress = null; + this.id = null; + this.ipCidrRange = null; + this.kind = null; + this.name = null; + this.network = null; + this.privateIpGoogleAccess = null; + this.region = null; + this.secondaryIpRanges = null; + this.selfLink = null; + } + + private Subnetwork( + String creationTimestamp, + String description, + Boolean enableFlowLogs, + String fingerprint, + String gatewayAddress, + String id, + String ipCidrRange, + String kind, + String name, + String network, + Boolean privateIpGoogleAccess, + String region, + List secondaryIpRanges, + String selfLink) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.enableFlowLogs = enableFlowLogs; + this.fingerprint = fingerprint; + this.gatewayAddress = gatewayAddress; + this.id = id; + this.ipCidrRange = ipCidrRange; + this.kind = kind; + this.name = name; + this.network = network; + this.privateIpGoogleAccess = privateIpGoogleAccess; + this.region = region; + this.secondaryIpRanges = secondaryIpRanges; + this.selfLink = selfLink; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("enableFlowLogs")) { + return enableFlowLogs; + } + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("gatewayAddress")) { + return gatewayAddress; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("ipCidrRange")) { + return ipCidrRange; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("privateIpGoogleAccess")) { + return privateIpGoogleAccess; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("secondaryIpRanges")) { + return secondaryIpRanges; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public Boolean getEnableFlowLogs() { + return enableFlowLogs; + } + + public String getFingerprint() { + return fingerprint; + } + + public String getGatewayAddress() { + return gatewayAddress; + } + + public String getId() { + return id; + } + + public String getIpCidrRange() { + return ipCidrRange; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getNetwork() { + return network; + } + + public Boolean getPrivateIpGoogleAccess() { + return privateIpGoogleAccess; + } + + public String getRegion() { + return region; + } + + public List getSecondaryIpRangesList() { + return secondaryIpRanges; + } + + public String getSelfLink() { + return selfLink; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Subnetwork prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Subnetwork getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Subnetwork DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Subnetwork(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private Boolean enableFlowLogs; + private String fingerprint; + private String gatewayAddress; + private String id; + private String ipCidrRange; + private String kind; + private String name; + private String network; + private Boolean privateIpGoogleAccess; + private String region; + private List secondaryIpRanges; + private String selfLink; + + Builder() {} + + public Builder mergeFrom(Subnetwork other) { + if (other == Subnetwork.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getEnableFlowLogs() != null) { + this.enableFlowLogs = other.enableFlowLogs; + } + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getGatewayAddress() != null) { + this.gatewayAddress = other.gatewayAddress; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getIpCidrRange() != null) { + this.ipCidrRange = other.ipCidrRange; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getPrivateIpGoogleAccess() != null) { + this.privateIpGoogleAccess = other.privateIpGoogleAccess; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSecondaryIpRangesList() != null) { + this.secondaryIpRanges = other.secondaryIpRanges; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + return this; + } + + Builder(Subnetwork source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.enableFlowLogs = source.enableFlowLogs; + this.fingerprint = source.fingerprint; + this.gatewayAddress = source.gatewayAddress; + this.id = source.id; + this.ipCidrRange = source.ipCidrRange; + this.kind = source.kind; + this.name = source.name; + this.network = source.network; + this.privateIpGoogleAccess = source.privateIpGoogleAccess; + this.region = source.region; + this.secondaryIpRanges = source.secondaryIpRanges; + this.selfLink = source.selfLink; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public Boolean getEnableFlowLogs() { + return enableFlowLogs; + } + + public Builder setEnableFlowLogs(Boolean enableFlowLogs) { + this.enableFlowLogs = enableFlowLogs; + return this; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public String getGatewayAddress() { + return gatewayAddress; + } + + public Builder setGatewayAddress(String gatewayAddress) { + this.gatewayAddress = gatewayAddress; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getIpCidrRange() { + return ipCidrRange; + } + + public Builder setIpCidrRange(String ipCidrRange) { + this.ipCidrRange = ipCidrRange; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public Boolean getPrivateIpGoogleAccess() { + return privateIpGoogleAccess; + } + + public Builder setPrivateIpGoogleAccess(Boolean privateIpGoogleAccess) { + this.privateIpGoogleAccess = privateIpGoogleAccess; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public List getSecondaryIpRangesList() { + return secondaryIpRanges; + } + + public Builder addAllSecondaryIpRanges(List secondaryIpRanges) { + if (this.secondaryIpRanges == null) { + this.secondaryIpRanges = new ArrayList<>(secondaryIpRanges.size()); + } + this.secondaryIpRanges.addAll(secondaryIpRanges); + return this; + } + + public Builder addSecondaryIpRanges(SubnetworkSecondaryRange secondaryIpRanges) { + this.secondaryIpRanges.add(secondaryIpRanges); + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Subnetwork build() { + + return new Subnetwork( + creationTimestamp, + description, + enableFlowLogs, + fingerprint, + gatewayAddress, + id, + ipCidrRange, + kind, + name, + network, + privateIpGoogleAccess, + region, + secondaryIpRanges, + selfLink); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setEnableFlowLogs(this.enableFlowLogs); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.setGatewayAddress(this.gatewayAddress); + newBuilder.setId(this.id); + newBuilder.setIpCidrRange(this.ipCidrRange); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setNetwork(this.network); + newBuilder.setPrivateIpGoogleAccess(this.privateIpGoogleAccess); + newBuilder.setRegion(this.region); + newBuilder.addAllSecondaryIpRanges(this.secondaryIpRanges); + newBuilder.setSelfLink(this.selfLink); + return newBuilder; + } + } + + @Override + public String toString() { + return "Subnetwork{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "enableFlowLogs=" + + enableFlowLogs + + ", " + + "fingerprint=" + + fingerprint + + ", " + + "gatewayAddress=" + + gatewayAddress + + ", " + + "id=" + + id + + ", " + + "ipCidrRange=" + + ipCidrRange + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "network=" + + network + + ", " + + "privateIpGoogleAccess=" + + privateIpGoogleAccess + + ", " + + "region=" + + region + + ", " + + "secondaryIpRanges=" + + secondaryIpRanges + + ", " + + "selfLink=" + + selfLink + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Subnetwork) { + Subnetwork that = (Subnetwork) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.enableFlowLogs, that.getEnableFlowLogs()) + && Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.gatewayAddress, that.getGatewayAddress()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.ipCidrRange, that.getIpCidrRange()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.privateIpGoogleAccess, that.getPrivateIpGoogleAccess()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.secondaryIpRanges, that.getSecondaryIpRangesList()) + && Objects.equals(this.selfLink, that.getSelfLink()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + description, + enableFlowLogs, + fingerprint, + gatewayAddress, + id, + ipCidrRange, + kind, + name, + network, + privateIpGoogleAccess, + region, + secondaryIpRanges, + selfLink); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkAggregatedList.java new file mode 100644 index 000000000000..99fd627600a5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SubnetworkAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private SubnetworkAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private SubnetworkAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SubnetworkAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SubnetworkAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SubnetworkAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SubnetworkAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(SubnetworkAggregatedList other) { + if (other == SubnetworkAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(SubnetworkAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public SubnetworkAggregatedList build() { + + return new SubnetworkAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "SubnetworkAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SubnetworkAggregatedList) { + SubnetworkAggregatedList that = (SubnetworkAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkClient.java new file mode 100644 index 000000000000..d9231e08310a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkClient.java @@ -0,0 +1,1291 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.SubnetworkStub; +import com.google.cloud.compute.v1.stub.SubnetworkStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+ *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+ *   Operation response = subnetworkClient.deleteSubnetwork(subnetwork);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the subnetworkClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of SubnetworkSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * SubnetworkSettings subnetworkSettings =
+ *     SubnetworkSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * SubnetworkClient subnetworkClient =
+ *     SubnetworkClient.create(subnetworkSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * SubnetworkSettings subnetworkSettings =
+ *     SubnetworkSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * SubnetworkClient subnetworkClient =
+ *     SubnetworkClient.create(subnetworkSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SubnetworkClient implements BackgroundResource { + private final SubnetworkSettings settings; + private final SubnetworkStub stub; + + /** Constructs an instance of SubnetworkClient with default settings. */ + public static final SubnetworkClient create() throws IOException { + return create(SubnetworkSettings.newBuilder().build()); + } + + /** + * Constructs an instance of SubnetworkClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final SubnetworkClient create(SubnetworkSettings settings) throws IOException { + return new SubnetworkClient(settings); + } + + /** + * Constructs an instance of SubnetworkClient, using the given stub for making calls. This is for + * advanced usage - prefer to use SubnetworkSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final SubnetworkClient create(SubnetworkStub stub) { + return new SubnetworkClient(stub); + } + + /** + * Constructs an instance of SubnetworkClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected SubnetworkClient(SubnetworkSettings settings) throws IOException { + this.settings = settings; + this.stub = ((SubnetworkStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected SubnetworkClient(SubnetworkStub stub) { + this.settings = null; + this.stub = stub; + } + + public final SubnetworkSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public SubnetworkStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of subnetworks. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (SubnetworksScopedList element : subnetworkClient.aggregatedListSubnetworks(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListSubnetworksPagedResponse aggregatedListSubnetworks( + ProjectName project) { + AggregatedListSubnetworksHttpRequest request = + AggregatedListSubnetworksHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListSubnetworks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of subnetworks. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (SubnetworksScopedList element : subnetworkClient.aggregatedListSubnetworks(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListSubnetworksPagedResponse aggregatedListSubnetworks(String project) { + AggregatedListSubnetworksHttpRequest request = + AggregatedListSubnetworksHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListSubnetworks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of subnetworks. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListSubnetworksHttpRequest request = AggregatedListSubnetworksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (SubnetworksScopedList element : subnetworkClient.aggregatedListSubnetworks(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListSubnetworksPagedResponse aggregatedListSubnetworks( + AggregatedListSubnetworksHttpRequest request) { + return aggregatedListSubnetworksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of subnetworks. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListSubnetworksHttpRequest request = AggregatedListSubnetworksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListSubnetworksPagedResponse> future = subnetworkClient.aggregatedListSubnetworksPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (SubnetworksScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListSubnetworksHttpRequest, AggregatedListSubnetworksPagedResponse> + aggregatedListSubnetworksPagedCallable() { + return stub.aggregatedListSubnetworksPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of subnetworks. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListSubnetworksHttpRequest request = AggregatedListSubnetworksHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     SubnetworkAggregatedList response = subnetworkClient.aggregatedListSubnetworksCallable().call(request);
+   *     for (SubnetworksScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListSubnetworksCallable() { + return stub.aggregatedListSubnetworksCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified subnetwork. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   Operation response = subnetworkClient.deleteSubnetwork(subnetwork);
+   * }
+   * 
+ * + * @param subnetwork Name of the Subnetwork resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSubnetwork(ProjectRegionSubnetworkName subnetwork) { + + DeleteSubnetworkHttpRequest request = + DeleteSubnetworkHttpRequest.newBuilder() + .setSubnetwork(subnetwork == null ? null : subnetwork.toString()) + .build(); + return deleteSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified subnetwork. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   Operation response = subnetworkClient.deleteSubnetwork(subnetwork.toString());
+   * }
+   * 
+ * + * @param subnetwork Name of the Subnetwork resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSubnetwork(String subnetwork) { + + DeleteSubnetworkHttpRequest request = + DeleteSubnetworkHttpRequest.newBuilder().setSubnetwork(subnetwork).build(); + return deleteSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified subnetwork. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   DeleteSubnetworkHttpRequest request = DeleteSubnetworkHttpRequest.newBuilder()
+   *     .setSubnetwork(subnetwork.toString())
+   *     .build();
+   *   Operation response = subnetworkClient.deleteSubnetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteSubnetwork(DeleteSubnetworkHttpRequest request) { + return deleteSubnetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified subnetwork. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   DeleteSubnetworkHttpRequest request = DeleteSubnetworkHttpRequest.newBuilder()
+   *     .setSubnetwork(subnetwork.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = subnetworkClient.deleteSubnetworkCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteSubnetworkCallable() { + return stub.deleteSubnetworkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Expands the IP CIDR range of the subnetwork to a specified value. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource = SubnetworksExpandIpCidrRangeRequest.newBuilder().build();
+   *   Operation response = subnetworkClient.expandIpCidrRangeSubnetwork(subnetwork, subnetworksExpandIpCidrRangeRequestResource);
+   * }
+   * 
+ * + * @param subnetwork Name of the Subnetwork resource to update. + * @param subnetworksExpandIpCidrRangeRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation expandIpCidrRangeSubnetwork( + ProjectRegionSubnetworkName subnetwork, + SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource) { + + ExpandIpCidrRangeSubnetworkHttpRequest request = + ExpandIpCidrRangeSubnetworkHttpRequest.newBuilder() + .setSubnetwork(subnetwork == null ? null : subnetwork.toString()) + .setSubnetworksExpandIpCidrRangeRequestResource( + subnetworksExpandIpCidrRangeRequestResource) + .build(); + return expandIpCidrRangeSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Expands the IP CIDR range of the subnetwork to a specified value. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource = SubnetworksExpandIpCidrRangeRequest.newBuilder().build();
+   *   Operation response = subnetworkClient.expandIpCidrRangeSubnetwork(subnetwork.toString(), subnetworksExpandIpCidrRangeRequestResource);
+   * }
+   * 
+ * + * @param subnetwork Name of the Subnetwork resource to update. + * @param subnetworksExpandIpCidrRangeRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation expandIpCidrRangeSubnetwork( + String subnetwork, + SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource) { + + ExpandIpCidrRangeSubnetworkHttpRequest request = + ExpandIpCidrRangeSubnetworkHttpRequest.newBuilder() + .setSubnetwork(subnetwork) + .setSubnetworksExpandIpCidrRangeRequestResource( + subnetworksExpandIpCidrRangeRequestResource) + .build(); + return expandIpCidrRangeSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Expands the IP CIDR range of the subnetwork to a specified value. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource = SubnetworksExpandIpCidrRangeRequest.newBuilder().build();
+   *   ExpandIpCidrRangeSubnetworkHttpRequest request = ExpandIpCidrRangeSubnetworkHttpRequest.newBuilder()
+   *     .setSubnetwork(subnetwork.toString())
+   *     .setSubnetworksExpandIpCidrRangeRequestResource(subnetworksExpandIpCidrRangeRequestResource)
+   *     .build();
+   *   Operation response = subnetworkClient.expandIpCidrRangeSubnetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation expandIpCidrRangeSubnetwork( + ExpandIpCidrRangeSubnetworkHttpRequest request) { + return expandIpCidrRangeSubnetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Expands the IP CIDR range of the subnetwork to a specified value. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource = SubnetworksExpandIpCidrRangeRequest.newBuilder().build();
+   *   ExpandIpCidrRangeSubnetworkHttpRequest request = ExpandIpCidrRangeSubnetworkHttpRequest.newBuilder()
+   *     .setSubnetwork(subnetwork.toString())
+   *     .setSubnetworksExpandIpCidrRangeRequestResource(subnetworksExpandIpCidrRangeRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = subnetworkClient.expandIpCidrRangeSubnetworkCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + expandIpCidrRangeSubnetworkCallable() { + return stub.expandIpCidrRangeSubnetworkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified subnetwork. Gets a list of available subnetworks list() request. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   Subnetwork response = subnetworkClient.getSubnetwork(subnetwork);
+   * }
+   * 
+ * + * @param subnetwork Name of the Subnetwork resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Subnetwork getSubnetwork(ProjectRegionSubnetworkName subnetwork) { + + GetSubnetworkHttpRequest request = + GetSubnetworkHttpRequest.newBuilder() + .setSubnetwork(subnetwork == null ? null : subnetwork.toString()) + .build(); + return getSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified subnetwork. Gets a list of available subnetworks list() request. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   Subnetwork response = subnetworkClient.getSubnetwork(subnetwork.toString());
+   * }
+   * 
+ * + * @param subnetwork Name of the Subnetwork resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Subnetwork getSubnetwork(String subnetwork) { + + GetSubnetworkHttpRequest request = + GetSubnetworkHttpRequest.newBuilder().setSubnetwork(subnetwork).build(); + return getSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified subnetwork. Gets a list of available subnetworks list() request. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   GetSubnetworkHttpRequest request = GetSubnetworkHttpRequest.newBuilder()
+   *     .setSubnetwork(subnetwork.toString())
+   *     .build();
+   *   Subnetwork response = subnetworkClient.getSubnetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Subnetwork getSubnetwork(GetSubnetworkHttpRequest request) { + return getSubnetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified subnetwork. Gets a list of available subnetworks list() request. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   GetSubnetworkHttpRequest request = GetSubnetworkHttpRequest.newBuilder()
+   *     .setSubnetwork(subnetwork.toString())
+   *     .build();
+   *   ApiFuture<Subnetwork> future = subnetworkClient.getSubnetworkCallable().futureCall(request);
+   *   // Do something
+   *   Subnetwork response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getSubnetworkCallable() { + return stub.getSubnetworkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a subnetwork in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
+   *   Operation response = subnetworkClient.insertSubnetwork(region, subnetworkResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param subnetworkResource A Subnetwork resource. (== resource_for beta.subnetworks ==) (== + * resource_for v1.subnetworks ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertSubnetwork(ProjectRegionName region, Subnetwork subnetworkResource) { + + InsertSubnetworkHttpRequest request = + InsertSubnetworkHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setSubnetworkResource(subnetworkResource) + .build(); + return insertSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a subnetwork in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
+   *   Operation response = subnetworkClient.insertSubnetwork(region.toString(), subnetworkResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param subnetworkResource A Subnetwork resource. (== resource_for beta.subnetworks ==) (== + * resource_for v1.subnetworks ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertSubnetwork(String region, Subnetwork subnetworkResource) { + + InsertSubnetworkHttpRequest request = + InsertSubnetworkHttpRequest.newBuilder() + .setRegion(region) + .setSubnetworkResource(subnetworkResource) + .build(); + return insertSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a subnetwork in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
+   *   InsertSubnetworkHttpRequest request = InsertSubnetworkHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setSubnetworkResource(subnetworkResource)
+   *     .build();
+   *   Operation response = subnetworkClient.insertSubnetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertSubnetwork(InsertSubnetworkHttpRequest request) { + return insertSubnetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a subnetwork in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
+   *   InsertSubnetworkHttpRequest request = InsertSubnetworkHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setSubnetworkResource(subnetworkResource)
+   *     .build();
+   *   ApiFuture<Operation> future = subnetworkClient.insertSubnetworkCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertSubnetworkCallable() { + return stub.insertSubnetworkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of subnetworks available to the specified project. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Subnetwork element : subnetworkClient.listSubnetworks(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSubnetworksPagedResponse listSubnetworks(ProjectRegionName region) { + ListSubnetworksHttpRequest request = + ListSubnetworksHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listSubnetworks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of subnetworks available to the specified project. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (Subnetwork element : subnetworkClient.listSubnetworks(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSubnetworksPagedResponse listSubnetworks(String region) { + ListSubnetworksHttpRequest request = + ListSubnetworksHttpRequest.newBuilder().setRegion(region).build(); + return listSubnetworks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of subnetworks available to the specified project. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListSubnetworksHttpRequest request = ListSubnetworksHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (Subnetwork element : subnetworkClient.listSubnetworks(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListSubnetworksPagedResponse listSubnetworks(ListSubnetworksHttpRequest request) { + return listSubnetworksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of subnetworks available to the specified project. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListSubnetworksHttpRequest request = ListSubnetworksHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListSubnetworksPagedResponse> future = subnetworkClient.listSubnetworksPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Subnetwork element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listSubnetworksPagedCallable() { + return stub.listSubnetworksPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of subnetworks available to the specified project. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListSubnetworksHttpRequest request = ListSubnetworksHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     SubnetworkList response = subnetworkClient.listSubnetworksCallable().call(request);
+   *     for (Subnetwork element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listSubnetworksCallable() { + return stub.listSubnetworksCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified subnetwork with the data included in the request. Only the following + * fields within the subnetwork resource can be specified in the request: secondary_ip_range, + * allow_subnet_cidr_routes_overlap and role. It is also mandatory to specify the current + * fingeprint of the subnetwork resource being patched. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
+   *   Operation response = subnetworkClient.patchSubnetwork(subnetwork, subnetworkResource);
+   * }
+   * 
+ * + * @param subnetwork Name of the Subnetwork resource to patch. + * @param subnetworkResource A Subnetwork resource. (== resource_for beta.subnetworks ==) (== + * resource_for v1.subnetworks ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchSubnetwork( + ProjectRegionSubnetworkName subnetwork, Subnetwork subnetworkResource) { + + PatchSubnetworkHttpRequest request = + PatchSubnetworkHttpRequest.newBuilder() + .setSubnetwork(subnetwork == null ? null : subnetwork.toString()) + .setSubnetworkResource(subnetworkResource) + .build(); + return patchSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified subnetwork with the data included in the request. Only the following + * fields within the subnetwork resource can be specified in the request: secondary_ip_range, + * allow_subnet_cidr_routes_overlap and role. It is also mandatory to specify the current + * fingeprint of the subnetwork resource being patched. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
+   *   Operation response = subnetworkClient.patchSubnetwork(subnetwork.toString(), subnetworkResource);
+   * }
+   * 
+ * + * @param subnetwork Name of the Subnetwork resource to patch. + * @param subnetworkResource A Subnetwork resource. (== resource_for beta.subnetworks ==) (== + * resource_for v1.subnetworks ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchSubnetwork(String subnetwork, Subnetwork subnetworkResource) { + + PatchSubnetworkHttpRequest request = + PatchSubnetworkHttpRequest.newBuilder() + .setSubnetwork(subnetwork) + .setSubnetworkResource(subnetworkResource) + .build(); + return patchSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified subnetwork with the data included in the request. Only the following + * fields within the subnetwork resource can be specified in the request: secondary_ip_range, + * allow_subnet_cidr_routes_overlap and role. It is also mandatory to specify the current + * fingeprint of the subnetwork resource being patched. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
+   *   PatchSubnetworkHttpRequest request = PatchSubnetworkHttpRequest.newBuilder()
+   *     .setSubnetwork(subnetwork.toString())
+   *     .setSubnetworkResource(subnetworkResource)
+   *     .build();
+   *   Operation response = subnetworkClient.patchSubnetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchSubnetwork(PatchSubnetworkHttpRequest request) { + return patchSubnetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified subnetwork with the data included in the request. Only the following + * fields within the subnetwork resource can be specified in the request: secondary_ip_range, + * allow_subnet_cidr_routes_overlap and role. It is also mandatory to specify the current + * fingeprint of the subnetwork resource being patched. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
+   *   PatchSubnetworkHttpRequest request = PatchSubnetworkHttpRequest.newBuilder()
+   *     .setSubnetwork(subnetwork.toString())
+   *     .setSubnetworkResource(subnetworkResource)
+   *     .build();
+   *   ApiFuture<Operation> future = subnetworkClient.patchSubnetworkCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable patchSubnetworkCallable() { + return stub.patchSubnetworkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Set whether VMs in this subnet can access Google services without assigning external IP + * addresses through Private Google Access. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource = SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build();
+   *   Operation response = subnetworkClient.setPrivateIpGoogleAccessSubnetwork(subnetwork, subnetworksSetPrivateIpGoogleAccessRequestResource);
+   * }
+   * 
+ * + * @param subnetwork Name of the Subnetwork resource. + * @param subnetworksSetPrivateIpGoogleAccessRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setPrivateIpGoogleAccessSubnetwork( + ProjectRegionSubnetworkName subnetwork, + SubnetworksSetPrivateIpGoogleAccessRequest + subnetworksSetPrivateIpGoogleAccessRequestResource) { + + SetPrivateIpGoogleAccessSubnetworkHttpRequest request = + SetPrivateIpGoogleAccessSubnetworkHttpRequest.newBuilder() + .setSubnetwork(subnetwork == null ? null : subnetwork.toString()) + .setSubnetworksSetPrivateIpGoogleAccessRequestResource( + subnetworksSetPrivateIpGoogleAccessRequestResource) + .build(); + return setPrivateIpGoogleAccessSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Set whether VMs in this subnet can access Google services without assigning external IP + * addresses through Private Google Access. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource = SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build();
+   *   Operation response = subnetworkClient.setPrivateIpGoogleAccessSubnetwork(subnetwork.toString(), subnetworksSetPrivateIpGoogleAccessRequestResource);
+   * }
+   * 
+ * + * @param subnetwork Name of the Subnetwork resource. + * @param subnetworksSetPrivateIpGoogleAccessRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setPrivateIpGoogleAccessSubnetwork( + String subnetwork, + SubnetworksSetPrivateIpGoogleAccessRequest + subnetworksSetPrivateIpGoogleAccessRequestResource) { + + SetPrivateIpGoogleAccessSubnetworkHttpRequest request = + SetPrivateIpGoogleAccessSubnetworkHttpRequest.newBuilder() + .setSubnetwork(subnetwork) + .setSubnetworksSetPrivateIpGoogleAccessRequestResource( + subnetworksSetPrivateIpGoogleAccessRequestResource) + .build(); + return setPrivateIpGoogleAccessSubnetwork(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Set whether VMs in this subnet can access Google services without assigning external IP + * addresses through Private Google Access. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource = SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build();
+   *   SetPrivateIpGoogleAccessSubnetworkHttpRequest request = SetPrivateIpGoogleAccessSubnetworkHttpRequest.newBuilder()
+   *     .setSubnetwork(subnetwork.toString())
+   *     .setSubnetworksSetPrivateIpGoogleAccessRequestResource(subnetworksSetPrivateIpGoogleAccessRequestResource)
+   *     .build();
+   *   Operation response = subnetworkClient.setPrivateIpGoogleAccessSubnetwork(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setPrivateIpGoogleAccessSubnetwork( + SetPrivateIpGoogleAccessSubnetworkHttpRequest request) { + return setPrivateIpGoogleAccessSubnetworkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Set whether VMs in this subnet can access Google services without assigning external IP + * addresses through Private Google Access. + * + *

Sample code: + * + *


+   * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+   *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+   *   SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource = SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build();
+   *   SetPrivateIpGoogleAccessSubnetworkHttpRequest request = SetPrivateIpGoogleAccessSubnetworkHttpRequest.newBuilder()
+   *     .setSubnetwork(subnetwork.toString())
+   *     .setSubnetworksSetPrivateIpGoogleAccessRequestResource(subnetworksSetPrivateIpGoogleAccessRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = subnetworkClient.setPrivateIpGoogleAccessSubnetworkCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setPrivateIpGoogleAccessSubnetworkCallable() { + return stub.setPrivateIpGoogleAccessSubnetworkCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListSubnetworksPagedResponse + extends AbstractPagedListResponse< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, SubnetworksScopedList, + AggregatedListSubnetworksPage, AggregatedListSubnetworksFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + SubnetworksScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListSubnetworksPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public AggregatedListSubnetworksPagedResponse apply( + AggregatedListSubnetworksPage input) { + return new AggregatedListSubnetworksPagedResponse(input); + } + }); + } + + private AggregatedListSubnetworksPagedResponse(AggregatedListSubnetworksPage page) { + super(page, AggregatedListSubnetworksFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListSubnetworksPage + extends AbstractPage< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, SubnetworksScopedList, + AggregatedListSubnetworksPage> { + + private AggregatedListSubnetworksPage( + PageContext< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + SubnetworksScopedList> + context, + SubnetworkAggregatedList response) { + super(context, response); + } + + private static AggregatedListSubnetworksPage createEmptyPage() { + return new AggregatedListSubnetworksPage(null, null); + } + + @Override + protected AggregatedListSubnetworksPage createPage( + PageContext< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + SubnetworksScopedList> + context, + SubnetworkAggregatedList response) { + return new AggregatedListSubnetworksPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + SubnetworksScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListSubnetworksFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, SubnetworksScopedList, + AggregatedListSubnetworksPage, AggregatedListSubnetworksFixedSizeCollection> { + + private AggregatedListSubnetworksFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListSubnetworksFixedSizeCollection createEmptyCollection() { + return new AggregatedListSubnetworksFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListSubnetworksFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListSubnetworksFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListSubnetworksPagedResponse + extends AbstractPagedListResponse< + ListSubnetworksHttpRequest, SubnetworkList, Subnetwork, ListSubnetworksPage, + ListSubnetworksFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListSubnetworksPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListSubnetworksPagedResponse apply(ListSubnetworksPage input) { + return new ListSubnetworksPagedResponse(input); + } + }); + } + + private ListSubnetworksPagedResponse(ListSubnetworksPage page) { + super(page, ListSubnetworksFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListSubnetworksPage + extends AbstractPage< + ListSubnetworksHttpRequest, SubnetworkList, Subnetwork, ListSubnetworksPage> { + + private ListSubnetworksPage( + PageContext context, + SubnetworkList response) { + super(context, response); + } + + private static ListSubnetworksPage createEmptyPage() { + return new ListSubnetworksPage(null, null); + } + + @Override + protected ListSubnetworksPage createPage( + PageContext context, + SubnetworkList response) { + return new ListSubnetworksPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListSubnetworksFixedSizeCollection + extends AbstractFixedSizeCollection< + ListSubnetworksHttpRequest, SubnetworkList, Subnetwork, ListSubnetworksPage, + ListSubnetworksFixedSizeCollection> { + + private ListSubnetworksFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListSubnetworksFixedSizeCollection createEmptyCollection() { + return new ListSubnetworksFixedSizeCollection(null, 0); + } + + @Override + protected ListSubnetworksFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListSubnetworksFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkList.java new file mode 100644 index 000000000000..9de9d5baf1f1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SubnetworkList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private SubnetworkList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private SubnetworkList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SubnetworkList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SubnetworkList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SubnetworkList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SubnetworkList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(SubnetworkList other) { + if (other == SubnetworkList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(SubnetworkList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Subnetwork items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public SubnetworkList build() { + + return new SubnetworkList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "SubnetworkList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SubnetworkList) { + SubnetworkList that = (SubnetworkList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkSecondaryRange.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkSecondaryRange.java new file mode 100644 index 000000000000..eb0308bdfc60 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkSecondaryRange.java @@ -0,0 +1,175 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SubnetworkSecondaryRange implements ApiMessage { + private final String ipCidrRange; + private final String rangeName; + + private SubnetworkSecondaryRange() { + this.ipCidrRange = null; + this.rangeName = null; + } + + private SubnetworkSecondaryRange(String ipCidrRange, String rangeName) { + this.ipCidrRange = ipCidrRange; + this.rangeName = rangeName; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("ipCidrRange")) { + return ipCidrRange; + } + if (fieldName.equals("rangeName")) { + return rangeName; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getIpCidrRange() { + return ipCidrRange; + } + + public String getRangeName() { + return rangeName; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SubnetworkSecondaryRange prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SubnetworkSecondaryRange getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SubnetworkSecondaryRange DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SubnetworkSecondaryRange(); + } + + public static class Builder { + private String ipCidrRange; + private String rangeName; + + Builder() {} + + public Builder mergeFrom(SubnetworkSecondaryRange other) { + if (other == SubnetworkSecondaryRange.getDefaultInstance()) return this; + if (other.getIpCidrRange() != null) { + this.ipCidrRange = other.ipCidrRange; + } + if (other.getRangeName() != null) { + this.rangeName = other.rangeName; + } + return this; + } + + Builder(SubnetworkSecondaryRange source) { + this.ipCidrRange = source.ipCidrRange; + this.rangeName = source.rangeName; + } + + public String getIpCidrRange() { + return ipCidrRange; + } + + public Builder setIpCidrRange(String ipCidrRange) { + this.ipCidrRange = ipCidrRange; + return this; + } + + public String getRangeName() { + return rangeName; + } + + public Builder setRangeName(String rangeName) { + this.rangeName = rangeName; + return this; + } + + public SubnetworkSecondaryRange build() { + + return new SubnetworkSecondaryRange(ipCidrRange, rangeName); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setIpCidrRange(this.ipCidrRange); + newBuilder.setRangeName(this.rangeName); + return newBuilder; + } + } + + @Override + public String toString() { + return "SubnetworkSecondaryRange{" + + "ipCidrRange=" + + ipCidrRange + + ", " + + "rangeName=" + + rangeName + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SubnetworkSecondaryRange) { + SubnetworkSecondaryRange that = (SubnetworkSecondaryRange) o; + return Objects.equals(this.ipCidrRange, that.getIpCidrRange()) + && Objects.equals(this.rangeName, that.getRangeName()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(ipCidrRange, rangeName); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkSettings.java new file mode 100644 index 000000000000..f3de6c182ebe --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworkSettings.java @@ -0,0 +1,272 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.SubnetworkClient.AggregatedListSubnetworksPagedResponse; +import static com.google.cloud.compute.v1.SubnetworkClient.ListSubnetworksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.SubnetworkStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link SubnetworkClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteSubnetwork to 30 seconds: + * + *

+ * 
+ * SubnetworkSettings.Builder subnetworkSettingsBuilder =
+ *     SubnetworkSettings.newBuilder();
+ * subnetworkSettingsBuilder.deleteSubnetworkSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * SubnetworkSettings subnetworkSettings = subnetworkSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SubnetworkSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListSubnetworks. */ + public PagedCallSettings< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + AggregatedListSubnetworksPagedResponse> + aggregatedListSubnetworksSettings() { + return ((SubnetworkStubSettings) getStubSettings()).aggregatedListSubnetworksSettings(); + } + + /** Returns the object with the settings used for calls to deleteSubnetwork. */ + public UnaryCallSettings deleteSubnetworkSettings() { + return ((SubnetworkStubSettings) getStubSettings()).deleteSubnetworkSettings(); + } + + /** Returns the object with the settings used for calls to expandIpCidrRangeSubnetwork. */ + public UnaryCallSettings + expandIpCidrRangeSubnetworkSettings() { + return ((SubnetworkStubSettings) getStubSettings()).expandIpCidrRangeSubnetworkSettings(); + } + + /** Returns the object with the settings used for calls to getSubnetwork. */ + public UnaryCallSettings getSubnetworkSettings() { + return ((SubnetworkStubSettings) getStubSettings()).getSubnetworkSettings(); + } + + /** Returns the object with the settings used for calls to insertSubnetwork. */ + public UnaryCallSettings insertSubnetworkSettings() { + return ((SubnetworkStubSettings) getStubSettings()).insertSubnetworkSettings(); + } + + /** Returns the object with the settings used for calls to listSubnetworks. */ + public PagedCallSettings + listSubnetworksSettings() { + return ((SubnetworkStubSettings) getStubSettings()).listSubnetworksSettings(); + } + + /** Returns the object with the settings used for calls to patchSubnetwork. */ + public UnaryCallSettings patchSubnetworkSettings() { + return ((SubnetworkStubSettings) getStubSettings()).patchSubnetworkSettings(); + } + + /** Returns the object with the settings used for calls to setPrivateIpGoogleAccessSubnetwork. */ + public UnaryCallSettings + setPrivateIpGoogleAccessSubnetworkSettings() { + return ((SubnetworkStubSettings) getStubSettings()) + .setPrivateIpGoogleAccessSubnetworkSettings(); + } + + public static final SubnetworkSettings create(SubnetworkStubSettings stub) throws IOException { + return new SubnetworkSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return SubnetworkStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return SubnetworkStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return SubnetworkStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return SubnetworkStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return SubnetworkStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return SubnetworkStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return SubnetworkStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SubnetworkStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SubnetworkSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for SubnetworkSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(SubnetworkStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(SubnetworkStubSettings.newBuilder()); + } + + protected Builder(SubnetworkSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(SubnetworkStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public SubnetworkStubSettings.Builder getStubSettingsBuilder() { + return ((SubnetworkStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListSubnetworks. */ + public PagedCallSettings.Builder< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + AggregatedListSubnetworksPagedResponse> + aggregatedListSubnetworksSettings() { + return getStubSettingsBuilder().aggregatedListSubnetworksSettings(); + } + + /** Returns the builder for the settings used for calls to deleteSubnetwork. */ + public UnaryCallSettings.Builder + deleteSubnetworkSettings() { + return getStubSettingsBuilder().deleteSubnetworkSettings(); + } + + /** Returns the builder for the settings used for calls to expandIpCidrRangeSubnetwork. */ + public UnaryCallSettings.Builder + expandIpCidrRangeSubnetworkSettings() { + return getStubSettingsBuilder().expandIpCidrRangeSubnetworkSettings(); + } + + /** Returns the builder for the settings used for calls to getSubnetwork. */ + public UnaryCallSettings.Builder getSubnetworkSettings() { + return getStubSettingsBuilder().getSubnetworkSettings(); + } + + /** Returns the builder for the settings used for calls to insertSubnetwork. */ + public UnaryCallSettings.Builder + insertSubnetworkSettings() { + return getStubSettingsBuilder().insertSubnetworkSettings(); + } + + /** Returns the builder for the settings used for calls to listSubnetworks. */ + public PagedCallSettings.Builder< + ListSubnetworksHttpRequest, SubnetworkList, ListSubnetworksPagedResponse> + listSubnetworksSettings() { + return getStubSettingsBuilder().listSubnetworksSettings(); + } + + /** Returns the builder for the settings used for calls to patchSubnetwork. */ + public UnaryCallSettings.Builder + patchSubnetworkSettings() { + return getStubSettingsBuilder().patchSubnetworkSettings(); + } + + /** + * Returns the builder for the settings used for calls to setPrivateIpGoogleAccessSubnetwork. + */ + public UnaryCallSettings.Builder + setPrivateIpGoogleAccessSubnetworkSettings() { + return getStubSettingsBuilder().setPrivateIpGoogleAccessSubnetworkSettings(); + } + + @Override + public SubnetworkSettings build() throws IOException { + return new SubnetworkSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworksExpandIpCidrRangeRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworksExpandIpCidrRangeRequest.java new file mode 100644 index 000000000000..ae59ff1ad14a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworksExpandIpCidrRangeRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SubnetworksExpandIpCidrRangeRequest implements ApiMessage { + private final String ipCidrRange; + + private SubnetworksExpandIpCidrRangeRequest() { + this.ipCidrRange = null; + } + + private SubnetworksExpandIpCidrRangeRequest(String ipCidrRange) { + this.ipCidrRange = ipCidrRange; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("ipCidrRange")) { + return ipCidrRange; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getIpCidrRange() { + return ipCidrRange; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SubnetworksExpandIpCidrRangeRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SubnetworksExpandIpCidrRangeRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SubnetworksExpandIpCidrRangeRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SubnetworksExpandIpCidrRangeRequest(); + } + + public static class Builder { + private String ipCidrRange; + + Builder() {} + + public Builder mergeFrom(SubnetworksExpandIpCidrRangeRequest other) { + if (other == SubnetworksExpandIpCidrRangeRequest.getDefaultInstance()) return this; + if (other.getIpCidrRange() != null) { + this.ipCidrRange = other.ipCidrRange; + } + return this; + } + + Builder(SubnetworksExpandIpCidrRangeRequest source) { + this.ipCidrRange = source.ipCidrRange; + } + + public String getIpCidrRange() { + return ipCidrRange; + } + + public Builder setIpCidrRange(String ipCidrRange) { + this.ipCidrRange = ipCidrRange; + return this; + } + + public SubnetworksExpandIpCidrRangeRequest build() { + return new SubnetworksExpandIpCidrRangeRequest(ipCidrRange); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setIpCidrRange(this.ipCidrRange); + return newBuilder; + } + } + + @Override + public String toString() { + return "SubnetworksExpandIpCidrRangeRequest{" + "ipCidrRange=" + ipCidrRange + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SubnetworksExpandIpCidrRangeRequest) { + SubnetworksExpandIpCidrRangeRequest that = (SubnetworksExpandIpCidrRangeRequest) o; + return Objects.equals(this.ipCidrRange, that.getIpCidrRange()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(ipCidrRange); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworksScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworksScopedList.java new file mode 100644 index 000000000000..5bfb6e7c1222 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworksScopedList.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SubnetworksScopedList implements ApiMessage { + private final List subnetworks; + private final Warning warning; + + private SubnetworksScopedList() { + this.subnetworks = null; + this.warning = null; + } + + private SubnetworksScopedList(List subnetworks, Warning warning) { + this.subnetworks = subnetworks; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("subnetworks")) { + return subnetworks; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getSubnetworksList() { + return subnetworks; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SubnetworksScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SubnetworksScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SubnetworksScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SubnetworksScopedList(); + } + + public static class Builder { + private List subnetworks; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(SubnetworksScopedList other) { + if (other == SubnetworksScopedList.getDefaultInstance()) return this; + if (other.getSubnetworksList() != null) { + this.subnetworks = other.subnetworks; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(SubnetworksScopedList source) { + this.subnetworks = source.subnetworks; + this.warning = source.warning; + } + + public List getSubnetworksList() { + return subnetworks; + } + + public Builder addAllSubnetworks(List subnetworks) { + if (this.subnetworks == null) { + this.subnetworks = new ArrayList<>(subnetworks.size()); + } + this.subnetworks.addAll(subnetworks); + return this; + } + + public Builder addSubnetworks(Subnetwork subnetworks) { + this.subnetworks.add(subnetworks); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public SubnetworksScopedList build() { + + return new SubnetworksScopedList(subnetworks, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllSubnetworks(this.subnetworks); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "SubnetworksScopedList{" + + "subnetworks=" + + subnetworks + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SubnetworksScopedList) { + SubnetworksScopedList that = (SubnetworksScopedList) o; + return Objects.equals(this.subnetworks, that.getSubnetworksList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(subnetworks, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworksSetPrivateIpGoogleAccessRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworksSetPrivateIpGoogleAccessRequest.java new file mode 100644 index 000000000000..e58dad72c307 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SubnetworksSetPrivateIpGoogleAccessRequest.java @@ -0,0 +1,146 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SubnetworksSetPrivateIpGoogleAccessRequest implements ApiMessage { + private final Boolean privateIpGoogleAccess; + + private SubnetworksSetPrivateIpGoogleAccessRequest() { + this.privateIpGoogleAccess = null; + } + + private SubnetworksSetPrivateIpGoogleAccessRequest(Boolean privateIpGoogleAccess) { + this.privateIpGoogleAccess = privateIpGoogleAccess; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("privateIpGoogleAccess")) { + return privateIpGoogleAccess; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getPrivateIpGoogleAccess() { + return privateIpGoogleAccess; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SubnetworksSetPrivateIpGoogleAccessRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SubnetworksSetPrivateIpGoogleAccessRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SubnetworksSetPrivateIpGoogleAccessRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SubnetworksSetPrivateIpGoogleAccessRequest(); + } + + public static class Builder { + private Boolean privateIpGoogleAccess; + + Builder() {} + + public Builder mergeFrom(SubnetworksSetPrivateIpGoogleAccessRequest other) { + if (other == SubnetworksSetPrivateIpGoogleAccessRequest.getDefaultInstance()) return this; + if (other.getPrivateIpGoogleAccess() != null) { + this.privateIpGoogleAccess = other.privateIpGoogleAccess; + } + return this; + } + + Builder(SubnetworksSetPrivateIpGoogleAccessRequest source) { + this.privateIpGoogleAccess = source.privateIpGoogleAccess; + } + + public Boolean getPrivateIpGoogleAccess() { + return privateIpGoogleAccess; + } + + public Builder setPrivateIpGoogleAccess(Boolean privateIpGoogleAccess) { + this.privateIpGoogleAccess = privateIpGoogleAccess; + return this; + } + + public SubnetworksSetPrivateIpGoogleAccessRequest build() { + return new SubnetworksSetPrivateIpGoogleAccessRequest(privateIpGoogleAccess); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setPrivateIpGoogleAccess(this.privateIpGoogleAccess); + return newBuilder; + } + } + + @Override + public String toString() { + return "SubnetworksSetPrivateIpGoogleAccessRequest{" + + "privateIpGoogleAccess=" + + privateIpGoogleAccess + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SubnetworksSetPrivateIpGoogleAccessRequest) { + SubnetworksSetPrivateIpGoogleAccessRequest that = + (SubnetworksSetPrivateIpGoogleAccessRequest) o; + return Objects.equals(this.privateIpGoogleAccess, that.getPrivateIpGoogleAccess()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(privateIpGoogleAccess); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SwitchToCustomModeNetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SwitchToCustomModeNetworkHttpRequest.java new file mode 100644 index 000000000000..3d4356db6fef --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SwitchToCustomModeNetworkHttpRequest.java @@ -0,0 +1,397 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SwitchToCustomModeNetworkHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String network; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private SwitchToCustomModeNetworkHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.network = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private SwitchToCustomModeNetworkHttpRequest( + String access_token, + String callback, + String fields, + String key, + String network, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.network = network; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getNetwork() { + return network; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SwitchToCustomModeNetworkHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SwitchToCustomModeNetworkHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SwitchToCustomModeNetworkHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SwitchToCustomModeNetworkHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String network; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(SwitchToCustomModeNetworkHttpRequest other) { + if (other == SwitchToCustomModeNetworkHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(SwitchToCustomModeNetworkHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.network = source.network; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public SwitchToCustomModeNetworkHttpRequest build() { + String missing = ""; + + if (network == null) { + missing += " network"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new SwitchToCustomModeNetworkHttpRequest( + access_token, callback, fields, key, network, prettyPrint, quotaUser, requestId, userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setNetwork(this.network); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "SwitchToCustomModeNetworkHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "network=" + + network + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SwitchToCustomModeNetworkHttpRequest) { + SwitchToCustomModeNetworkHttpRequest that = (SwitchToCustomModeNetworkHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, callback, fields, key, network, prettyPrint, quotaUser, requestId, userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TCPHealthCheck.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TCPHealthCheck.java new file mode 100644 index 000000000000..81500de7a425 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TCPHealthCheck.java @@ -0,0 +1,263 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TCPHealthCheck implements ApiMessage { + private final Integer port; + private final String portName; + private final String proxyHeader; + private final String request; + private final String response; + + private TCPHealthCheck() { + this.port = null; + this.portName = null; + this.proxyHeader = null; + this.request = null; + this.response = null; + } + + private TCPHealthCheck( + Integer port, String portName, String proxyHeader, String request, String response) { + this.port = port; + this.portName = portName; + this.proxyHeader = proxyHeader; + this.request = request; + this.response = response; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("port")) { + return port; + } + if (fieldName.equals("portName")) { + return portName; + } + if (fieldName.equals("proxyHeader")) { + return proxyHeader; + } + if (fieldName.equals("request")) { + return request; + } + if (fieldName.equals("response")) { + return response; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Integer getPort() { + return port; + } + + public String getPortName() { + return portName; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public String getRequest() { + return request; + } + + public String getResponse() { + return response; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TCPHealthCheck prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TCPHealthCheck getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TCPHealthCheck DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TCPHealthCheck(); + } + + public static class Builder { + private Integer port; + private String portName; + private String proxyHeader; + private String request; + private String response; + + Builder() {} + + public Builder mergeFrom(TCPHealthCheck other) { + if (other == TCPHealthCheck.getDefaultInstance()) return this; + if (other.getPort() != null) { + this.port = other.port; + } + if (other.getPortName() != null) { + this.portName = other.portName; + } + if (other.getProxyHeader() != null) { + this.proxyHeader = other.proxyHeader; + } + if (other.getRequest() != null) { + this.request = other.request; + } + if (other.getResponse() != null) { + this.response = other.response; + } + return this; + } + + Builder(TCPHealthCheck source) { + this.port = source.port; + this.portName = source.portName; + this.proxyHeader = source.proxyHeader; + this.request = source.request; + this.response = source.response; + } + + public Integer getPort() { + return port; + } + + public Builder setPort(Integer port) { + this.port = port; + return this; + } + + public String getPortName() { + return portName; + } + + public Builder setPortName(String portName) { + this.portName = portName; + return this; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public Builder setProxyHeader(String proxyHeader) { + this.proxyHeader = proxyHeader; + return this; + } + + public String getRequest() { + return request; + } + + public Builder setRequest(String request) { + this.request = request; + return this; + } + + public String getResponse() { + return response; + } + + public Builder setResponse(String response) { + this.response = response; + return this; + } + + public TCPHealthCheck build() { + + return new TCPHealthCheck(port, portName, proxyHeader, request, response); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setPort(this.port); + newBuilder.setPortName(this.portName); + newBuilder.setProxyHeader(this.proxyHeader); + newBuilder.setRequest(this.request); + newBuilder.setResponse(this.response); + return newBuilder; + } + } + + @Override + public String toString() { + return "TCPHealthCheck{" + + "port=" + + port + + ", " + + "portName=" + + portName + + ", " + + "proxyHeader=" + + proxyHeader + + ", " + + "request=" + + request + + ", " + + "response=" + + response + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TCPHealthCheck) { + TCPHealthCheck that = (TCPHealthCheck) o; + return Objects.equals(this.port, that.getPort()) + && Objects.equals(this.portName, that.getPortName()) + && Objects.equals(this.proxyHeader, that.getProxyHeader()) + && Objects.equals(this.request, that.getRequest()) + && Objects.equals(this.response, that.getResponse()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(port, portName, proxyHeader, request, response); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Tags.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Tags.java new file mode 100644 index 000000000000..ef6f6e0a939b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Tags.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Tags implements ApiMessage { + private final String fingerprint; + private final List items; + + private Tags() { + this.fingerprint = null; + this.items = null; + } + + private Tags(String fingerprint, List items) { + this.fingerprint = fingerprint; + this.items = items; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("items")) { + return items; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getFingerprint() { + return fingerprint; + } + + public List getItemsList() { + return items; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Tags prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Tags getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Tags DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Tags(); + } + + public static class Builder { + private String fingerprint; + private List items; + + Builder() {} + + public Builder mergeFrom(Tags other) { + if (other == Tags.getDefaultInstance()) return this; + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + return this; + } + + Builder(Tags source) { + this.fingerprint = source.fingerprint; + this.items = source.items; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(String items) { + this.items.add(items); + return this; + } + + public Tags build() { + + return new Tags(fingerprint, items); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.addAllItems(this.items); + return newBuilder; + } + } + + @Override + public String toString() { + return "Tags{" + "fingerprint=" + fingerprint + ", " + "items=" + items + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Tags) { + Tags that = (Tags) o; + return Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.items, that.getItemsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(fingerprint, items); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxy.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxy.java new file mode 100644 index 000000000000..8671056aade1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxy.java @@ -0,0 +1,327 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetHttpProxy implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String id; + private final String kind; + private final String name; + private final String selfLink; + private final String urlMap; + + private TargetHttpProxy() { + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.kind = null; + this.name = null; + this.selfLink = null; + this.urlMap = null; + } + + private TargetHttpProxy( + String creationTimestamp, + String description, + String id, + String kind, + String name, + String selfLink, + String urlMap) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.kind = kind; + this.name = name; + this.selfLink = selfLink; + this.urlMap = urlMap; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("urlMap")) { + return urlMap; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getSelfLink() { + return selfLink; + } + + public String getUrlMap() { + return urlMap; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetHttpProxy prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetHttpProxy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetHttpProxy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetHttpProxy(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String id; + private String kind; + private String name; + private String selfLink; + private String urlMap; + + Builder() {} + + public Builder mergeFrom(TargetHttpProxy other) { + if (other == TargetHttpProxy.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getUrlMap() != null) { + this.urlMap = other.urlMap; + } + return this; + } + + Builder(TargetHttpProxy source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.selfLink = source.selfLink; + this.urlMap = source.urlMap; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getUrlMap() { + return urlMap; + } + + public Builder setUrlMap(String urlMap) { + this.urlMap = urlMap; + return this; + } + + public TargetHttpProxy build() { + + return new TargetHttpProxy(creationTimestamp, description, id, kind, name, selfLink, urlMap); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setUrlMap(this.urlMap); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetHttpProxy{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "selfLink=" + + selfLink + + ", " + + "urlMap=" + + urlMap + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetHttpProxy) { + TargetHttpProxy that = (TargetHttpProxy) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.urlMap, that.getUrlMap()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(creationTimestamp, description, id, kind, name, selfLink, urlMap); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxyClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxyClient.java new file mode 100644 index 000000000000..c75e97f2647f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxyClient.java @@ -0,0 +1,830 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.TargetHttpProxyStub; +import com.google.cloud.compute.v1.stub.TargetHttpProxyStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+ *   ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+ *   Operation response = targetHttpProxyClient.deleteTargetHttpProxy(targetHttpProxy);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the targetHttpProxyClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of TargetHttpProxySettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * TargetHttpProxySettings targetHttpProxySettings =
+ *     TargetHttpProxySettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * TargetHttpProxyClient targetHttpProxyClient =
+ *     TargetHttpProxyClient.create(targetHttpProxySettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * TargetHttpProxySettings targetHttpProxySettings =
+ *     TargetHttpProxySettings.newBuilder().setEndpoint(myEndpoint).build();
+ * TargetHttpProxyClient targetHttpProxyClient =
+ *     TargetHttpProxyClient.create(targetHttpProxySettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetHttpProxyClient implements BackgroundResource { + private final TargetHttpProxySettings settings; + private final TargetHttpProxyStub stub; + + /** Constructs an instance of TargetHttpProxyClient with default settings. */ + public static final TargetHttpProxyClient create() throws IOException { + return create(TargetHttpProxySettings.newBuilder().build()); + } + + /** + * Constructs an instance of TargetHttpProxyClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final TargetHttpProxyClient create(TargetHttpProxySettings settings) + throws IOException { + return new TargetHttpProxyClient(settings); + } + + /** + * Constructs an instance of TargetHttpProxyClient, using the given stub for making calls. This is + * for advanced usage - prefer to use TargetHttpProxySettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final TargetHttpProxyClient create(TargetHttpProxyStub stub) { + return new TargetHttpProxyClient(stub); + } + + /** + * Constructs an instance of TargetHttpProxyClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected TargetHttpProxyClient(TargetHttpProxySettings settings) throws IOException { + this.settings = settings; + this.stub = ((TargetHttpProxyStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected TargetHttpProxyClient(TargetHttpProxyStub stub) { + this.settings = null; + this.stub = stub; + } + + public final TargetHttpProxySettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetHttpProxyStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetHttpProxy resource. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   Operation response = targetHttpProxyClient.deleteTargetHttpProxy(targetHttpProxy);
+   * }
+   * 
+ * + * @param targetHttpProxy Name of the TargetHttpProxy resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetHttpProxy(ProjectGlobalTargetHttpProxyName targetHttpProxy) { + + DeleteTargetHttpProxyHttpRequest request = + DeleteTargetHttpProxyHttpRequest.newBuilder() + .setTargetHttpProxy(targetHttpProxy == null ? null : targetHttpProxy.toString()) + .build(); + return deleteTargetHttpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetHttpProxy resource. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   Operation response = targetHttpProxyClient.deleteTargetHttpProxy(targetHttpProxy.toString());
+   * }
+   * 
+ * + * @param targetHttpProxy Name of the TargetHttpProxy resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetHttpProxy(String targetHttpProxy) { + + DeleteTargetHttpProxyHttpRequest request = + DeleteTargetHttpProxyHttpRequest.newBuilder().setTargetHttpProxy(targetHttpProxy).build(); + return deleteTargetHttpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetHttpProxy resource. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   DeleteTargetHttpProxyHttpRequest request = DeleteTargetHttpProxyHttpRequest.newBuilder()
+   *     .setTargetHttpProxy(targetHttpProxy.toString())
+   *     .build();
+   *   Operation response = targetHttpProxyClient.deleteTargetHttpProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetHttpProxy(DeleteTargetHttpProxyHttpRequest request) { + return deleteTargetHttpProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetHttpProxy resource. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   DeleteTargetHttpProxyHttpRequest request = DeleteTargetHttpProxyHttpRequest.newBuilder()
+   *     .setTargetHttpProxy(targetHttpProxy.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = targetHttpProxyClient.deleteTargetHttpProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteTargetHttpProxyCallable() { + return stub.deleteTargetHttpProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetHttpProxy resource. Gets a list of available target HTTP proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   TargetHttpProxy response = targetHttpProxyClient.getTargetHttpProxy(targetHttpProxy);
+   * }
+   * 
+ * + * @param targetHttpProxy Name of the TargetHttpProxy resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetHttpProxy getTargetHttpProxy( + ProjectGlobalTargetHttpProxyName targetHttpProxy) { + + GetTargetHttpProxyHttpRequest request = + GetTargetHttpProxyHttpRequest.newBuilder() + .setTargetHttpProxy(targetHttpProxy == null ? null : targetHttpProxy.toString()) + .build(); + return getTargetHttpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetHttpProxy resource. Gets a list of available target HTTP proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   TargetHttpProxy response = targetHttpProxyClient.getTargetHttpProxy(targetHttpProxy.toString());
+   * }
+   * 
+ * + * @param targetHttpProxy Name of the TargetHttpProxy resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetHttpProxy getTargetHttpProxy(String targetHttpProxy) { + + GetTargetHttpProxyHttpRequest request = + GetTargetHttpProxyHttpRequest.newBuilder().setTargetHttpProxy(targetHttpProxy).build(); + return getTargetHttpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetHttpProxy resource. Gets a list of available target HTTP proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   GetTargetHttpProxyHttpRequest request = GetTargetHttpProxyHttpRequest.newBuilder()
+   *     .setTargetHttpProxy(targetHttpProxy.toString())
+   *     .build();
+   *   TargetHttpProxy response = targetHttpProxyClient.getTargetHttpProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetHttpProxy getTargetHttpProxy(GetTargetHttpProxyHttpRequest request) { + return getTargetHttpProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetHttpProxy resource. Gets a list of available target HTTP proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   GetTargetHttpProxyHttpRequest request = GetTargetHttpProxyHttpRequest.newBuilder()
+   *     .setTargetHttpProxy(targetHttpProxy.toString())
+   *     .build();
+   *   ApiFuture<TargetHttpProxy> future = targetHttpProxyClient.getTargetHttpProxyCallable().futureCall(request);
+   *   // Do something
+   *   TargetHttpProxy response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getTargetHttpProxyCallable() { + return stub.getTargetHttpProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetHttpProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetHttpProxy targetHttpProxyResource = TargetHttpProxy.newBuilder().build();
+   *   Operation response = targetHttpProxyClient.insertTargetHttpProxy(project, targetHttpProxyResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param targetHttpProxyResource A TargetHttpProxy resource. This resource defines an HTTP proxy. + * (== resource_for beta.targetHttpProxies ==) (== resource_for v1.targetHttpProxies ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetHttpProxy( + ProjectName project, TargetHttpProxy targetHttpProxyResource) { + + InsertTargetHttpProxyHttpRequest request = + InsertTargetHttpProxyHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setTargetHttpProxyResource(targetHttpProxyResource) + .build(); + return insertTargetHttpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetHttpProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetHttpProxy targetHttpProxyResource = TargetHttpProxy.newBuilder().build();
+   *   Operation response = targetHttpProxyClient.insertTargetHttpProxy(project.toString(), targetHttpProxyResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param targetHttpProxyResource A TargetHttpProxy resource. This resource defines an HTTP proxy. + * (== resource_for beta.targetHttpProxies ==) (== resource_for v1.targetHttpProxies ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetHttpProxy( + String project, TargetHttpProxy targetHttpProxyResource) { + + InsertTargetHttpProxyHttpRequest request = + InsertTargetHttpProxyHttpRequest.newBuilder() + .setProject(project) + .setTargetHttpProxyResource(targetHttpProxyResource) + .build(); + return insertTargetHttpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetHttpProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetHttpProxy targetHttpProxyResource = TargetHttpProxy.newBuilder().build();
+   *   InsertTargetHttpProxyHttpRequest request = InsertTargetHttpProxyHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setTargetHttpProxyResource(targetHttpProxyResource)
+   *     .build();
+   *   Operation response = targetHttpProxyClient.insertTargetHttpProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetHttpProxy(InsertTargetHttpProxyHttpRequest request) { + return insertTargetHttpProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetHttpProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetHttpProxy targetHttpProxyResource = TargetHttpProxy.newBuilder().build();
+   *   InsertTargetHttpProxyHttpRequest request = InsertTargetHttpProxyHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setTargetHttpProxyResource(targetHttpProxyResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetHttpProxyClient.insertTargetHttpProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertTargetHttpProxyCallable() { + return stub.insertTargetHttpProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetHttpProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetHttpProxy element : targetHttpProxyClient.listTargetHttpProxies(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetHttpProxiesPagedResponse listTargetHttpProxies(ProjectName project) { + ListTargetHttpProxiesHttpRequest request = + ListTargetHttpProxiesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listTargetHttpProxies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetHttpProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetHttpProxy element : targetHttpProxyClient.listTargetHttpProxies(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetHttpProxiesPagedResponse listTargetHttpProxies(String project) { + ListTargetHttpProxiesHttpRequest request = + ListTargetHttpProxiesHttpRequest.newBuilder().setProject(project).build(); + return listTargetHttpProxies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetHttpProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetHttpProxiesHttpRequest request = ListTargetHttpProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (TargetHttpProxy element : targetHttpProxyClient.listTargetHttpProxies(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetHttpProxiesPagedResponse listTargetHttpProxies( + ListTargetHttpProxiesHttpRequest request) { + return listTargetHttpProxiesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetHttpProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetHttpProxiesHttpRequest request = ListTargetHttpProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListTargetHttpProxiesPagedResponse> future = targetHttpProxyClient.listTargetHttpProxiesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (TargetHttpProxy element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetHttpProxiesPagedCallable() { + return stub.listTargetHttpProxiesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetHttpProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetHttpProxiesHttpRequest request = ListTargetHttpProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     TargetHttpProxyList response = targetHttpProxyClient.listTargetHttpProxiesCallable().call(request);
+   *     for (TargetHttpProxy element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetHttpProxiesCallable() { + return stub.listTargetHttpProxiesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the URL map for TargetHttpProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectTargetHttpProxyName targetHttpProxy = ProjectTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
+   *   Operation response = targetHttpProxyClient.setUrlMapTargetHttpProxy(targetHttpProxy, urlMapReferenceResource);
+   * }
+   * 
+ * + * @param targetHttpProxy Name of the TargetHttpProxy to set a URL map for. + * @param urlMapReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setUrlMapTargetHttpProxy( + ProjectTargetHttpProxyName targetHttpProxy, UrlMapReference urlMapReferenceResource) { + + SetUrlMapTargetHttpProxyHttpRequest request = + SetUrlMapTargetHttpProxyHttpRequest.newBuilder() + .setTargetHttpProxy(targetHttpProxy == null ? null : targetHttpProxy.toString()) + .setUrlMapReferenceResource(urlMapReferenceResource) + .build(); + return setUrlMapTargetHttpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the URL map for TargetHttpProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectTargetHttpProxyName targetHttpProxy = ProjectTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
+   *   Operation response = targetHttpProxyClient.setUrlMapTargetHttpProxy(targetHttpProxy.toString(), urlMapReferenceResource);
+   * }
+   * 
+ * + * @param targetHttpProxy Name of the TargetHttpProxy to set a URL map for. + * @param urlMapReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setUrlMapTargetHttpProxy( + String targetHttpProxy, UrlMapReference urlMapReferenceResource) { + + SetUrlMapTargetHttpProxyHttpRequest request = + SetUrlMapTargetHttpProxyHttpRequest.newBuilder() + .setTargetHttpProxy(targetHttpProxy) + .setUrlMapReferenceResource(urlMapReferenceResource) + .build(); + return setUrlMapTargetHttpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the URL map for TargetHttpProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectTargetHttpProxyName targetHttpProxy = ProjectTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
+   *   SetUrlMapTargetHttpProxyHttpRequest request = SetUrlMapTargetHttpProxyHttpRequest.newBuilder()
+   *     .setTargetHttpProxy(targetHttpProxy.toString())
+   *     .setUrlMapReferenceResource(urlMapReferenceResource)
+   *     .build();
+   *   Operation response = targetHttpProxyClient.setUrlMapTargetHttpProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setUrlMapTargetHttpProxy(SetUrlMapTargetHttpProxyHttpRequest request) { + return setUrlMapTargetHttpProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the URL map for TargetHttpProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+   *   ProjectTargetHttpProxyName targetHttpProxy = ProjectTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+   *   UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
+   *   SetUrlMapTargetHttpProxyHttpRequest request = SetUrlMapTargetHttpProxyHttpRequest.newBuilder()
+   *     .setTargetHttpProxy(targetHttpProxy.toString())
+   *     .setUrlMapReferenceResource(urlMapReferenceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetHttpProxyClient.setUrlMapTargetHttpProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setUrlMapTargetHttpProxyCallable() { + return stub.setUrlMapTargetHttpProxyCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListTargetHttpProxiesPagedResponse + extends AbstractPagedListResponse< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, TargetHttpProxy, + ListTargetHttpProxiesPage, ListTargetHttpProxiesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListTargetHttpProxiesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListTargetHttpProxiesPagedResponse apply(ListTargetHttpProxiesPage input) { + return new ListTargetHttpProxiesPagedResponse(input); + } + }); + } + + private ListTargetHttpProxiesPagedResponse(ListTargetHttpProxiesPage page) { + super(page, ListTargetHttpProxiesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListTargetHttpProxiesPage + extends AbstractPage< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, TargetHttpProxy, + ListTargetHttpProxiesPage> { + + private ListTargetHttpProxiesPage( + PageContext context, + TargetHttpProxyList response) { + super(context, response); + } + + private static ListTargetHttpProxiesPage createEmptyPage() { + return new ListTargetHttpProxiesPage(null, null); + } + + @Override + protected ListTargetHttpProxiesPage createPage( + PageContext context, + TargetHttpProxyList response) { + return new ListTargetHttpProxiesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListTargetHttpProxiesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, TargetHttpProxy, + ListTargetHttpProxiesPage, ListTargetHttpProxiesFixedSizeCollection> { + + private ListTargetHttpProxiesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListTargetHttpProxiesFixedSizeCollection createEmptyCollection() { + return new ListTargetHttpProxiesFixedSizeCollection(null, 0); + } + + @Override + protected ListTargetHttpProxiesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListTargetHttpProxiesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxyList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxyList.java new file mode 100644 index 000000000000..550e9be4b4c6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxyList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetHttpProxyList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private TargetHttpProxyList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private TargetHttpProxyList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetHttpProxyList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetHttpProxyList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetHttpProxyList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetHttpProxyList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetHttpProxyList other) { + if (other == TargetHttpProxyList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetHttpProxyList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(TargetHttpProxy items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetHttpProxyList build() { + + return new TargetHttpProxyList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetHttpProxyList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetHttpProxyList) { + TargetHttpProxyList that = (TargetHttpProxyList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxySettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxySettings.java new file mode 100644 index 000000000000..23a7cc18d85e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpProxySettings.java @@ -0,0 +1,236 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.TargetHttpProxyStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetHttpProxyClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetHttpProxy to 30 seconds: + * + *

+ * 
+ * TargetHttpProxySettings.Builder targetHttpProxySettingsBuilder =
+ *     TargetHttpProxySettings.newBuilder();
+ * targetHttpProxySettingsBuilder.deleteTargetHttpProxySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetHttpProxySettings targetHttpProxySettings = targetHttpProxySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetHttpProxySettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteTargetHttpProxy. */ + public UnaryCallSettings + deleteTargetHttpProxySettings() { + return ((TargetHttpProxyStubSettings) getStubSettings()).deleteTargetHttpProxySettings(); + } + + /** Returns the object with the settings used for calls to getTargetHttpProxy. */ + public UnaryCallSettings + getTargetHttpProxySettings() { + return ((TargetHttpProxyStubSettings) getStubSettings()).getTargetHttpProxySettings(); + } + + /** Returns the object with the settings used for calls to insertTargetHttpProxy. */ + public UnaryCallSettings + insertTargetHttpProxySettings() { + return ((TargetHttpProxyStubSettings) getStubSettings()).insertTargetHttpProxySettings(); + } + + /** Returns the object with the settings used for calls to listTargetHttpProxies. */ + public PagedCallSettings< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, ListTargetHttpProxiesPagedResponse> + listTargetHttpProxiesSettings() { + return ((TargetHttpProxyStubSettings) getStubSettings()).listTargetHttpProxiesSettings(); + } + + /** Returns the object with the settings used for calls to setUrlMapTargetHttpProxy. */ + public UnaryCallSettings + setUrlMapTargetHttpProxySettings() { + return ((TargetHttpProxyStubSettings) getStubSettings()).setUrlMapTargetHttpProxySettings(); + } + + public static final TargetHttpProxySettings create(TargetHttpProxyStubSettings stub) + throws IOException { + return new TargetHttpProxySettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return TargetHttpProxyStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return TargetHttpProxyStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return TargetHttpProxyStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return TargetHttpProxyStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return TargetHttpProxyStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return TargetHttpProxyStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return TargetHttpProxyStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TargetHttpProxyStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetHttpProxySettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for TargetHttpProxySettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(TargetHttpProxyStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(TargetHttpProxyStubSettings.newBuilder()); + } + + protected Builder(TargetHttpProxySettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(TargetHttpProxyStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public TargetHttpProxyStubSettings.Builder getStubSettingsBuilder() { + return ((TargetHttpProxyStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteTargetHttpProxy. */ + public UnaryCallSettings.Builder + deleteTargetHttpProxySettings() { + return getStubSettingsBuilder().deleteTargetHttpProxySettings(); + } + + /** Returns the builder for the settings used for calls to getTargetHttpProxy. */ + public UnaryCallSettings.Builder + getTargetHttpProxySettings() { + return getStubSettingsBuilder().getTargetHttpProxySettings(); + } + + /** Returns the builder for the settings used for calls to insertTargetHttpProxy. */ + public UnaryCallSettings.Builder + insertTargetHttpProxySettings() { + return getStubSettingsBuilder().insertTargetHttpProxySettings(); + } + + /** Returns the builder for the settings used for calls to listTargetHttpProxies. */ + public PagedCallSettings.Builder< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, + ListTargetHttpProxiesPagedResponse> + listTargetHttpProxiesSettings() { + return getStubSettingsBuilder().listTargetHttpProxiesSettings(); + } + + /** Returns the builder for the settings used for calls to setUrlMapTargetHttpProxy. */ + public UnaryCallSettings.Builder + setUrlMapTargetHttpProxySettings() { + return getStubSettingsBuilder().setUrlMapTargetHttpProxySettings(); + } + + @Override + public TargetHttpProxySettings build() throws IOException { + return new TargetHttpProxySettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxiesSetSslCertificatesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxiesSetSslCertificatesRequest.java new file mode 100644 index 000000000000..5b59aff31e11 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxiesSetSslCertificatesRequest.java @@ -0,0 +1,155 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetHttpsProxiesSetSslCertificatesRequest implements ApiMessage { + private final List sslCertificates; + + private TargetHttpsProxiesSetSslCertificatesRequest() { + this.sslCertificates = null; + } + + private TargetHttpsProxiesSetSslCertificatesRequest(List sslCertificates) { + this.sslCertificates = sslCertificates; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("sslCertificates")) { + return sslCertificates; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getSslCertificatesList() { + return sslCertificates; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetHttpsProxiesSetSslCertificatesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetHttpsProxiesSetSslCertificatesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetHttpsProxiesSetSslCertificatesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetHttpsProxiesSetSslCertificatesRequest(); + } + + public static class Builder { + private List sslCertificates; + + Builder() {} + + public Builder mergeFrom(TargetHttpsProxiesSetSslCertificatesRequest other) { + if (other == TargetHttpsProxiesSetSslCertificatesRequest.getDefaultInstance()) return this; + if (other.getSslCertificatesList() != null) { + this.sslCertificates = other.sslCertificates; + } + return this; + } + + Builder(TargetHttpsProxiesSetSslCertificatesRequest source) { + this.sslCertificates = source.sslCertificates; + } + + public List getSslCertificatesList() { + return sslCertificates; + } + + public Builder addAllSslCertificates(List sslCertificates) { + if (this.sslCertificates == null) { + this.sslCertificates = new ArrayList<>(sslCertificates.size()); + } + this.sslCertificates.addAll(sslCertificates); + return this; + } + + public Builder addSslCertificates(String sslCertificates) { + this.sslCertificates.add(sslCertificates); + return this; + } + + public TargetHttpsProxiesSetSslCertificatesRequest build() { + return new TargetHttpsProxiesSetSslCertificatesRequest(sslCertificates); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllSslCertificates(this.sslCertificates); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetHttpsProxiesSetSslCertificatesRequest{" + + "sslCertificates=" + + sslCertificates + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetHttpsProxiesSetSslCertificatesRequest) { + TargetHttpsProxiesSetSslCertificatesRequest that = + (TargetHttpsProxiesSetSslCertificatesRequest) o; + return Objects.equals(this.sslCertificates, that.getSslCertificatesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(sslCertificates); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxy.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxy.java new file mode 100644 index 000000000000..357612eca81f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxy.java @@ -0,0 +1,414 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetHttpsProxy implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String id; + private final String kind; + private final String name; + private final String selfLink; + private final List sslCertificates; + private final String sslPolicy; + private final String urlMap; + + private TargetHttpsProxy() { + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.kind = null; + this.name = null; + this.selfLink = null; + this.sslCertificates = null; + this.sslPolicy = null; + this.urlMap = null; + } + + private TargetHttpsProxy( + String creationTimestamp, + String description, + String id, + String kind, + String name, + String selfLink, + List sslCertificates, + String sslPolicy, + String urlMap) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.kind = kind; + this.name = name; + this.selfLink = selfLink; + this.sslCertificates = sslCertificates; + this.sslPolicy = sslPolicy; + this.urlMap = urlMap; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("sslCertificates")) { + return sslCertificates; + } + if (fieldName.equals("sslPolicy")) { + return sslPolicy; + } + if (fieldName.equals("urlMap")) { + return urlMap; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getSelfLink() { + return selfLink; + } + + public List getSslCertificatesList() { + return sslCertificates; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public String getUrlMap() { + return urlMap; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetHttpsProxy prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetHttpsProxy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetHttpsProxy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetHttpsProxy(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String id; + private String kind; + private String name; + private String selfLink; + private List sslCertificates; + private String sslPolicy; + private String urlMap; + + Builder() {} + + public Builder mergeFrom(TargetHttpsProxy other) { + if (other == TargetHttpsProxy.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSslCertificatesList() != null) { + this.sslCertificates = other.sslCertificates; + } + if (other.getSslPolicy() != null) { + this.sslPolicy = other.sslPolicy; + } + if (other.getUrlMap() != null) { + this.urlMap = other.urlMap; + } + return this; + } + + Builder(TargetHttpsProxy source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.selfLink = source.selfLink; + this.sslCertificates = source.sslCertificates; + this.sslPolicy = source.sslPolicy; + this.urlMap = source.urlMap; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public List getSslCertificatesList() { + return sslCertificates; + } + + public Builder addAllSslCertificates(List sslCertificates) { + if (this.sslCertificates == null) { + this.sslCertificates = new ArrayList<>(sslCertificates.size()); + } + this.sslCertificates.addAll(sslCertificates); + return this; + } + + public Builder addSslCertificates(String sslCertificates) { + this.sslCertificates.add(sslCertificates); + return this; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public Builder setSslPolicy(String sslPolicy) { + this.sslPolicy = sslPolicy; + return this; + } + + public String getUrlMap() { + return urlMap; + } + + public Builder setUrlMap(String urlMap) { + this.urlMap = urlMap; + return this; + } + + public TargetHttpsProxy build() { + + return new TargetHttpsProxy( + creationTimestamp, + description, + id, + kind, + name, + selfLink, + sslCertificates, + sslPolicy, + urlMap); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setSelfLink(this.selfLink); + newBuilder.addAllSslCertificates(this.sslCertificates); + newBuilder.setSslPolicy(this.sslPolicy); + newBuilder.setUrlMap(this.urlMap); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetHttpsProxy{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "selfLink=" + + selfLink + + ", " + + "sslCertificates=" + + sslCertificates + + ", " + + "sslPolicy=" + + sslPolicy + + ", " + + "urlMap=" + + urlMap + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetHttpsProxy) { + TargetHttpsProxy that = (TargetHttpsProxy) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.sslCertificates, that.getSslCertificatesList()) + && Objects.equals(this.sslPolicy, that.getSslPolicy()) + && Objects.equals(this.urlMap, that.getUrlMap()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + description, + id, + kind, + name, + selfLink, + sslCertificates, + sslPolicy, + urlMap); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxyClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxyClient.java new file mode 100644 index 000000000000..0c203e55a67f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxyClient.java @@ -0,0 +1,1084 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.TargetHttpsProxyStub; +import com.google.cloud.compute.v1.stub.TargetHttpsProxyStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+ *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+ *   Operation response = targetHttpsProxyClient.deleteTargetHttpsProxy(targetHttpsProxy);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the targetHttpsProxyClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of TargetHttpsProxySettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * TargetHttpsProxySettings targetHttpsProxySettings =
+ *     TargetHttpsProxySettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * TargetHttpsProxyClient targetHttpsProxyClient =
+ *     TargetHttpsProxyClient.create(targetHttpsProxySettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * TargetHttpsProxySettings targetHttpsProxySettings =
+ *     TargetHttpsProxySettings.newBuilder().setEndpoint(myEndpoint).build();
+ * TargetHttpsProxyClient targetHttpsProxyClient =
+ *     TargetHttpsProxyClient.create(targetHttpsProxySettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetHttpsProxyClient implements BackgroundResource { + private final TargetHttpsProxySettings settings; + private final TargetHttpsProxyStub stub; + + /** Constructs an instance of TargetHttpsProxyClient with default settings. */ + public static final TargetHttpsProxyClient create() throws IOException { + return create(TargetHttpsProxySettings.newBuilder().build()); + } + + /** + * Constructs an instance of TargetHttpsProxyClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final TargetHttpsProxyClient create(TargetHttpsProxySettings settings) + throws IOException { + return new TargetHttpsProxyClient(settings); + } + + /** + * Constructs an instance of TargetHttpsProxyClient, using the given stub for making calls. This + * is for advanced usage - prefer to use TargetHttpsProxySettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final TargetHttpsProxyClient create(TargetHttpsProxyStub stub) { + return new TargetHttpsProxyClient(stub); + } + + /** + * Constructs an instance of TargetHttpsProxyClient, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected TargetHttpsProxyClient(TargetHttpsProxySettings settings) throws IOException { + this.settings = settings; + this.stub = ((TargetHttpsProxyStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected TargetHttpsProxyClient(TargetHttpsProxyStub stub) { + this.settings = null; + this.stub = stub; + } + + public final TargetHttpsProxySettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetHttpsProxyStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetHttpsProxy resource. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   Operation response = targetHttpsProxyClient.deleteTargetHttpsProxy(targetHttpsProxy);
+   * }
+   * 
+ * + * @param targetHttpsProxy Name of the TargetHttpsProxy resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetHttpsProxy( + ProjectGlobalTargetHttpsProxyName targetHttpsProxy) { + + DeleteTargetHttpsProxyHttpRequest request = + DeleteTargetHttpsProxyHttpRequest.newBuilder() + .setTargetHttpsProxy(targetHttpsProxy == null ? null : targetHttpsProxy.toString()) + .build(); + return deleteTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetHttpsProxy resource. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   Operation response = targetHttpsProxyClient.deleteTargetHttpsProxy(targetHttpsProxy.toString());
+   * }
+   * 
+ * + * @param targetHttpsProxy Name of the TargetHttpsProxy resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetHttpsProxy(String targetHttpsProxy) { + + DeleteTargetHttpsProxyHttpRequest request = + DeleteTargetHttpsProxyHttpRequest.newBuilder() + .setTargetHttpsProxy(targetHttpsProxy) + .build(); + return deleteTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetHttpsProxy resource. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   DeleteTargetHttpsProxyHttpRequest request = DeleteTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setTargetHttpsProxy(targetHttpsProxy.toString())
+   *     .build();
+   *   Operation response = targetHttpsProxyClient.deleteTargetHttpsProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetHttpsProxy(DeleteTargetHttpsProxyHttpRequest request) { + return deleteTargetHttpsProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetHttpsProxy resource. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   DeleteTargetHttpsProxyHttpRequest request = DeleteTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setTargetHttpsProxy(targetHttpsProxy.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = targetHttpsProxyClient.deleteTargetHttpsProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteTargetHttpsProxyCallable() { + return stub.deleteTargetHttpsProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetHttpsProxy resource. Gets a list of available target HTTPS proxies + * by making a list() request. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   TargetHttpsProxy response = targetHttpsProxyClient.getTargetHttpsProxy(targetHttpsProxy);
+   * }
+   * 
+ * + * @param targetHttpsProxy Name of the TargetHttpsProxy resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetHttpsProxy getTargetHttpsProxy( + ProjectGlobalTargetHttpsProxyName targetHttpsProxy) { + + GetTargetHttpsProxyHttpRequest request = + GetTargetHttpsProxyHttpRequest.newBuilder() + .setTargetHttpsProxy(targetHttpsProxy == null ? null : targetHttpsProxy.toString()) + .build(); + return getTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetHttpsProxy resource. Gets a list of available target HTTPS proxies + * by making a list() request. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   TargetHttpsProxy response = targetHttpsProxyClient.getTargetHttpsProxy(targetHttpsProxy.toString());
+   * }
+   * 
+ * + * @param targetHttpsProxy Name of the TargetHttpsProxy resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetHttpsProxy getTargetHttpsProxy(String targetHttpsProxy) { + + GetTargetHttpsProxyHttpRequest request = + GetTargetHttpsProxyHttpRequest.newBuilder().setTargetHttpsProxy(targetHttpsProxy).build(); + return getTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetHttpsProxy resource. Gets a list of available target HTTPS proxies + * by making a list() request. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   GetTargetHttpsProxyHttpRequest request = GetTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setTargetHttpsProxy(targetHttpsProxy.toString())
+   *     .build();
+   *   TargetHttpsProxy response = targetHttpsProxyClient.getTargetHttpsProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetHttpsProxy getTargetHttpsProxy(GetTargetHttpsProxyHttpRequest request) { + return getTargetHttpsProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetHttpsProxy resource. Gets a list of available target HTTPS proxies + * by making a list() request. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   GetTargetHttpsProxyHttpRequest request = GetTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setTargetHttpsProxy(targetHttpsProxy.toString())
+   *     .build();
+   *   ApiFuture<TargetHttpsProxy> future = targetHttpsProxyClient.getTargetHttpsProxyCallable().futureCall(request);
+   *   // Do something
+   *   TargetHttpsProxy response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getTargetHttpsProxyCallable() { + return stub.getTargetHttpsProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetHttpsProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetHttpsProxy targetHttpsProxyResource = TargetHttpsProxy.newBuilder().build();
+   *   Operation response = targetHttpsProxyClient.insertTargetHttpsProxy(project, targetHttpsProxyResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param targetHttpsProxyResource A TargetHttpsProxy resource. This resource defines an HTTPS + * proxy. (== resource_for beta.targetHttpsProxies ==) (== resource_for v1.targetHttpsProxies + * ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetHttpsProxy( + ProjectName project, TargetHttpsProxy targetHttpsProxyResource) { + + InsertTargetHttpsProxyHttpRequest request = + InsertTargetHttpsProxyHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setTargetHttpsProxyResource(targetHttpsProxyResource) + .build(); + return insertTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetHttpsProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetHttpsProxy targetHttpsProxyResource = TargetHttpsProxy.newBuilder().build();
+   *   Operation response = targetHttpsProxyClient.insertTargetHttpsProxy(project.toString(), targetHttpsProxyResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param targetHttpsProxyResource A TargetHttpsProxy resource. This resource defines an HTTPS + * proxy. (== resource_for beta.targetHttpsProxies ==) (== resource_for v1.targetHttpsProxies + * ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetHttpsProxy( + String project, TargetHttpsProxy targetHttpsProxyResource) { + + InsertTargetHttpsProxyHttpRequest request = + InsertTargetHttpsProxyHttpRequest.newBuilder() + .setProject(project) + .setTargetHttpsProxyResource(targetHttpsProxyResource) + .build(); + return insertTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetHttpsProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetHttpsProxy targetHttpsProxyResource = TargetHttpsProxy.newBuilder().build();
+   *   InsertTargetHttpsProxyHttpRequest request = InsertTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setTargetHttpsProxyResource(targetHttpsProxyResource)
+   *     .build();
+   *   Operation response = targetHttpsProxyClient.insertTargetHttpsProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetHttpsProxy(InsertTargetHttpsProxyHttpRequest request) { + return insertTargetHttpsProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetHttpsProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetHttpsProxy targetHttpsProxyResource = TargetHttpsProxy.newBuilder().build();
+   *   InsertTargetHttpsProxyHttpRequest request = InsertTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setTargetHttpsProxyResource(targetHttpsProxyResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetHttpsProxyClient.insertTargetHttpsProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertTargetHttpsProxyCallable() { + return stub.insertTargetHttpsProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetHttpsProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetHttpsProxy element : targetHttpsProxyClient.listTargetHttpsProxies(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetHttpsProxiesPagedResponse listTargetHttpsProxies(ProjectName project) { + ListTargetHttpsProxiesHttpRequest request = + ListTargetHttpsProxiesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listTargetHttpsProxies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetHttpsProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetHttpsProxy element : targetHttpsProxyClient.listTargetHttpsProxies(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetHttpsProxiesPagedResponse listTargetHttpsProxies(String project) { + ListTargetHttpsProxiesHttpRequest request = + ListTargetHttpsProxiesHttpRequest.newBuilder().setProject(project).build(); + return listTargetHttpsProxies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetHttpsProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetHttpsProxiesHttpRequest request = ListTargetHttpsProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (TargetHttpsProxy element : targetHttpsProxyClient.listTargetHttpsProxies(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetHttpsProxiesPagedResponse listTargetHttpsProxies( + ListTargetHttpsProxiesHttpRequest request) { + return listTargetHttpsProxiesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetHttpsProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetHttpsProxiesHttpRequest request = ListTargetHttpsProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListTargetHttpsProxiesPagedResponse> future = targetHttpsProxyClient.listTargetHttpsProxiesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (TargetHttpsProxy element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetHttpsProxiesPagedCallable() { + return stub.listTargetHttpsProxiesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetHttpsProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetHttpsProxiesHttpRequest request = ListTargetHttpsProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     TargetHttpsProxyList response = targetHttpsProxyClient.listTargetHttpsProxiesCallable().call(request);
+   *     for (TargetHttpsProxy element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetHttpsProxiesCallable() { + return stub.listTargetHttpsProxiesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Replaces SslCertificates for TargetHttpsProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectTargetHttpsProxyName targetHttpsProxy = ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   TargetHttpsProxiesSetSslCertificatesRequest targetHttpsProxiesSetSslCertificatesRequestResource = TargetHttpsProxiesSetSslCertificatesRequest.newBuilder().build();
+   *   Operation response = targetHttpsProxyClient.setSslCertificatesTargetHttpsProxy(targetHttpsProxy, targetHttpsProxiesSetSslCertificatesRequestResource);
+   * }
+   * 
+ * + * @param targetHttpsProxy Name of the TargetHttpsProxy resource to set an SslCertificates + * resource for. + * @param targetHttpsProxiesSetSslCertificatesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslCertificatesTargetHttpsProxy( + ProjectTargetHttpsProxyName targetHttpsProxy, + TargetHttpsProxiesSetSslCertificatesRequest + targetHttpsProxiesSetSslCertificatesRequestResource) { + + SetSslCertificatesTargetHttpsProxyHttpRequest request = + SetSslCertificatesTargetHttpsProxyHttpRequest.newBuilder() + .setTargetHttpsProxy(targetHttpsProxy == null ? null : targetHttpsProxy.toString()) + .setTargetHttpsProxiesSetSslCertificatesRequestResource( + targetHttpsProxiesSetSslCertificatesRequestResource) + .build(); + return setSslCertificatesTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Replaces SslCertificates for TargetHttpsProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectTargetHttpsProxyName targetHttpsProxy = ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   TargetHttpsProxiesSetSslCertificatesRequest targetHttpsProxiesSetSslCertificatesRequestResource = TargetHttpsProxiesSetSslCertificatesRequest.newBuilder().build();
+   *   Operation response = targetHttpsProxyClient.setSslCertificatesTargetHttpsProxy(targetHttpsProxy.toString(), targetHttpsProxiesSetSslCertificatesRequestResource);
+   * }
+   * 
+ * + * @param targetHttpsProxy Name of the TargetHttpsProxy resource to set an SslCertificates + * resource for. + * @param targetHttpsProxiesSetSslCertificatesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslCertificatesTargetHttpsProxy( + String targetHttpsProxy, + TargetHttpsProxiesSetSslCertificatesRequest + targetHttpsProxiesSetSslCertificatesRequestResource) { + + SetSslCertificatesTargetHttpsProxyHttpRequest request = + SetSslCertificatesTargetHttpsProxyHttpRequest.newBuilder() + .setTargetHttpsProxy(targetHttpsProxy) + .setTargetHttpsProxiesSetSslCertificatesRequestResource( + targetHttpsProxiesSetSslCertificatesRequestResource) + .build(); + return setSslCertificatesTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Replaces SslCertificates for TargetHttpsProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectTargetHttpsProxyName targetHttpsProxy = ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   TargetHttpsProxiesSetSslCertificatesRequest targetHttpsProxiesSetSslCertificatesRequestResource = TargetHttpsProxiesSetSslCertificatesRequest.newBuilder().build();
+   *   SetSslCertificatesTargetHttpsProxyHttpRequest request = SetSslCertificatesTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setTargetHttpsProxy(targetHttpsProxy.toString())
+   *     .setTargetHttpsProxiesSetSslCertificatesRequestResource(targetHttpsProxiesSetSslCertificatesRequestResource)
+   *     .build();
+   *   Operation response = targetHttpsProxyClient.setSslCertificatesTargetHttpsProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslCertificatesTargetHttpsProxy( + SetSslCertificatesTargetHttpsProxyHttpRequest request) { + return setSslCertificatesTargetHttpsProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Replaces SslCertificates for TargetHttpsProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectTargetHttpsProxyName targetHttpsProxy = ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   TargetHttpsProxiesSetSslCertificatesRequest targetHttpsProxiesSetSslCertificatesRequestResource = TargetHttpsProxiesSetSslCertificatesRequest.newBuilder().build();
+   *   SetSslCertificatesTargetHttpsProxyHttpRequest request = SetSslCertificatesTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setTargetHttpsProxy(targetHttpsProxy.toString())
+   *     .setTargetHttpsProxiesSetSslCertificatesRequestResource(targetHttpsProxiesSetSslCertificatesRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetHttpsProxyClient.setSslCertificatesTargetHttpsProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setSslCertificatesTargetHttpsProxyCallable() { + return stub.setSslCertificatesTargetHttpsProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the server-side support for + * SSL features. This affects connections between clients and the HTTPS proxy load balancer. They + * do not affect the connection between the load balancer and the backends. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build();
+   *   Operation response = targetHttpsProxyClient.setSslPolicyTargetHttpsProxy(targetHttpsProxy, sslPolicyReferenceResource);
+   * }
+   * 
+ * + * @param targetHttpsProxy Name of the TargetHttpsProxy resource whose SSL policy is to be set. + * The name must be 1-63 characters long, and comply with RFC1035. + * @param sslPolicyReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslPolicyTargetHttpsProxy( + ProjectGlobalTargetHttpsProxyName targetHttpsProxy, + SslPolicyReference sslPolicyReferenceResource) { + + SetSslPolicyTargetHttpsProxyHttpRequest request = + SetSslPolicyTargetHttpsProxyHttpRequest.newBuilder() + .setTargetHttpsProxy(targetHttpsProxy == null ? null : targetHttpsProxy.toString()) + .setSslPolicyReferenceResource(sslPolicyReferenceResource) + .build(); + return setSslPolicyTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the server-side support for + * SSL features. This affects connections between clients and the HTTPS proxy load balancer. They + * do not affect the connection between the load balancer and the backends. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build();
+   *   Operation response = targetHttpsProxyClient.setSslPolicyTargetHttpsProxy(targetHttpsProxy.toString(), sslPolicyReferenceResource);
+   * }
+   * 
+ * + * @param targetHttpsProxy Name of the TargetHttpsProxy resource whose SSL policy is to be set. + * The name must be 1-63 characters long, and comply with RFC1035. + * @param sslPolicyReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslPolicyTargetHttpsProxy( + String targetHttpsProxy, SslPolicyReference sslPolicyReferenceResource) { + + SetSslPolicyTargetHttpsProxyHttpRequest request = + SetSslPolicyTargetHttpsProxyHttpRequest.newBuilder() + .setTargetHttpsProxy(targetHttpsProxy) + .setSslPolicyReferenceResource(sslPolicyReferenceResource) + .build(); + return setSslPolicyTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the server-side support for + * SSL features. This affects connections between clients and the HTTPS proxy load balancer. They + * do not affect the connection between the load balancer and the backends. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build();
+   *   SetSslPolicyTargetHttpsProxyHttpRequest request = SetSslPolicyTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setTargetHttpsProxy(targetHttpsProxy.toString())
+   *     .setSslPolicyReferenceResource(sslPolicyReferenceResource)
+   *     .build();
+   *   Operation response = targetHttpsProxyClient.setSslPolicyTargetHttpsProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslPolicyTargetHttpsProxy( + SetSslPolicyTargetHttpsProxyHttpRequest request) { + return setSslPolicyTargetHttpsProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the server-side support for + * SSL features. This affects connections between clients and the HTTPS proxy load balancer. They + * do not affect the connection between the load balancer and the backends. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build();
+   *   SetSslPolicyTargetHttpsProxyHttpRequest request = SetSslPolicyTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setTargetHttpsProxy(targetHttpsProxy.toString())
+   *     .setSslPolicyReferenceResource(sslPolicyReferenceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetHttpsProxyClient.setSslPolicyTargetHttpsProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setSslPolicyTargetHttpsProxyCallable() { + return stub.setSslPolicyTargetHttpsProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the URL map for TargetHttpsProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectTargetHttpsProxyName targetHttpsProxy = ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
+   *   Operation response = targetHttpsProxyClient.setUrlMapTargetHttpsProxy(targetHttpsProxy, urlMapReferenceResource);
+   * }
+   * 
+ * + * @param targetHttpsProxy Name of the TargetHttpsProxy resource whose URL map is to be set. + * @param urlMapReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setUrlMapTargetHttpsProxy( + ProjectTargetHttpsProxyName targetHttpsProxy, UrlMapReference urlMapReferenceResource) { + + SetUrlMapTargetHttpsProxyHttpRequest request = + SetUrlMapTargetHttpsProxyHttpRequest.newBuilder() + .setTargetHttpsProxy(targetHttpsProxy == null ? null : targetHttpsProxy.toString()) + .setUrlMapReferenceResource(urlMapReferenceResource) + .build(); + return setUrlMapTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the URL map for TargetHttpsProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectTargetHttpsProxyName targetHttpsProxy = ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
+   *   Operation response = targetHttpsProxyClient.setUrlMapTargetHttpsProxy(targetHttpsProxy.toString(), urlMapReferenceResource);
+   * }
+   * 
+ * + * @param targetHttpsProxy Name of the TargetHttpsProxy resource whose URL map is to be set. + * @param urlMapReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setUrlMapTargetHttpsProxy( + String targetHttpsProxy, UrlMapReference urlMapReferenceResource) { + + SetUrlMapTargetHttpsProxyHttpRequest request = + SetUrlMapTargetHttpsProxyHttpRequest.newBuilder() + .setTargetHttpsProxy(targetHttpsProxy) + .setUrlMapReferenceResource(urlMapReferenceResource) + .build(); + return setUrlMapTargetHttpsProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the URL map for TargetHttpsProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectTargetHttpsProxyName targetHttpsProxy = ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
+   *   SetUrlMapTargetHttpsProxyHttpRequest request = SetUrlMapTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setTargetHttpsProxy(targetHttpsProxy.toString())
+   *     .setUrlMapReferenceResource(urlMapReferenceResource)
+   *     .build();
+   *   Operation response = targetHttpsProxyClient.setUrlMapTargetHttpsProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setUrlMapTargetHttpsProxy(SetUrlMapTargetHttpsProxyHttpRequest request) { + return setUrlMapTargetHttpsProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the URL map for TargetHttpsProxy. + * + *

Sample code: + * + *


+   * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+   *   ProjectTargetHttpsProxyName targetHttpsProxy = ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+   *   UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build();
+   *   SetUrlMapTargetHttpsProxyHttpRequest request = SetUrlMapTargetHttpsProxyHttpRequest.newBuilder()
+   *     .setTargetHttpsProxy(targetHttpsProxy.toString())
+   *     .setUrlMapReferenceResource(urlMapReferenceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetHttpsProxyClient.setUrlMapTargetHttpsProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setUrlMapTargetHttpsProxyCallable() { + return stub.setUrlMapTargetHttpsProxyCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListTargetHttpsProxiesPagedResponse + extends AbstractPagedListResponse< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, TargetHttpsProxy, + ListTargetHttpsProxiesPage, ListTargetHttpsProxiesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListTargetHttpsProxiesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListTargetHttpsProxiesPagedResponse apply(ListTargetHttpsProxiesPage input) { + return new ListTargetHttpsProxiesPagedResponse(input); + } + }); + } + + private ListTargetHttpsProxiesPagedResponse(ListTargetHttpsProxiesPage page) { + super(page, ListTargetHttpsProxiesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListTargetHttpsProxiesPage + extends AbstractPage< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, TargetHttpsProxy, + ListTargetHttpsProxiesPage> { + + private ListTargetHttpsProxiesPage( + PageContext + context, + TargetHttpsProxyList response) { + super(context, response); + } + + private static ListTargetHttpsProxiesPage createEmptyPage() { + return new ListTargetHttpsProxiesPage(null, null); + } + + @Override + protected ListTargetHttpsProxiesPage createPage( + PageContext + context, + TargetHttpsProxyList response) { + return new ListTargetHttpsProxiesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListTargetHttpsProxiesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, TargetHttpsProxy, + ListTargetHttpsProxiesPage, ListTargetHttpsProxiesFixedSizeCollection> { + + private ListTargetHttpsProxiesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListTargetHttpsProxiesFixedSizeCollection createEmptyCollection() { + return new ListTargetHttpsProxiesFixedSizeCollection(null, 0); + } + + @Override + protected ListTargetHttpsProxiesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListTargetHttpsProxiesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxyList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxyList.java new file mode 100644 index 000000000000..e113c6e2b09d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxyList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetHttpsProxyList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private TargetHttpsProxyList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private TargetHttpsProxyList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetHttpsProxyList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetHttpsProxyList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetHttpsProxyList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetHttpsProxyList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetHttpsProxyList other) { + if (other == TargetHttpsProxyList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetHttpsProxyList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(TargetHttpsProxy items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetHttpsProxyList build() { + + return new TargetHttpsProxyList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetHttpsProxyList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetHttpsProxyList) { + TargetHttpsProxyList that = (TargetHttpsProxyList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxySettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxySettings.java new file mode 100644 index 000000000000..c5a8f57c291d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxySettings.java @@ -0,0 +1,265 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetHttpsProxyClient.ListTargetHttpsProxiesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.TargetHttpsProxyStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetHttpsProxyClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetHttpsProxy to 30 seconds: + * + *

+ * 
+ * TargetHttpsProxySettings.Builder targetHttpsProxySettingsBuilder =
+ *     TargetHttpsProxySettings.newBuilder();
+ * targetHttpsProxySettingsBuilder.deleteTargetHttpsProxySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetHttpsProxySettings targetHttpsProxySettings = targetHttpsProxySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetHttpsProxySettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteTargetHttpsProxy. */ + public UnaryCallSettings + deleteTargetHttpsProxySettings() { + return ((TargetHttpsProxyStubSettings) getStubSettings()).deleteTargetHttpsProxySettings(); + } + + /** Returns the object with the settings used for calls to getTargetHttpsProxy. */ + public UnaryCallSettings + getTargetHttpsProxySettings() { + return ((TargetHttpsProxyStubSettings) getStubSettings()).getTargetHttpsProxySettings(); + } + + /** Returns the object with the settings used for calls to insertTargetHttpsProxy. */ + public UnaryCallSettings + insertTargetHttpsProxySettings() { + return ((TargetHttpsProxyStubSettings) getStubSettings()).insertTargetHttpsProxySettings(); + } + + /** Returns the object with the settings used for calls to listTargetHttpsProxies. */ + public PagedCallSettings< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, + ListTargetHttpsProxiesPagedResponse> + listTargetHttpsProxiesSettings() { + return ((TargetHttpsProxyStubSettings) getStubSettings()).listTargetHttpsProxiesSettings(); + } + + /** Returns the object with the settings used for calls to setSslCertificatesTargetHttpsProxy. */ + public UnaryCallSettings + setSslCertificatesTargetHttpsProxySettings() { + return ((TargetHttpsProxyStubSettings) getStubSettings()) + .setSslCertificatesTargetHttpsProxySettings(); + } + + /** Returns the object with the settings used for calls to setSslPolicyTargetHttpsProxy. */ + public UnaryCallSettings + setSslPolicyTargetHttpsProxySettings() { + return ((TargetHttpsProxyStubSettings) getStubSettings()) + .setSslPolicyTargetHttpsProxySettings(); + } + + /** Returns the object with the settings used for calls to setUrlMapTargetHttpsProxy. */ + public UnaryCallSettings + setUrlMapTargetHttpsProxySettings() { + return ((TargetHttpsProxyStubSettings) getStubSettings()).setUrlMapTargetHttpsProxySettings(); + } + + public static final TargetHttpsProxySettings create(TargetHttpsProxyStubSettings stub) + throws IOException { + return new TargetHttpsProxySettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return TargetHttpsProxyStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return TargetHttpsProxyStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return TargetHttpsProxyStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return TargetHttpsProxyStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return TargetHttpsProxyStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return TargetHttpsProxyStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return TargetHttpsProxyStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TargetHttpsProxyStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetHttpsProxySettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for TargetHttpsProxySettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(TargetHttpsProxyStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(TargetHttpsProxyStubSettings.newBuilder()); + } + + protected Builder(TargetHttpsProxySettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(TargetHttpsProxyStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public TargetHttpsProxyStubSettings.Builder getStubSettingsBuilder() { + return ((TargetHttpsProxyStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteTargetHttpsProxy. */ + public UnaryCallSettings.Builder + deleteTargetHttpsProxySettings() { + return getStubSettingsBuilder().deleteTargetHttpsProxySettings(); + } + + /** Returns the builder for the settings used for calls to getTargetHttpsProxy. */ + public UnaryCallSettings.Builder + getTargetHttpsProxySettings() { + return getStubSettingsBuilder().getTargetHttpsProxySettings(); + } + + /** Returns the builder for the settings used for calls to insertTargetHttpsProxy. */ + public UnaryCallSettings.Builder + insertTargetHttpsProxySettings() { + return getStubSettingsBuilder().insertTargetHttpsProxySettings(); + } + + /** Returns the builder for the settings used for calls to listTargetHttpsProxies. */ + public PagedCallSettings.Builder< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, + ListTargetHttpsProxiesPagedResponse> + listTargetHttpsProxiesSettings() { + return getStubSettingsBuilder().listTargetHttpsProxiesSettings(); + } + + /** + * Returns the builder for the settings used for calls to setSslCertificatesTargetHttpsProxy. + */ + public UnaryCallSettings.Builder + setSslCertificatesTargetHttpsProxySettings() { + return getStubSettingsBuilder().setSslCertificatesTargetHttpsProxySettings(); + } + + /** Returns the builder for the settings used for calls to setSslPolicyTargetHttpsProxy. */ + public UnaryCallSettings.Builder + setSslPolicyTargetHttpsProxySettings() { + return getStubSettingsBuilder().setSslPolicyTargetHttpsProxySettings(); + } + + /** Returns the builder for the settings used for calls to setUrlMapTargetHttpsProxy. */ + public UnaryCallSettings.Builder + setUrlMapTargetHttpsProxySettings() { + return getStubSettingsBuilder().setUrlMapTargetHttpsProxySettings(); + } + + @Override + public TargetHttpsProxySettings build() throws IOException { + return new TargetHttpsProxySettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstance.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstance.java new file mode 100644 index 000000000000..ae3f4b5cc9ae --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstance.java @@ -0,0 +1,389 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetInstance implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String id; + private final String instance; + private final String kind; + private final String name; + private final String natPolicy; + private final String selfLink; + private final String zone; + + private TargetInstance() { + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.instance = null; + this.kind = null; + this.name = null; + this.natPolicy = null; + this.selfLink = null; + this.zone = null; + } + + private TargetInstance( + String creationTimestamp, + String description, + String id, + String instance, + String kind, + String name, + String natPolicy, + String selfLink, + String zone) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.instance = instance; + this.kind = kind; + this.name = name; + this.natPolicy = natPolicy; + this.selfLink = selfLink; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("natPolicy")) { + return natPolicy; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getInstance() { + return instance; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getNatPolicy() { + return natPolicy; + } + + public String getSelfLink() { + return selfLink; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetInstance prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetInstance getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetInstance DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetInstance(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String id; + private String instance; + private String kind; + private String name; + private String natPolicy; + private String selfLink; + private String zone; + + Builder() {} + + public Builder mergeFrom(TargetInstance other) { + if (other == TargetInstance.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNatPolicy() != null) { + this.natPolicy = other.natPolicy; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(TargetInstance source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.instance = source.instance; + this.kind = source.kind; + this.name = source.name; + this.natPolicy = source.natPolicy; + this.selfLink = source.selfLink; + this.zone = source.zone; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getNatPolicy() { + return natPolicy; + } + + public Builder setNatPolicy(String natPolicy) { + this.natPolicy = natPolicy; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public TargetInstance build() { + + return new TargetInstance( + creationTimestamp, description, id, instance, kind, name, natPolicy, selfLink, zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setInstance(this.instance); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setNatPolicy(this.natPolicy); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetInstance{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "instance=" + + instance + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "natPolicy=" + + natPolicy + + ", " + + "selfLink=" + + selfLink + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetInstance) { + TargetInstance that = (TargetInstance) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.natPolicy, that.getNatPolicy()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, description, id, instance, kind, name, natPolicy, selfLink, zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceAggregatedList.java new file mode 100644 index 000000000000..b53ae8011727 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetInstanceAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private TargetInstanceAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private TargetInstanceAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetInstanceAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetInstanceAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetInstanceAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetInstanceAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetInstanceAggregatedList other) { + if (other == TargetInstanceAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetInstanceAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetInstanceAggregatedList build() { + + return new TargetInstanceAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetInstanceAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetInstanceAggregatedList) { + TargetInstanceAggregatedList that = (TargetInstanceAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceClient.java new file mode 100644 index 000000000000..a705ea5fe8ef --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceClient.java @@ -0,0 +1,951 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.TargetInstanceStub; +import com.google.cloud.compute.v1.stub.TargetInstanceStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+ *   ProjectZoneTargetInstanceName targetInstance = ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]");
+ *   Operation response = targetInstanceClient.deleteTargetInstance(targetInstance);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the targetInstanceClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of TargetInstanceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * TargetInstanceSettings targetInstanceSettings =
+ *     TargetInstanceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * TargetInstanceClient targetInstanceClient =
+ *     TargetInstanceClient.create(targetInstanceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * TargetInstanceSettings targetInstanceSettings =
+ *     TargetInstanceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * TargetInstanceClient targetInstanceClient =
+ *     TargetInstanceClient.create(targetInstanceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetInstanceClient implements BackgroundResource { + private final TargetInstanceSettings settings; + private final TargetInstanceStub stub; + + /** Constructs an instance of TargetInstanceClient with default settings. */ + public static final TargetInstanceClient create() throws IOException { + return create(TargetInstanceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of TargetInstanceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final TargetInstanceClient create(TargetInstanceSettings settings) + throws IOException { + return new TargetInstanceClient(settings); + } + + /** + * Constructs an instance of TargetInstanceClient, using the given stub for making calls. This is + * for advanced usage - prefer to use TargetInstanceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final TargetInstanceClient create(TargetInstanceStub stub) { + return new TargetInstanceClient(stub); + } + + /** + * Constructs an instance of TargetInstanceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected TargetInstanceClient(TargetInstanceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((TargetInstanceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected TargetInstanceClient(TargetInstanceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final TargetInstanceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetInstanceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target instances. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetInstancesScopedList element : targetInstanceClient.aggregatedListTargetInstances(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListTargetInstancesPagedResponse aggregatedListTargetInstances( + ProjectName project) { + AggregatedListTargetInstancesHttpRequest request = + AggregatedListTargetInstancesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListTargetInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target instances. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetInstancesScopedList element : targetInstanceClient.aggregatedListTargetInstances(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListTargetInstancesPagedResponse aggregatedListTargetInstances( + String project) { + AggregatedListTargetInstancesHttpRequest request = + AggregatedListTargetInstancesHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListTargetInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target instances. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListTargetInstancesHttpRequest request = AggregatedListTargetInstancesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (TargetInstancesScopedList element : targetInstanceClient.aggregatedListTargetInstances(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListTargetInstancesPagedResponse aggregatedListTargetInstances( + AggregatedListTargetInstancesHttpRequest request) { + return aggregatedListTargetInstancesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target instances. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListTargetInstancesHttpRequest request = AggregatedListTargetInstancesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListTargetInstancesPagedResponse> future = targetInstanceClient.aggregatedListTargetInstancesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (TargetInstancesScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListTargetInstancesHttpRequest, AggregatedListTargetInstancesPagedResponse> + aggregatedListTargetInstancesPagedCallable() { + return stub.aggregatedListTargetInstancesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target instances. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListTargetInstancesHttpRequest request = AggregatedListTargetInstancesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     TargetInstanceAggregatedList response = targetInstanceClient.aggregatedListTargetInstancesCallable().call(request);
+   *     for (TargetInstancesScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListTargetInstancesCallable() { + return stub.aggregatedListTargetInstancesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetInstance resource. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneTargetInstanceName targetInstance = ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]");
+   *   Operation response = targetInstanceClient.deleteTargetInstance(targetInstance);
+   * }
+   * 
+ * + * @param targetInstance Name of the TargetInstance resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetInstance(ProjectZoneTargetInstanceName targetInstance) { + + DeleteTargetInstanceHttpRequest request = + DeleteTargetInstanceHttpRequest.newBuilder() + .setTargetInstance(targetInstance == null ? null : targetInstance.toString()) + .build(); + return deleteTargetInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetInstance resource. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneTargetInstanceName targetInstance = ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]");
+   *   Operation response = targetInstanceClient.deleteTargetInstance(targetInstance.toString());
+   * }
+   * 
+ * + * @param targetInstance Name of the TargetInstance resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetInstance(String targetInstance) { + + DeleteTargetInstanceHttpRequest request = + DeleteTargetInstanceHttpRequest.newBuilder().setTargetInstance(targetInstance).build(); + return deleteTargetInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetInstance resource. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneTargetInstanceName targetInstance = ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]");
+   *   DeleteTargetInstanceHttpRequest request = DeleteTargetInstanceHttpRequest.newBuilder()
+   *     .setTargetInstance(targetInstance.toString())
+   *     .build();
+   *   Operation response = targetInstanceClient.deleteTargetInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetInstance(DeleteTargetInstanceHttpRequest request) { + return deleteTargetInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetInstance resource. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneTargetInstanceName targetInstance = ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]");
+   *   DeleteTargetInstanceHttpRequest request = DeleteTargetInstanceHttpRequest.newBuilder()
+   *     .setTargetInstance(targetInstance.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = targetInstanceClient.deleteTargetInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteTargetInstanceCallable() { + return stub.deleteTargetInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetInstance resource. Gets a list of available target instances by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneTargetInstanceName targetInstance = ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]");
+   *   TargetInstance response = targetInstanceClient.getTargetInstance(targetInstance);
+   * }
+   * 
+ * + * @param targetInstance Name of the TargetInstance resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetInstance getTargetInstance(ProjectZoneTargetInstanceName targetInstance) { + + GetTargetInstanceHttpRequest request = + GetTargetInstanceHttpRequest.newBuilder() + .setTargetInstance(targetInstance == null ? null : targetInstance.toString()) + .build(); + return getTargetInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetInstance resource. Gets a list of available target instances by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneTargetInstanceName targetInstance = ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]");
+   *   TargetInstance response = targetInstanceClient.getTargetInstance(targetInstance.toString());
+   * }
+   * 
+ * + * @param targetInstance Name of the TargetInstance resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetInstance getTargetInstance(String targetInstance) { + + GetTargetInstanceHttpRequest request = + GetTargetInstanceHttpRequest.newBuilder().setTargetInstance(targetInstance).build(); + return getTargetInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetInstance resource. Gets a list of available target instances by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneTargetInstanceName targetInstance = ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]");
+   *   GetTargetInstanceHttpRequest request = GetTargetInstanceHttpRequest.newBuilder()
+   *     .setTargetInstance(targetInstance.toString())
+   *     .build();
+   *   TargetInstance response = targetInstanceClient.getTargetInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetInstance getTargetInstance(GetTargetInstanceHttpRequest request) { + return getTargetInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetInstance resource. Gets a list of available target instances by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneTargetInstanceName targetInstance = ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]");
+   *   GetTargetInstanceHttpRequest request = GetTargetInstanceHttpRequest.newBuilder()
+   *     .setTargetInstance(targetInstance.toString())
+   *     .build();
+   *   ApiFuture<TargetInstance> future = targetInstanceClient.getTargetInstanceCallable().futureCall(request);
+   *   // Do something
+   *   TargetInstance response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getTargetInstanceCallable() { + return stub.getTargetInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetInstance resource in the specified project and zone using the data included in + * the request. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   TargetInstance targetInstanceResource = TargetInstance.newBuilder().build();
+   *   Operation response = targetInstanceClient.insertTargetInstance(zone, targetInstanceResource);
+   * }
+   * 
+ * + * @param zone Name of the zone scoping this request. + * @param targetInstanceResource A TargetInstance resource. This resource defines an endpoint + * instance that terminates traffic of certain protocols. (== resource_for + * beta.targetInstances ==) (== resource_for v1.targetInstances ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetInstance( + ProjectZoneName zone, TargetInstance targetInstanceResource) { + + InsertTargetInstanceHttpRequest request = + InsertTargetInstanceHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .setTargetInstanceResource(targetInstanceResource) + .build(); + return insertTargetInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetInstance resource in the specified project and zone using the data included in + * the request. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   TargetInstance targetInstanceResource = TargetInstance.newBuilder().build();
+   *   Operation response = targetInstanceClient.insertTargetInstance(zone.toString(), targetInstanceResource);
+   * }
+   * 
+ * + * @param zone Name of the zone scoping this request. + * @param targetInstanceResource A TargetInstance resource. This resource defines an endpoint + * instance that terminates traffic of certain protocols. (== resource_for + * beta.targetInstances ==) (== resource_for v1.targetInstances ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetInstance(String zone, TargetInstance targetInstanceResource) { + + InsertTargetInstanceHttpRequest request = + InsertTargetInstanceHttpRequest.newBuilder() + .setZone(zone) + .setTargetInstanceResource(targetInstanceResource) + .build(); + return insertTargetInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetInstance resource in the specified project and zone using the data included in + * the request. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   TargetInstance targetInstanceResource = TargetInstance.newBuilder().build();
+   *   InsertTargetInstanceHttpRequest request = InsertTargetInstanceHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setTargetInstanceResource(targetInstanceResource)
+   *     .build();
+   *   Operation response = targetInstanceClient.insertTargetInstance(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetInstance(InsertTargetInstanceHttpRequest request) { + return insertTargetInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetInstance resource in the specified project and zone using the data included in + * the request. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   TargetInstance targetInstanceResource = TargetInstance.newBuilder().build();
+   *   InsertTargetInstanceHttpRequest request = InsertTargetInstanceHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .setTargetInstanceResource(targetInstanceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetInstanceClient.insertTargetInstanceCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertTargetInstanceCallable() { + return stub.insertTargetInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of TargetInstance resources available to the specified project and zone. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (TargetInstance element : targetInstanceClient.listTargetInstances(zone).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone Name of the zone scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetInstancesPagedResponse listTargetInstances(ProjectZoneName zone) { + ListTargetInstancesHttpRequest request = + ListTargetInstancesHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .build(); + return listTargetInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of TargetInstance resources available to the specified project and zone. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (TargetInstance element : targetInstanceClient.listTargetInstances(zone.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone Name of the zone scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetInstancesPagedResponse listTargetInstances(String zone) { + ListTargetInstancesHttpRequest request = + ListTargetInstancesHttpRequest.newBuilder().setZone(zone).build(); + return listTargetInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of TargetInstance resources available to the specified project and zone. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListTargetInstancesHttpRequest request = ListTargetInstancesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   for (TargetInstance element : targetInstanceClient.listTargetInstances(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetInstancesPagedResponse listTargetInstances( + ListTargetInstancesHttpRequest request) { + return listTargetInstancesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of TargetInstance resources available to the specified project and zone. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListTargetInstancesHttpRequest request = ListTargetInstancesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   ApiFuture<ListTargetInstancesPagedResponse> future = targetInstanceClient.listTargetInstancesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (TargetInstance element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetInstancesPagedCallable() { + return stub.listTargetInstancesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of TargetInstance resources available to the specified project and zone. + * + *

Sample code: + * + *


+   * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListTargetInstancesHttpRequest request = ListTargetInstancesHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   while (true) {
+   *     TargetInstanceList response = targetInstanceClient.listTargetInstancesCallable().call(request);
+   *     for (TargetInstance element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetInstancesCallable() { + return stub.listTargetInstancesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListTargetInstancesPagedResponse + extends AbstractPagedListResponse< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + TargetInstancesScopedList, AggregatedListTargetInstancesPage, + AggregatedListTargetInstancesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + TargetInstancesScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListTargetInstancesPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + AggregatedListTargetInstancesPage, AggregatedListTargetInstancesPagedResponse>() { + @Override + public AggregatedListTargetInstancesPagedResponse apply( + AggregatedListTargetInstancesPage input) { + return new AggregatedListTargetInstancesPagedResponse(input); + } + }); + } + + private AggregatedListTargetInstancesPagedResponse(AggregatedListTargetInstancesPage page) { + super(page, AggregatedListTargetInstancesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListTargetInstancesPage + extends AbstractPage< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + TargetInstancesScopedList, AggregatedListTargetInstancesPage> { + + private AggregatedListTargetInstancesPage( + PageContext< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + TargetInstancesScopedList> + context, + TargetInstanceAggregatedList response) { + super(context, response); + } + + private static AggregatedListTargetInstancesPage createEmptyPage() { + return new AggregatedListTargetInstancesPage(null, null); + } + + @Override + protected AggregatedListTargetInstancesPage createPage( + PageContext< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + TargetInstancesScopedList> + context, + TargetInstanceAggregatedList response) { + return new AggregatedListTargetInstancesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + TargetInstancesScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListTargetInstancesFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + TargetInstancesScopedList, AggregatedListTargetInstancesPage, + AggregatedListTargetInstancesFixedSizeCollection> { + + private AggregatedListTargetInstancesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListTargetInstancesFixedSizeCollection createEmptyCollection() { + return new AggregatedListTargetInstancesFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListTargetInstancesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListTargetInstancesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListTargetInstancesPagedResponse + extends AbstractPagedListResponse< + ListTargetInstancesHttpRequest, TargetInstanceList, TargetInstance, + ListTargetInstancesPage, ListTargetInstancesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListTargetInstancesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListTargetInstancesPagedResponse apply(ListTargetInstancesPage input) { + return new ListTargetInstancesPagedResponse(input); + } + }); + } + + private ListTargetInstancesPagedResponse(ListTargetInstancesPage page) { + super(page, ListTargetInstancesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListTargetInstancesPage + extends AbstractPage< + ListTargetInstancesHttpRequest, TargetInstanceList, TargetInstance, + ListTargetInstancesPage> { + + private ListTargetInstancesPage( + PageContext context, + TargetInstanceList response) { + super(context, response); + } + + private static ListTargetInstancesPage createEmptyPage() { + return new ListTargetInstancesPage(null, null); + } + + @Override + protected ListTargetInstancesPage createPage( + PageContext context, + TargetInstanceList response) { + return new ListTargetInstancesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListTargetInstancesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListTargetInstancesHttpRequest, TargetInstanceList, TargetInstance, + ListTargetInstancesPage, ListTargetInstancesFixedSizeCollection> { + + private ListTargetInstancesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListTargetInstancesFixedSizeCollection createEmptyCollection() { + return new ListTargetInstancesFixedSizeCollection(null, 0); + } + + @Override + protected ListTargetInstancesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListTargetInstancesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceList.java new file mode 100644 index 000000000000..991a0d378693 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetInstanceList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private TargetInstanceList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private TargetInstanceList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetInstanceList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetInstanceList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetInstanceList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetInstanceList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetInstanceList other) { + if (other == TargetInstanceList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetInstanceList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(TargetInstance items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetInstanceList build() { + + return new TargetInstanceList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetInstanceList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetInstanceList) { + TargetInstanceList that = (TargetInstanceList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceSettings.java new file mode 100644 index 000000000000..e6f3e4f1a376 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceSettings.java @@ -0,0 +1,240 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetInstanceClient.AggregatedListTargetInstancesPagedResponse; +import static com.google.cloud.compute.v1.TargetInstanceClient.ListTargetInstancesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.TargetInstanceStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetInstanceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetInstance to 30 seconds: + * + *

+ * 
+ * TargetInstanceSettings.Builder targetInstanceSettingsBuilder =
+ *     TargetInstanceSettings.newBuilder();
+ * targetInstanceSettingsBuilder.deleteTargetInstanceSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetInstanceSettings targetInstanceSettings = targetInstanceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetInstanceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListTargetInstances. */ + public PagedCallSettings< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + AggregatedListTargetInstancesPagedResponse> + aggregatedListTargetInstancesSettings() { + return ((TargetInstanceStubSettings) getStubSettings()).aggregatedListTargetInstancesSettings(); + } + + /** Returns the object with the settings used for calls to deleteTargetInstance. */ + public UnaryCallSettings + deleteTargetInstanceSettings() { + return ((TargetInstanceStubSettings) getStubSettings()).deleteTargetInstanceSettings(); + } + + /** Returns the object with the settings used for calls to getTargetInstance. */ + public UnaryCallSettings + getTargetInstanceSettings() { + return ((TargetInstanceStubSettings) getStubSettings()).getTargetInstanceSettings(); + } + + /** Returns the object with the settings used for calls to insertTargetInstance. */ + public UnaryCallSettings + insertTargetInstanceSettings() { + return ((TargetInstanceStubSettings) getStubSettings()).insertTargetInstanceSettings(); + } + + /** Returns the object with the settings used for calls to listTargetInstances. */ + public PagedCallSettings< + ListTargetInstancesHttpRequest, TargetInstanceList, ListTargetInstancesPagedResponse> + listTargetInstancesSettings() { + return ((TargetInstanceStubSettings) getStubSettings()).listTargetInstancesSettings(); + } + + public static final TargetInstanceSettings create(TargetInstanceStubSettings stub) + throws IOException { + return new TargetInstanceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return TargetInstanceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return TargetInstanceStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return TargetInstanceStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return TargetInstanceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return TargetInstanceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return TargetInstanceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return TargetInstanceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TargetInstanceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetInstanceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for TargetInstanceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(TargetInstanceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(TargetInstanceStubSettings.newBuilder()); + } + + protected Builder(TargetInstanceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(TargetInstanceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public TargetInstanceStubSettings.Builder getStubSettingsBuilder() { + return ((TargetInstanceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListTargetInstances. */ + public PagedCallSettings.Builder< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + AggregatedListTargetInstancesPagedResponse> + aggregatedListTargetInstancesSettings() { + return getStubSettingsBuilder().aggregatedListTargetInstancesSettings(); + } + + /** Returns the builder for the settings used for calls to deleteTargetInstance. */ + public UnaryCallSettings.Builder + deleteTargetInstanceSettings() { + return getStubSettingsBuilder().deleteTargetInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to getTargetInstance. */ + public UnaryCallSettings.Builder + getTargetInstanceSettings() { + return getStubSettingsBuilder().getTargetInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to insertTargetInstance. */ + public UnaryCallSettings.Builder + insertTargetInstanceSettings() { + return getStubSettingsBuilder().insertTargetInstanceSettings(); + } + + /** Returns the builder for the settings used for calls to listTargetInstances. */ + public PagedCallSettings.Builder< + ListTargetInstancesHttpRequest, TargetInstanceList, ListTargetInstancesPagedResponse> + listTargetInstancesSettings() { + return getStubSettingsBuilder().listTargetInstancesSettings(); + } + + @Override + public TargetInstanceSettings build() throws IOException { + return new TargetInstanceSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstancesScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstancesScopedList.java new file mode 100644 index 000000000000..64398288fc9b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstancesScopedList.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetInstancesScopedList implements ApiMessage { + private final List targetInstances; + private final Warning warning; + + private TargetInstancesScopedList() { + this.targetInstances = null; + this.warning = null; + } + + private TargetInstancesScopedList(List targetInstances, Warning warning) { + this.targetInstances = targetInstances; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("targetInstances")) { + return targetInstances; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getTargetInstancesList() { + return targetInstances; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetInstancesScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetInstancesScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetInstancesScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetInstancesScopedList(); + } + + public static class Builder { + private List targetInstances; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetInstancesScopedList other) { + if (other == TargetInstancesScopedList.getDefaultInstance()) return this; + if (other.getTargetInstancesList() != null) { + this.targetInstances = other.targetInstances; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetInstancesScopedList source) { + this.targetInstances = source.targetInstances; + this.warning = source.warning; + } + + public List getTargetInstancesList() { + return targetInstances; + } + + public Builder addAllTargetInstances(List targetInstances) { + if (this.targetInstances == null) { + this.targetInstances = new ArrayList<>(targetInstances.size()); + } + this.targetInstances.addAll(targetInstances); + return this; + } + + public Builder addTargetInstances(TargetInstance targetInstances) { + this.targetInstances.add(targetInstances); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetInstancesScopedList build() { + + return new TargetInstancesScopedList(targetInstances, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllTargetInstances(this.targetInstances); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetInstancesScopedList{" + + "targetInstances=" + + targetInstances + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetInstancesScopedList) { + TargetInstancesScopedList that = (TargetInstancesScopedList) o; + return Objects.equals(this.targetInstances, that.getTargetInstancesList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(targetInstances, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPool.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPool.java new file mode 100644 index 000000000000..eec752881690 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPool.java @@ -0,0 +1,518 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetPool implements ApiMessage { + private final String backupPool; + private final String creationTimestamp; + private final String description; + private final Float failoverRatio; + private final List healthChecks; + private final String id; + private final List instances; + private final String kind; + private final String name; + private final String region; + private final String selfLink; + private final String sessionAffinity; + + private TargetPool() { + this.backupPool = null; + this.creationTimestamp = null; + this.description = null; + this.failoverRatio = null; + this.healthChecks = null; + this.id = null; + this.instances = null; + this.kind = null; + this.name = null; + this.region = null; + this.selfLink = null; + this.sessionAffinity = null; + } + + private TargetPool( + String backupPool, + String creationTimestamp, + String description, + Float failoverRatio, + List healthChecks, + String id, + List instances, + String kind, + String name, + String region, + String selfLink, + String sessionAffinity) { + this.backupPool = backupPool; + this.creationTimestamp = creationTimestamp; + this.description = description; + this.failoverRatio = failoverRatio; + this.healthChecks = healthChecks; + this.id = id; + this.instances = instances; + this.kind = kind; + this.name = name; + this.region = region; + this.selfLink = selfLink; + this.sessionAffinity = sessionAffinity; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("backupPool")) { + return backupPool; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("failoverRatio")) { + return failoverRatio; + } + if (fieldName.equals("healthChecks")) { + return healthChecks; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("instances")) { + return instances; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("sessionAffinity")) { + return sessionAffinity; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getBackupPool() { + return backupPool; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public Float getFailoverRatio() { + return failoverRatio; + } + + public List getHealthChecksList() { + return healthChecks; + } + + public String getId() { + return id; + } + + public List getInstancesList() { + return instances; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public String getSessionAffinity() { + return sessionAffinity; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetPool prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetPool getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetPool DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetPool(); + } + + public static class Builder { + private String backupPool; + private String creationTimestamp; + private String description; + private Float failoverRatio; + private List healthChecks; + private String id; + private List instances; + private String kind; + private String name; + private String region; + private String selfLink; + private String sessionAffinity; + + Builder() {} + + public Builder mergeFrom(TargetPool other) { + if (other == TargetPool.getDefaultInstance()) return this; + if (other.getBackupPool() != null) { + this.backupPool = other.backupPool; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getFailoverRatio() != null) { + this.failoverRatio = other.failoverRatio; + } + if (other.getHealthChecksList() != null) { + this.healthChecks = other.healthChecks; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSessionAffinity() != null) { + this.sessionAffinity = other.sessionAffinity; + } + return this; + } + + Builder(TargetPool source) { + this.backupPool = source.backupPool; + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.failoverRatio = source.failoverRatio; + this.healthChecks = source.healthChecks; + this.id = source.id; + this.instances = source.instances; + this.kind = source.kind; + this.name = source.name; + this.region = source.region; + this.selfLink = source.selfLink; + this.sessionAffinity = source.sessionAffinity; + } + + public String getBackupPool() { + return backupPool; + } + + public Builder setBackupPool(String backupPool) { + this.backupPool = backupPool; + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public Float getFailoverRatio() { + return failoverRatio; + } + + public Builder setFailoverRatio(Float failoverRatio) { + this.failoverRatio = failoverRatio; + return this; + } + + public List getHealthChecksList() { + return healthChecks; + } + + public Builder addAllHealthChecks(List healthChecks) { + if (this.healthChecks == null) { + this.healthChecks = new ArrayList<>(healthChecks.size()); + } + this.healthChecks.addAll(healthChecks); + return this; + } + + public Builder addHealthChecks(String healthChecks) { + this.healthChecks.add(healthChecks); + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(String instances) { + this.instances.add(instances); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getSessionAffinity() { + return sessionAffinity; + } + + public Builder setSessionAffinity(String sessionAffinity) { + this.sessionAffinity = sessionAffinity; + return this; + } + + public TargetPool build() { + + return new TargetPool( + backupPool, + creationTimestamp, + description, + failoverRatio, + healthChecks, + id, + instances, + kind, + name, + region, + selfLink, + sessionAffinity); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setBackupPool(this.backupPool); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setFailoverRatio(this.failoverRatio); + newBuilder.addAllHealthChecks(this.healthChecks); + newBuilder.setId(this.id); + newBuilder.addAllInstances(this.instances); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setSessionAffinity(this.sessionAffinity); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetPool{" + + "backupPool=" + + backupPool + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "failoverRatio=" + + failoverRatio + + ", " + + "healthChecks=" + + healthChecks + + ", " + + "id=" + + id + + ", " + + "instances=" + + instances + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + ", " + + "sessionAffinity=" + + sessionAffinity + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetPool) { + TargetPool that = (TargetPool) o; + return Objects.equals(this.backupPool, that.getBackupPool()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.failoverRatio, that.getFailoverRatio()) + && Objects.equals(this.healthChecks, that.getHealthChecksList()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.instances, that.getInstancesList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.sessionAffinity, that.getSessionAffinity()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + backupPool, + creationTimestamp, + description, + failoverRatio, + healthChecks, + id, + instances, + kind, + name, + region, + selfLink, + sessionAffinity); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolAggregatedList.java new file mode 100644 index 000000000000..52e333905b9f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetPoolAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private TargetPoolAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private TargetPoolAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetPoolAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetPoolAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetPoolAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetPoolAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetPoolAggregatedList other) { + if (other == TargetPoolAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetPoolAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetPoolAggregatedList build() { + + return new TargetPoolAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetPoolAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetPoolAggregatedList) { + TargetPoolAggregatedList that = (TargetPoolAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolClient.java new file mode 100644 index 000000000000..1b12d6b30d66 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolClient.java @@ -0,0 +1,1637 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.TargetPoolStub; +import com.google.cloud.compute.v1.stub.TargetPoolStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+ *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+ *   TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
+ *   Operation response = targetPoolClient.addHealthCheckTargetPool(targetPool, targetPoolsAddHealthCheckRequestResource);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the targetPoolClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of TargetPoolSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * TargetPoolSettings targetPoolSettings =
+ *     TargetPoolSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * TargetPoolClient targetPoolClient =
+ *     TargetPoolClient.create(targetPoolSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * TargetPoolSettings targetPoolSettings =
+ *     TargetPoolSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * TargetPoolClient targetPoolClient =
+ *     TargetPoolClient.create(targetPoolSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetPoolClient implements BackgroundResource { + private final TargetPoolSettings settings; + private final TargetPoolStub stub; + + /** Constructs an instance of TargetPoolClient with default settings. */ + public static final TargetPoolClient create() throws IOException { + return create(TargetPoolSettings.newBuilder().build()); + } + + /** + * Constructs an instance of TargetPoolClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final TargetPoolClient create(TargetPoolSettings settings) throws IOException { + return new TargetPoolClient(settings); + } + + /** + * Constructs an instance of TargetPoolClient, using the given stub for making calls. This is for + * advanced usage - prefer to use TargetPoolSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final TargetPoolClient create(TargetPoolStub stub) { + return new TargetPoolClient(stub); + } + + /** + * Constructs an instance of TargetPoolClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected TargetPoolClient(TargetPoolSettings settings) throws IOException { + this.settings = settings; + this.stub = ((TargetPoolStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected TargetPoolClient(TargetPoolStub stub) { + this.settings = null; + this.stub = stub; + } + + public final TargetPoolSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetPoolStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds health check URLs to a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
+   *   Operation response = targetPoolClient.addHealthCheckTargetPool(targetPool, targetPoolsAddHealthCheckRequestResource);
+   * }
+   * 
+ * + * @param targetPool Name of the target pool to add a health check to. + * @param targetPoolsAddHealthCheckRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addHealthCheckTargetPool( + ProjectRegionTargetPoolName targetPool, + TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource) { + + AddHealthCheckTargetPoolHttpRequest request = + AddHealthCheckTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool == null ? null : targetPool.toString()) + .setTargetPoolsAddHealthCheckRequestResource(targetPoolsAddHealthCheckRequestResource) + .build(); + return addHealthCheckTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds health check URLs to a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
+   *   Operation response = targetPoolClient.addHealthCheckTargetPool(targetPool.toString(), targetPoolsAddHealthCheckRequestResource);
+   * }
+   * 
+ * + * @param targetPool Name of the target pool to add a health check to. + * @param targetPoolsAddHealthCheckRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addHealthCheckTargetPool( + String targetPool, + TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource) { + + AddHealthCheckTargetPoolHttpRequest request = + AddHealthCheckTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool) + .setTargetPoolsAddHealthCheckRequestResource(targetPoolsAddHealthCheckRequestResource) + .build(); + return addHealthCheckTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds health check URLs to a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
+   *   AddHealthCheckTargetPoolHttpRequest request = AddHealthCheckTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setTargetPoolsAddHealthCheckRequestResource(targetPoolsAddHealthCheckRequestResource)
+   *     .build();
+   *   Operation response = targetPoolClient.addHealthCheckTargetPool(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addHealthCheckTargetPool(AddHealthCheckTargetPoolHttpRequest request) { + return addHealthCheckTargetPoolCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds health check URLs to a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
+   *   AddHealthCheckTargetPoolHttpRequest request = AddHealthCheckTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setTargetPoolsAddHealthCheckRequestResource(targetPoolsAddHealthCheckRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetPoolClient.addHealthCheckTargetPoolCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + addHealthCheckTargetPoolCallable() { + return stub.addHealthCheckTargetPoolCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds an instance to a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = TargetPoolsAddInstanceRequest.newBuilder().build();
+   *   Operation response = targetPoolClient.addInstanceTargetPool(targetPool, targetPoolsAddInstanceRequestResource);
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to add instances to. + * @param targetPoolsAddInstanceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addInstanceTargetPool( + ProjectRegionTargetPoolName targetPool, + TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource) { + + AddInstanceTargetPoolHttpRequest request = + AddInstanceTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool == null ? null : targetPool.toString()) + .setTargetPoolsAddInstanceRequestResource(targetPoolsAddInstanceRequestResource) + .build(); + return addInstanceTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds an instance to a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = TargetPoolsAddInstanceRequest.newBuilder().build();
+   *   Operation response = targetPoolClient.addInstanceTargetPool(targetPool.toString(), targetPoolsAddInstanceRequestResource);
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to add instances to. + * @param targetPoolsAddInstanceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addInstanceTargetPool( + String targetPool, TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource) { + + AddInstanceTargetPoolHttpRequest request = + AddInstanceTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool) + .setTargetPoolsAddInstanceRequestResource(targetPoolsAddInstanceRequestResource) + .build(); + return addInstanceTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds an instance to a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = TargetPoolsAddInstanceRequest.newBuilder().build();
+   *   AddInstanceTargetPoolHttpRequest request = AddInstanceTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setTargetPoolsAddInstanceRequestResource(targetPoolsAddInstanceRequestResource)
+   *     .build();
+   *   Operation response = targetPoolClient.addInstanceTargetPool(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation addInstanceTargetPool(AddInstanceTargetPoolHttpRequest request) { + return addInstanceTargetPoolCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Adds an instance to a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = TargetPoolsAddInstanceRequest.newBuilder().build();
+   *   AddInstanceTargetPoolHttpRequest request = AddInstanceTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setTargetPoolsAddInstanceRequestResource(targetPoolsAddInstanceRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetPoolClient.addInstanceTargetPoolCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + addInstanceTargetPoolCallable() { + return stub.addInstanceTargetPoolCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target pools. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetPoolsScopedList element : targetPoolClient.aggregatedListTargetPools(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListTargetPoolsPagedResponse aggregatedListTargetPools( + ProjectName project) { + AggregatedListTargetPoolsHttpRequest request = + AggregatedListTargetPoolsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListTargetPools(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target pools. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetPoolsScopedList element : targetPoolClient.aggregatedListTargetPools(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListTargetPoolsPagedResponse aggregatedListTargetPools(String project) { + AggregatedListTargetPoolsHttpRequest request = + AggregatedListTargetPoolsHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListTargetPools(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target pools. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListTargetPoolsHttpRequest request = AggregatedListTargetPoolsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (TargetPoolsScopedList element : targetPoolClient.aggregatedListTargetPools(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListTargetPoolsPagedResponse aggregatedListTargetPools( + AggregatedListTargetPoolsHttpRequest request) { + return aggregatedListTargetPoolsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target pools. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListTargetPoolsHttpRequest request = AggregatedListTargetPoolsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListTargetPoolsPagedResponse> future = targetPoolClient.aggregatedListTargetPoolsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (TargetPoolsScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListTargetPoolsHttpRequest, AggregatedListTargetPoolsPagedResponse> + aggregatedListTargetPoolsPagedCallable() { + return stub.aggregatedListTargetPoolsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target pools. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListTargetPoolsHttpRequest request = AggregatedListTargetPoolsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     TargetPoolAggregatedList response = targetPoolClient.aggregatedListTargetPoolsCallable().call(request);
+   *     for (TargetPoolsScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListTargetPoolsCallable() { + return stub.aggregatedListTargetPoolsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   Operation response = targetPoolClient.deleteTargetPool(targetPool);
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetPool(ProjectRegionTargetPoolName targetPool) { + + DeleteTargetPoolHttpRequest request = + DeleteTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool == null ? null : targetPool.toString()) + .build(); + return deleteTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   Operation response = targetPoolClient.deleteTargetPool(targetPool.toString());
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetPool(String targetPool) { + + DeleteTargetPoolHttpRequest request = + DeleteTargetPoolHttpRequest.newBuilder().setTargetPool(targetPool).build(); + return deleteTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   DeleteTargetPoolHttpRequest request = DeleteTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .build();
+   *   Operation response = targetPoolClient.deleteTargetPool(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetPool(DeleteTargetPoolHttpRequest request) { + return deleteTargetPoolCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   DeleteTargetPoolHttpRequest request = DeleteTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = targetPoolClient.deleteTargetPoolCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteTargetPoolCallable() { + return stub.deleteTargetPoolCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified target pool. Gets a list of available target pools by making a list() + * request. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPool response = targetPoolClient.getTargetPool(targetPool);
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetPool getTargetPool(ProjectRegionTargetPoolName targetPool) { + + GetTargetPoolHttpRequest request = + GetTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool == null ? null : targetPool.toString()) + .build(); + return getTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified target pool. Gets a list of available target pools by making a list() + * request. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPool response = targetPoolClient.getTargetPool(targetPool.toString());
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetPool getTargetPool(String targetPool) { + + GetTargetPoolHttpRequest request = + GetTargetPoolHttpRequest.newBuilder().setTargetPool(targetPool).build(); + return getTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified target pool. Gets a list of available target pools by making a list() + * request. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   GetTargetPoolHttpRequest request = GetTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .build();
+   *   TargetPool response = targetPoolClient.getTargetPool(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetPool getTargetPool(GetTargetPoolHttpRequest request) { + return getTargetPoolCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified target pool. Gets a list of available target pools by making a list() + * request. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   GetTargetPoolHttpRequest request = GetTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .build();
+   *   ApiFuture<TargetPool> future = targetPoolClient.getTargetPoolCallable().futureCall(request);
+   *   // Do something
+   *   TargetPool response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getTargetPoolCallable() { + return stub.getTargetPoolCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for each IP for the instance that is referenced by + * the given target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build();
+   *   TargetPoolInstanceHealth response = targetPoolClient.getHealthTargetPool(targetPool, instanceReferenceResource);
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to which the queried instance belongs. + * @param instanceReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetPoolInstanceHealth getHealthTargetPool( + ProjectRegionTargetPoolName targetPool, InstanceReference instanceReferenceResource) { + + GetHealthTargetPoolHttpRequest request = + GetHealthTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool == null ? null : targetPool.toString()) + .setInstanceReferenceResource(instanceReferenceResource) + .build(); + return getHealthTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for each IP for the instance that is referenced by + * the given target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build();
+   *   TargetPoolInstanceHealth response = targetPoolClient.getHealthTargetPool(targetPool.toString(), instanceReferenceResource);
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to which the queried instance belongs. + * @param instanceReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetPoolInstanceHealth getHealthTargetPool( + String targetPool, InstanceReference instanceReferenceResource) { + + GetHealthTargetPoolHttpRequest request = + GetHealthTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool) + .setInstanceReferenceResource(instanceReferenceResource) + .build(); + return getHealthTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for each IP for the instance that is referenced by + * the given target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build();
+   *   GetHealthTargetPoolHttpRequest request = GetHealthTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setInstanceReferenceResource(instanceReferenceResource)
+   *     .build();
+   *   TargetPoolInstanceHealth response = targetPoolClient.getHealthTargetPool(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetPoolInstanceHealth getHealthTargetPool( + GetHealthTargetPoolHttpRequest request) { + return getHealthTargetPoolCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the most recent health check results for each IP for the instance that is referenced by + * the given target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build();
+   *   GetHealthTargetPoolHttpRequest request = GetHealthTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setInstanceReferenceResource(instanceReferenceResource)
+   *     .build();
+   *   ApiFuture<TargetPoolInstanceHealth> future = targetPoolClient.getHealthTargetPoolCallable().futureCall(request);
+   *   // Do something
+   *   TargetPoolInstanceHealth response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getHealthTargetPoolCallable() { + return stub.getHealthTargetPoolCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a target pool in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   TargetPool targetPoolResource = TargetPool.newBuilder().build();
+   *   Operation response = targetPoolClient.insertTargetPool(region, targetPoolResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param targetPoolResource A TargetPool resource. This resource defines a pool of instances, an + * associated HttpHealthCheck resource, and the fallback target pool. (== resource_for + * beta.targetPools ==) (== resource_for v1.targetPools ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetPool(ProjectRegionName region, TargetPool targetPoolResource) { + + InsertTargetPoolHttpRequest request = + InsertTargetPoolHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setTargetPoolResource(targetPoolResource) + .build(); + return insertTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a target pool in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   TargetPool targetPoolResource = TargetPool.newBuilder().build();
+   *   Operation response = targetPoolClient.insertTargetPool(region.toString(), targetPoolResource);
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @param targetPoolResource A TargetPool resource. This resource defines a pool of instances, an + * associated HttpHealthCheck resource, and the fallback target pool. (== resource_for + * beta.targetPools ==) (== resource_for v1.targetPools ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetPool(String region, TargetPool targetPoolResource) { + + InsertTargetPoolHttpRequest request = + InsertTargetPoolHttpRequest.newBuilder() + .setRegion(region) + .setTargetPoolResource(targetPoolResource) + .build(); + return insertTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a target pool in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   TargetPool targetPoolResource = TargetPool.newBuilder().build();
+   *   InsertTargetPoolHttpRequest request = InsertTargetPoolHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setTargetPoolResource(targetPoolResource)
+   *     .build();
+   *   Operation response = targetPoolClient.insertTargetPool(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetPool(InsertTargetPoolHttpRequest request) { + return insertTargetPoolCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a target pool in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   TargetPool targetPoolResource = TargetPool.newBuilder().build();
+   *   InsertTargetPoolHttpRequest request = InsertTargetPoolHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setTargetPoolResource(targetPoolResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetPoolClient.insertTargetPoolCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertTargetPoolCallable() { + return stub.insertTargetPoolCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of target pools available to the specified project and region. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (TargetPool element : targetPoolClient.listTargetPools(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetPoolsPagedResponse listTargetPools(ProjectRegionName region) { + ListTargetPoolsHttpRequest request = + ListTargetPoolsHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listTargetPools(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of target pools available to the specified project and region. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (TargetPool element : targetPoolClient.listTargetPools(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region scoping this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetPoolsPagedResponse listTargetPools(String region) { + ListTargetPoolsHttpRequest request = + ListTargetPoolsHttpRequest.newBuilder().setRegion(region).build(); + return listTargetPools(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of target pools available to the specified project and region. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListTargetPoolsHttpRequest request = ListTargetPoolsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (TargetPool element : targetPoolClient.listTargetPools(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetPoolsPagedResponse listTargetPools(ListTargetPoolsHttpRequest request) { + return listTargetPoolsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of target pools available to the specified project and region. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListTargetPoolsHttpRequest request = ListTargetPoolsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListTargetPoolsPagedResponse> future = targetPoolClient.listTargetPoolsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (TargetPool element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetPoolsPagedCallable() { + return stub.listTargetPoolsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of target pools available to the specified project and region. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListTargetPoolsHttpRequest request = ListTargetPoolsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     TargetPoolList response = targetPoolClient.listTargetPoolsCallable().call(request);
+   *     for (TargetPool element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listTargetPoolsCallable() { + return stub.listTargetPoolsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes health check URL from a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = TargetPoolsRemoveHealthCheckRequest.newBuilder().build();
+   *   Operation response = targetPoolClient.removeHealthCheckTargetPool(targetPool, targetPoolsRemoveHealthCheckRequestResource);
+   * }
+   * 
+ * + * @param targetPool Name of the target pool to remove health checks from. + * @param targetPoolsRemoveHealthCheckRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removeHealthCheckTargetPool( + ProjectRegionTargetPoolName targetPool, + TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource) { + + RemoveHealthCheckTargetPoolHttpRequest request = + RemoveHealthCheckTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool == null ? null : targetPool.toString()) + .setTargetPoolsRemoveHealthCheckRequestResource( + targetPoolsRemoveHealthCheckRequestResource) + .build(); + return removeHealthCheckTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes health check URL from a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = TargetPoolsRemoveHealthCheckRequest.newBuilder().build();
+   *   Operation response = targetPoolClient.removeHealthCheckTargetPool(targetPool.toString(), targetPoolsRemoveHealthCheckRequestResource);
+   * }
+   * 
+ * + * @param targetPool Name of the target pool to remove health checks from. + * @param targetPoolsRemoveHealthCheckRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removeHealthCheckTargetPool( + String targetPool, + TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource) { + + RemoveHealthCheckTargetPoolHttpRequest request = + RemoveHealthCheckTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool) + .setTargetPoolsRemoveHealthCheckRequestResource( + targetPoolsRemoveHealthCheckRequestResource) + .build(); + return removeHealthCheckTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes health check URL from a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = TargetPoolsRemoveHealthCheckRequest.newBuilder().build();
+   *   RemoveHealthCheckTargetPoolHttpRequest request = RemoveHealthCheckTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setTargetPoolsRemoveHealthCheckRequestResource(targetPoolsRemoveHealthCheckRequestResource)
+   *     .build();
+   *   Operation response = targetPoolClient.removeHealthCheckTargetPool(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removeHealthCheckTargetPool( + RemoveHealthCheckTargetPoolHttpRequest request) { + return removeHealthCheckTargetPoolCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes health check URL from a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = TargetPoolsRemoveHealthCheckRequest.newBuilder().build();
+   *   RemoveHealthCheckTargetPoolHttpRequest request = RemoveHealthCheckTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setTargetPoolsRemoveHealthCheckRequestResource(targetPoolsRemoveHealthCheckRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetPoolClient.removeHealthCheckTargetPoolCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + removeHealthCheckTargetPoolCallable() { + return stub.removeHealthCheckTargetPoolCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes instance URL from a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = TargetPoolsRemoveInstanceRequest.newBuilder().build();
+   *   Operation response = targetPoolClient.removeInstanceTargetPool(targetPool, targetPoolsRemoveInstanceRequestResource);
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to remove instances from. + * @param targetPoolsRemoveInstanceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removeInstanceTargetPool( + ProjectRegionTargetPoolName targetPool, + TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource) { + + RemoveInstanceTargetPoolHttpRequest request = + RemoveInstanceTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool == null ? null : targetPool.toString()) + .setTargetPoolsRemoveInstanceRequestResource(targetPoolsRemoveInstanceRequestResource) + .build(); + return removeInstanceTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes instance URL from a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = TargetPoolsRemoveInstanceRequest.newBuilder().build();
+   *   Operation response = targetPoolClient.removeInstanceTargetPool(targetPool.toString(), targetPoolsRemoveInstanceRequestResource);
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to remove instances from. + * @param targetPoolsRemoveInstanceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removeInstanceTargetPool( + String targetPool, + TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource) { + + RemoveInstanceTargetPoolHttpRequest request = + RemoveInstanceTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool) + .setTargetPoolsRemoveInstanceRequestResource(targetPoolsRemoveInstanceRequestResource) + .build(); + return removeInstanceTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes instance URL from a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = TargetPoolsRemoveInstanceRequest.newBuilder().build();
+   *   RemoveInstanceTargetPoolHttpRequest request = RemoveInstanceTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setTargetPoolsRemoveInstanceRequestResource(targetPoolsRemoveInstanceRequestResource)
+   *     .build();
+   *   Operation response = targetPoolClient.removeInstanceTargetPool(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation removeInstanceTargetPool(RemoveInstanceTargetPoolHttpRequest request) { + return removeInstanceTargetPoolCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes instance URL from a target pool. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = TargetPoolsRemoveInstanceRequest.newBuilder().build();
+   *   RemoveInstanceTargetPoolHttpRequest request = RemoveInstanceTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setTargetPoolsRemoveInstanceRequestResource(targetPoolsRemoveInstanceRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetPoolClient.removeInstanceTargetPoolCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + removeInstanceTargetPoolCallable() { + return stub.removeInstanceTargetPoolCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes a backup target pool's configurations. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   Float failoverRatio = 0;
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   Operation response = targetPoolClient.setBackupTargetPool(targetPool, failoverRatio, targetReferenceResource);
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to set a backup pool for. + * @param failoverRatio New failoverRatio value for the target pool. + * @param targetReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setBackupTargetPool( + ProjectRegionTargetPoolName targetPool, + Float failoverRatio, + TargetReference targetReferenceResource) { + + SetBackupTargetPoolHttpRequest request = + SetBackupTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool == null ? null : targetPool.toString()) + .setFailoverRatio(failoverRatio) + .setTargetReferenceResource(targetReferenceResource) + .build(); + return setBackupTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes a backup target pool's configurations. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   Float failoverRatio = 0;
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   Operation response = targetPoolClient.setBackupTargetPool(targetPool.toString(), failoverRatio, targetReferenceResource);
+   * }
+   * 
+ * + * @param targetPool Name of the TargetPool resource to set a backup pool for. + * @param failoverRatio New failoverRatio value for the target pool. + * @param targetReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setBackupTargetPool( + String targetPool, Float failoverRatio, TargetReference targetReferenceResource) { + + SetBackupTargetPoolHttpRequest request = + SetBackupTargetPoolHttpRequest.newBuilder() + .setTargetPool(targetPool) + .setFailoverRatio(failoverRatio) + .setTargetReferenceResource(targetReferenceResource) + .build(); + return setBackupTargetPool(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes a backup target pool's configurations. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   Float failoverRatio = 0;
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   SetBackupTargetPoolHttpRequest request = SetBackupTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setFailoverRatio(failoverRatio)
+   *     .setTargetReferenceResource(targetReferenceResource)
+   *     .build();
+   *   Operation response = targetPoolClient.setBackupTargetPool(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setBackupTargetPool(SetBackupTargetPoolHttpRequest request) { + return setBackupTargetPoolCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes a backup target pool's configurations. + * + *

Sample code: + * + *


+   * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+   *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+   *   Float failoverRatio = 0;
+   *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
+   *   SetBackupTargetPoolHttpRequest request = SetBackupTargetPoolHttpRequest.newBuilder()
+   *     .setTargetPool(targetPool.toString())
+   *     .setFailoverRatio(failoverRatio)
+   *     .setTargetReferenceResource(targetReferenceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetPoolClient.setBackupTargetPoolCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setBackupTargetPoolCallable() { + return stub.setBackupTargetPoolCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListTargetPoolsPagedResponse + extends AbstractPagedListResponse< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, TargetPoolsScopedList, + AggregatedListTargetPoolsPage, AggregatedListTargetPoolsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + TargetPoolsScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListTargetPoolsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public AggregatedListTargetPoolsPagedResponse apply( + AggregatedListTargetPoolsPage input) { + return new AggregatedListTargetPoolsPagedResponse(input); + } + }); + } + + private AggregatedListTargetPoolsPagedResponse(AggregatedListTargetPoolsPage page) { + super(page, AggregatedListTargetPoolsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListTargetPoolsPage + extends AbstractPage< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, TargetPoolsScopedList, + AggregatedListTargetPoolsPage> { + + private AggregatedListTargetPoolsPage( + PageContext< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + TargetPoolsScopedList> + context, + TargetPoolAggregatedList response) { + super(context, response); + } + + private static AggregatedListTargetPoolsPage createEmptyPage() { + return new AggregatedListTargetPoolsPage(null, null); + } + + @Override + protected AggregatedListTargetPoolsPage createPage( + PageContext< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + TargetPoolsScopedList> + context, + TargetPoolAggregatedList response) { + return new AggregatedListTargetPoolsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + TargetPoolsScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListTargetPoolsFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, TargetPoolsScopedList, + AggregatedListTargetPoolsPage, AggregatedListTargetPoolsFixedSizeCollection> { + + private AggregatedListTargetPoolsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListTargetPoolsFixedSizeCollection createEmptyCollection() { + return new AggregatedListTargetPoolsFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListTargetPoolsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListTargetPoolsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListTargetPoolsPagedResponse + extends AbstractPagedListResponse< + ListTargetPoolsHttpRequest, TargetPoolList, TargetPool, ListTargetPoolsPage, + ListTargetPoolsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListTargetPoolsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListTargetPoolsPagedResponse apply(ListTargetPoolsPage input) { + return new ListTargetPoolsPagedResponse(input); + } + }); + } + + private ListTargetPoolsPagedResponse(ListTargetPoolsPage page) { + super(page, ListTargetPoolsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListTargetPoolsPage + extends AbstractPage< + ListTargetPoolsHttpRequest, TargetPoolList, TargetPool, ListTargetPoolsPage> { + + private ListTargetPoolsPage( + PageContext context, + TargetPoolList response) { + super(context, response); + } + + private static ListTargetPoolsPage createEmptyPage() { + return new ListTargetPoolsPage(null, null); + } + + @Override + protected ListTargetPoolsPage createPage( + PageContext context, + TargetPoolList response) { + return new ListTargetPoolsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListTargetPoolsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListTargetPoolsHttpRequest, TargetPoolList, TargetPool, ListTargetPoolsPage, + ListTargetPoolsFixedSizeCollection> { + + private ListTargetPoolsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListTargetPoolsFixedSizeCollection createEmptyCollection() { + return new ListTargetPoolsFixedSizeCollection(null, 0); + } + + @Override + protected ListTargetPoolsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListTargetPoolsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolInstanceHealth.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolInstanceHealth.java new file mode 100644 index 000000000000..4cf8e8c1d042 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolInstanceHealth.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetPoolInstanceHealth implements ApiMessage { + private final List healthStatus; + private final String kind; + + private TargetPoolInstanceHealth() { + this.healthStatus = null; + this.kind = null; + } + + private TargetPoolInstanceHealth(List healthStatus, String kind) { + this.healthStatus = healthStatus; + this.kind = kind; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("healthStatus")) { + return healthStatus; + } + if (fieldName.equals("kind")) { + return kind; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getHealthStatusList() { + return healthStatus; + } + + public String getKind() { + return kind; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetPoolInstanceHealth prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetPoolInstanceHealth getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetPoolInstanceHealth DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetPoolInstanceHealth(); + } + + public static class Builder { + private List healthStatus; + private String kind; + + Builder() {} + + public Builder mergeFrom(TargetPoolInstanceHealth other) { + if (other == TargetPoolInstanceHealth.getDefaultInstance()) return this; + if (other.getHealthStatusList() != null) { + this.healthStatus = other.healthStatus; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + return this; + } + + Builder(TargetPoolInstanceHealth source) { + this.healthStatus = source.healthStatus; + this.kind = source.kind; + } + + public List getHealthStatusList() { + return healthStatus; + } + + public Builder addAllHealthStatus(List healthStatus) { + if (this.healthStatus == null) { + this.healthStatus = new ArrayList<>(healthStatus.size()); + } + this.healthStatus.addAll(healthStatus); + return this; + } + + public Builder addHealthStatus(HealthStatus healthStatus) { + this.healthStatus.add(healthStatus); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public TargetPoolInstanceHealth build() { + + return new TargetPoolInstanceHealth(healthStatus, kind); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllHealthStatus(this.healthStatus); + newBuilder.setKind(this.kind); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetPoolInstanceHealth{" + + "healthStatus=" + + healthStatus + + ", " + + "kind=" + + kind + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetPoolInstanceHealth) { + TargetPoolInstanceHealth that = (TargetPoolInstanceHealth) o; + return Objects.equals(this.healthStatus, that.getHealthStatusList()) + && Objects.equals(this.kind, that.getKind()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(healthStatus, kind); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolList.java new file mode 100644 index 000000000000..60e4057ef6b9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetPoolList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private TargetPoolList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private TargetPoolList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetPoolList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetPoolList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetPoolList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetPoolList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetPoolList other) { + if (other == TargetPoolList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetPoolList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(TargetPool items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetPoolList build() { + + return new TargetPoolList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetPoolList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetPoolList) { + TargetPoolList that = (TargetPoolList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolSettings.java new file mode 100644 index 000000000000..e4030326f0eb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolSettings.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetPoolClient.AggregatedListTargetPoolsPagedResponse; +import static com.google.cloud.compute.v1.TargetPoolClient.ListTargetPoolsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.TargetPoolStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetPoolClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of addHealthCheckTargetPool to 30 seconds: + * + *

+ * 
+ * TargetPoolSettings.Builder targetPoolSettingsBuilder =
+ *     TargetPoolSettings.newBuilder();
+ * targetPoolSettingsBuilder.addHealthCheckTargetPoolSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetPoolSettings targetPoolSettings = targetPoolSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetPoolSettings extends ClientSettings { + /** Returns the object with the settings used for calls to addHealthCheckTargetPool. */ + public UnaryCallSettings + addHealthCheckTargetPoolSettings() { + return ((TargetPoolStubSettings) getStubSettings()).addHealthCheckTargetPoolSettings(); + } + + /** Returns the object with the settings used for calls to addInstanceTargetPool. */ + public UnaryCallSettings + addInstanceTargetPoolSettings() { + return ((TargetPoolStubSettings) getStubSettings()).addInstanceTargetPoolSettings(); + } + + /** Returns the object with the settings used for calls to aggregatedListTargetPools. */ + public PagedCallSettings< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + AggregatedListTargetPoolsPagedResponse> + aggregatedListTargetPoolsSettings() { + return ((TargetPoolStubSettings) getStubSettings()).aggregatedListTargetPoolsSettings(); + } + + /** Returns the object with the settings used for calls to deleteTargetPool. */ + public UnaryCallSettings deleteTargetPoolSettings() { + return ((TargetPoolStubSettings) getStubSettings()).deleteTargetPoolSettings(); + } + + /** Returns the object with the settings used for calls to getTargetPool. */ + public UnaryCallSettings getTargetPoolSettings() { + return ((TargetPoolStubSettings) getStubSettings()).getTargetPoolSettings(); + } + + /** Returns the object with the settings used for calls to getHealthTargetPool. */ + public UnaryCallSettings + getHealthTargetPoolSettings() { + return ((TargetPoolStubSettings) getStubSettings()).getHealthTargetPoolSettings(); + } + + /** Returns the object with the settings used for calls to insertTargetPool. */ + public UnaryCallSettings insertTargetPoolSettings() { + return ((TargetPoolStubSettings) getStubSettings()).insertTargetPoolSettings(); + } + + /** Returns the object with the settings used for calls to listTargetPools. */ + public PagedCallSettings + listTargetPoolsSettings() { + return ((TargetPoolStubSettings) getStubSettings()).listTargetPoolsSettings(); + } + + /** Returns the object with the settings used for calls to removeHealthCheckTargetPool. */ + public UnaryCallSettings + removeHealthCheckTargetPoolSettings() { + return ((TargetPoolStubSettings) getStubSettings()).removeHealthCheckTargetPoolSettings(); + } + + /** Returns the object with the settings used for calls to removeInstanceTargetPool. */ + public UnaryCallSettings + removeInstanceTargetPoolSettings() { + return ((TargetPoolStubSettings) getStubSettings()).removeInstanceTargetPoolSettings(); + } + + /** Returns the object with the settings used for calls to setBackupTargetPool. */ + public UnaryCallSettings + setBackupTargetPoolSettings() { + return ((TargetPoolStubSettings) getStubSettings()).setBackupTargetPoolSettings(); + } + + public static final TargetPoolSettings create(TargetPoolStubSettings stub) throws IOException { + return new TargetPoolSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return TargetPoolStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return TargetPoolStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return TargetPoolStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return TargetPoolStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return TargetPoolStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return TargetPoolStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return TargetPoolStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TargetPoolStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetPoolSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for TargetPoolSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(TargetPoolStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(TargetPoolStubSettings.newBuilder()); + } + + protected Builder(TargetPoolSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(TargetPoolStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public TargetPoolStubSettings.Builder getStubSettingsBuilder() { + return ((TargetPoolStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to addHealthCheckTargetPool. */ + public UnaryCallSettings.Builder + addHealthCheckTargetPoolSettings() { + return getStubSettingsBuilder().addHealthCheckTargetPoolSettings(); + } + + /** Returns the builder for the settings used for calls to addInstanceTargetPool. */ + public UnaryCallSettings.Builder + addInstanceTargetPoolSettings() { + return getStubSettingsBuilder().addInstanceTargetPoolSettings(); + } + + /** Returns the builder for the settings used for calls to aggregatedListTargetPools. */ + public PagedCallSettings.Builder< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + AggregatedListTargetPoolsPagedResponse> + aggregatedListTargetPoolsSettings() { + return getStubSettingsBuilder().aggregatedListTargetPoolsSettings(); + } + + /** Returns the builder for the settings used for calls to deleteTargetPool. */ + public UnaryCallSettings.Builder + deleteTargetPoolSettings() { + return getStubSettingsBuilder().deleteTargetPoolSettings(); + } + + /** Returns the builder for the settings used for calls to getTargetPool. */ + public UnaryCallSettings.Builder getTargetPoolSettings() { + return getStubSettingsBuilder().getTargetPoolSettings(); + } + + /** Returns the builder for the settings used for calls to getHealthTargetPool. */ + public UnaryCallSettings.Builder + getHealthTargetPoolSettings() { + return getStubSettingsBuilder().getHealthTargetPoolSettings(); + } + + /** Returns the builder for the settings used for calls to insertTargetPool. */ + public UnaryCallSettings.Builder + insertTargetPoolSettings() { + return getStubSettingsBuilder().insertTargetPoolSettings(); + } + + /** Returns the builder for the settings used for calls to listTargetPools. */ + public PagedCallSettings.Builder< + ListTargetPoolsHttpRequest, TargetPoolList, ListTargetPoolsPagedResponse> + listTargetPoolsSettings() { + return getStubSettingsBuilder().listTargetPoolsSettings(); + } + + /** Returns the builder for the settings used for calls to removeHealthCheckTargetPool. */ + public UnaryCallSettings.Builder + removeHealthCheckTargetPoolSettings() { + return getStubSettingsBuilder().removeHealthCheckTargetPoolSettings(); + } + + /** Returns the builder for the settings used for calls to removeInstanceTargetPool. */ + public UnaryCallSettings.Builder + removeInstanceTargetPoolSettings() { + return getStubSettingsBuilder().removeInstanceTargetPoolSettings(); + } + + /** Returns the builder for the settings used for calls to setBackupTargetPool. */ + public UnaryCallSettings.Builder + setBackupTargetPoolSettings() { + return getStubSettingsBuilder().setBackupTargetPoolSettings(); + } + + @Override + public TargetPoolSettings build() throws IOException { + return new TargetPoolSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsAddHealthCheckRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsAddHealthCheckRequest.java new file mode 100644 index 000000000000..d572f8a1be3f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsAddHealthCheckRequest.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetPoolsAddHealthCheckRequest implements ApiMessage { + private final List healthChecks; + + private TargetPoolsAddHealthCheckRequest() { + this.healthChecks = null; + } + + private TargetPoolsAddHealthCheckRequest(List healthChecks) { + this.healthChecks = healthChecks; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("healthChecks")) { + return healthChecks; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getHealthChecksList() { + return healthChecks; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetPoolsAddHealthCheckRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetPoolsAddHealthCheckRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetPoolsAddHealthCheckRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetPoolsAddHealthCheckRequest(); + } + + public static class Builder { + private List healthChecks; + + Builder() {} + + public Builder mergeFrom(TargetPoolsAddHealthCheckRequest other) { + if (other == TargetPoolsAddHealthCheckRequest.getDefaultInstance()) return this; + if (other.getHealthChecksList() != null) { + this.healthChecks = other.healthChecks; + } + return this; + } + + Builder(TargetPoolsAddHealthCheckRequest source) { + this.healthChecks = source.healthChecks; + } + + public List getHealthChecksList() { + return healthChecks; + } + + public Builder addAllHealthChecks(List healthChecks) { + if (this.healthChecks == null) { + this.healthChecks = new ArrayList<>(healthChecks.size()); + } + this.healthChecks.addAll(healthChecks); + return this; + } + + public Builder addHealthChecks(HealthCheckReference healthChecks) { + this.healthChecks.add(healthChecks); + return this; + } + + public TargetPoolsAddHealthCheckRequest build() { + return new TargetPoolsAddHealthCheckRequest(healthChecks); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllHealthChecks(this.healthChecks); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetPoolsAddHealthCheckRequest{" + "healthChecks=" + healthChecks + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetPoolsAddHealthCheckRequest) { + TargetPoolsAddHealthCheckRequest that = (TargetPoolsAddHealthCheckRequest) o; + return Objects.equals(this.healthChecks, that.getHealthChecksList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(healthChecks); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsAddInstanceRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsAddInstanceRequest.java new file mode 100644 index 000000000000..5899ad2cbe74 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsAddInstanceRequest.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetPoolsAddInstanceRequest implements ApiMessage { + private final List instances; + + private TargetPoolsAddInstanceRequest() { + this.instances = null; + } + + private TargetPoolsAddInstanceRequest(List instances) { + this.instances = instances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instances")) { + return instances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstancesList() { + return instances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetPoolsAddInstanceRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetPoolsAddInstanceRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetPoolsAddInstanceRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetPoolsAddInstanceRequest(); + } + + public static class Builder { + private List instances; + + Builder() {} + + public Builder mergeFrom(TargetPoolsAddInstanceRequest other) { + if (other == TargetPoolsAddInstanceRequest.getDefaultInstance()) return this; + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + return this; + } + + Builder(TargetPoolsAddInstanceRequest source) { + this.instances = source.instances; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(InstanceReference instances) { + this.instances.add(instances); + return this; + } + + public TargetPoolsAddInstanceRequest build() { + return new TargetPoolsAddInstanceRequest(instances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstances(this.instances); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetPoolsAddInstanceRequest{" + "instances=" + instances + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetPoolsAddInstanceRequest) { + TargetPoolsAddInstanceRequest that = (TargetPoolsAddInstanceRequest) o; + return Objects.equals(this.instances, that.getInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsRemoveHealthCheckRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsRemoveHealthCheckRequest.java new file mode 100644 index 000000000000..dbeb40723bee --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsRemoveHealthCheckRequest.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetPoolsRemoveHealthCheckRequest implements ApiMessage { + private final List healthChecks; + + private TargetPoolsRemoveHealthCheckRequest() { + this.healthChecks = null; + } + + private TargetPoolsRemoveHealthCheckRequest(List healthChecks) { + this.healthChecks = healthChecks; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("healthChecks")) { + return healthChecks; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getHealthChecksList() { + return healthChecks; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetPoolsRemoveHealthCheckRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetPoolsRemoveHealthCheckRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetPoolsRemoveHealthCheckRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetPoolsRemoveHealthCheckRequest(); + } + + public static class Builder { + private List healthChecks; + + Builder() {} + + public Builder mergeFrom(TargetPoolsRemoveHealthCheckRequest other) { + if (other == TargetPoolsRemoveHealthCheckRequest.getDefaultInstance()) return this; + if (other.getHealthChecksList() != null) { + this.healthChecks = other.healthChecks; + } + return this; + } + + Builder(TargetPoolsRemoveHealthCheckRequest source) { + this.healthChecks = source.healthChecks; + } + + public List getHealthChecksList() { + return healthChecks; + } + + public Builder addAllHealthChecks(List healthChecks) { + if (this.healthChecks == null) { + this.healthChecks = new ArrayList<>(healthChecks.size()); + } + this.healthChecks.addAll(healthChecks); + return this; + } + + public Builder addHealthChecks(HealthCheckReference healthChecks) { + this.healthChecks.add(healthChecks); + return this; + } + + public TargetPoolsRemoveHealthCheckRequest build() { + return new TargetPoolsRemoveHealthCheckRequest(healthChecks); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllHealthChecks(this.healthChecks); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetPoolsRemoveHealthCheckRequest{" + "healthChecks=" + healthChecks + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetPoolsRemoveHealthCheckRequest) { + TargetPoolsRemoveHealthCheckRequest that = (TargetPoolsRemoveHealthCheckRequest) o; + return Objects.equals(this.healthChecks, that.getHealthChecksList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(healthChecks); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsRemoveInstanceRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsRemoveInstanceRequest.java new file mode 100644 index 000000000000..3d0c875689d7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsRemoveInstanceRequest.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetPoolsRemoveInstanceRequest implements ApiMessage { + private final List instances; + + private TargetPoolsRemoveInstanceRequest() { + this.instances = null; + } + + private TargetPoolsRemoveInstanceRequest(List instances) { + this.instances = instances; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("instances")) { + return instances; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getInstancesList() { + return instances; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetPoolsRemoveInstanceRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetPoolsRemoveInstanceRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetPoolsRemoveInstanceRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetPoolsRemoveInstanceRequest(); + } + + public static class Builder { + private List instances; + + Builder() {} + + public Builder mergeFrom(TargetPoolsRemoveInstanceRequest other) { + if (other == TargetPoolsRemoveInstanceRequest.getDefaultInstance()) return this; + if (other.getInstancesList() != null) { + this.instances = other.instances; + } + return this; + } + + Builder(TargetPoolsRemoveInstanceRequest source) { + this.instances = source.instances; + } + + public List getInstancesList() { + return instances; + } + + public Builder addAllInstances(List instances) { + if (this.instances == null) { + this.instances = new ArrayList<>(instances.size()); + } + this.instances.addAll(instances); + return this; + } + + public Builder addInstances(InstanceReference instances) { + this.instances.add(instances); + return this; + } + + public TargetPoolsRemoveInstanceRequest build() { + return new TargetPoolsRemoveInstanceRequest(instances); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllInstances(this.instances); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetPoolsRemoveInstanceRequest{" + "instances=" + instances + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetPoolsRemoveInstanceRequest) { + TargetPoolsRemoveInstanceRequest that = (TargetPoolsRemoveInstanceRequest) o; + return Objects.equals(this.instances, that.getInstancesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(instances); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsScopedList.java new file mode 100644 index 000000000000..8604dac74615 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolsScopedList.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetPoolsScopedList implements ApiMessage { + private final List targetPools; + private final Warning warning; + + private TargetPoolsScopedList() { + this.targetPools = null; + this.warning = null; + } + + private TargetPoolsScopedList(List targetPools, Warning warning) { + this.targetPools = targetPools; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("targetPools")) { + return targetPools; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getTargetPoolsList() { + return targetPools; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetPoolsScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetPoolsScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetPoolsScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetPoolsScopedList(); + } + + public static class Builder { + private List targetPools; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetPoolsScopedList other) { + if (other == TargetPoolsScopedList.getDefaultInstance()) return this; + if (other.getTargetPoolsList() != null) { + this.targetPools = other.targetPools; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetPoolsScopedList source) { + this.targetPools = source.targetPools; + this.warning = source.warning; + } + + public List getTargetPoolsList() { + return targetPools; + } + + public Builder addAllTargetPools(List targetPools) { + if (this.targetPools == null) { + this.targetPools = new ArrayList<>(targetPools.size()); + } + this.targetPools.addAll(targetPools); + return this; + } + + public Builder addTargetPools(TargetPool targetPools) { + this.targetPools.add(targetPools); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetPoolsScopedList build() { + + return new TargetPoolsScopedList(targetPools, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllTargetPools(this.targetPools); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetPoolsScopedList{" + + "targetPools=" + + targetPools + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetPoolsScopedList) { + TargetPoolsScopedList that = (TargetPoolsScopedList) o; + return Objects.equals(this.targetPools, that.getTargetPoolsList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(targetPools, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetReference.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetReference.java new file mode 100644 index 000000000000..aafe660140e9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetReference.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetReference implements ApiMessage { + private final String target; + + private TargetReference() { + this.target = null; + } + + private TargetReference(String target) { + this.target = target; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("target")) { + return target; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getTarget() { + return target; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetReference prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetReference getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetReference DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetReference(); + } + + public static class Builder { + private String target; + + Builder() {} + + public Builder mergeFrom(TargetReference other) { + if (other == TargetReference.getDefaultInstance()) return this; + if (other.getTarget() != null) { + this.target = other.target; + } + return this; + } + + Builder(TargetReference source) { + this.target = source.target; + } + + public String getTarget() { + return target; + } + + public Builder setTarget(String target) { + this.target = target; + return this; + } + + public TargetReference build() { + return new TargetReference(target); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setTarget(this.target); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetReference{" + "target=" + target + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetReference) { + TargetReference that = (TargetReference) o; + return Objects.equals(this.target, that.getTarget()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(target); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxiesSetBackendServiceRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxiesSetBackendServiceRequest.java new file mode 100644 index 000000000000..93585948f5dc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxiesSetBackendServiceRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetSslProxiesSetBackendServiceRequest implements ApiMessage { + private final String service; + + private TargetSslProxiesSetBackendServiceRequest() { + this.service = null; + } + + private TargetSslProxiesSetBackendServiceRequest(String service) { + this.service = service; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("service")) { + return service; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getService() { + return service; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetSslProxiesSetBackendServiceRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetSslProxiesSetBackendServiceRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetSslProxiesSetBackendServiceRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetSslProxiesSetBackendServiceRequest(); + } + + public static class Builder { + private String service; + + Builder() {} + + public Builder mergeFrom(TargetSslProxiesSetBackendServiceRequest other) { + if (other == TargetSslProxiesSetBackendServiceRequest.getDefaultInstance()) return this; + if (other.getService() != null) { + this.service = other.service; + } + return this; + } + + Builder(TargetSslProxiesSetBackendServiceRequest source) { + this.service = source.service; + } + + public String getService() { + return service; + } + + public Builder setService(String service) { + this.service = service; + return this; + } + + public TargetSslProxiesSetBackendServiceRequest build() { + return new TargetSslProxiesSetBackendServiceRequest(service); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setService(this.service); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetSslProxiesSetBackendServiceRequest{" + "service=" + service + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetSslProxiesSetBackendServiceRequest) { + TargetSslProxiesSetBackendServiceRequest that = (TargetSslProxiesSetBackendServiceRequest) o; + return Objects.equals(this.service, that.getService()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(service); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxiesSetProxyHeaderRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxiesSetProxyHeaderRequest.java new file mode 100644 index 000000000000..98dc4bf88056 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxiesSetProxyHeaderRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetSslProxiesSetProxyHeaderRequest implements ApiMessage { + private final String proxyHeader; + + private TargetSslProxiesSetProxyHeaderRequest() { + this.proxyHeader = null; + } + + private TargetSslProxiesSetProxyHeaderRequest(String proxyHeader) { + this.proxyHeader = proxyHeader; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("proxyHeader")) { + return proxyHeader; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetSslProxiesSetProxyHeaderRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetSslProxiesSetProxyHeaderRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetSslProxiesSetProxyHeaderRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetSslProxiesSetProxyHeaderRequest(); + } + + public static class Builder { + private String proxyHeader; + + Builder() {} + + public Builder mergeFrom(TargetSslProxiesSetProxyHeaderRequest other) { + if (other == TargetSslProxiesSetProxyHeaderRequest.getDefaultInstance()) return this; + if (other.getProxyHeader() != null) { + this.proxyHeader = other.proxyHeader; + } + return this; + } + + Builder(TargetSslProxiesSetProxyHeaderRequest source) { + this.proxyHeader = source.proxyHeader; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public Builder setProxyHeader(String proxyHeader) { + this.proxyHeader = proxyHeader; + return this; + } + + public TargetSslProxiesSetProxyHeaderRequest build() { + return new TargetSslProxiesSetProxyHeaderRequest(proxyHeader); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setProxyHeader(this.proxyHeader); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetSslProxiesSetProxyHeaderRequest{" + "proxyHeader=" + proxyHeader + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetSslProxiesSetProxyHeaderRequest) { + TargetSslProxiesSetProxyHeaderRequest that = (TargetSslProxiesSetProxyHeaderRequest) o; + return Objects.equals(this.proxyHeader, that.getProxyHeader()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(proxyHeader); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxiesSetSslCertificatesRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxiesSetSslCertificatesRequest.java new file mode 100644 index 000000000000..922cf0239499 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxiesSetSslCertificatesRequest.java @@ -0,0 +1,155 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetSslProxiesSetSslCertificatesRequest implements ApiMessage { + private final List sslCertificates; + + private TargetSslProxiesSetSslCertificatesRequest() { + this.sslCertificates = null; + } + + private TargetSslProxiesSetSslCertificatesRequest(List sslCertificates) { + this.sslCertificates = sslCertificates; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("sslCertificates")) { + return sslCertificates; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getSslCertificatesList() { + return sslCertificates; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetSslProxiesSetSslCertificatesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetSslProxiesSetSslCertificatesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetSslProxiesSetSslCertificatesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetSslProxiesSetSslCertificatesRequest(); + } + + public static class Builder { + private List sslCertificates; + + Builder() {} + + public Builder mergeFrom(TargetSslProxiesSetSslCertificatesRequest other) { + if (other == TargetSslProxiesSetSslCertificatesRequest.getDefaultInstance()) return this; + if (other.getSslCertificatesList() != null) { + this.sslCertificates = other.sslCertificates; + } + return this; + } + + Builder(TargetSslProxiesSetSslCertificatesRequest source) { + this.sslCertificates = source.sslCertificates; + } + + public List getSslCertificatesList() { + return sslCertificates; + } + + public Builder addAllSslCertificates(List sslCertificates) { + if (this.sslCertificates == null) { + this.sslCertificates = new ArrayList<>(sslCertificates.size()); + } + this.sslCertificates.addAll(sslCertificates); + return this; + } + + public Builder addSslCertificates(String sslCertificates) { + this.sslCertificates.add(sslCertificates); + return this; + } + + public TargetSslProxiesSetSslCertificatesRequest build() { + return new TargetSslProxiesSetSslCertificatesRequest(sslCertificates); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllSslCertificates(this.sslCertificates); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetSslProxiesSetSslCertificatesRequest{" + + "sslCertificates=" + + sslCertificates + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetSslProxiesSetSslCertificatesRequest) { + TargetSslProxiesSetSslCertificatesRequest that = + (TargetSslProxiesSetSslCertificatesRequest) o; + return Objects.equals(this.sslCertificates, that.getSslCertificatesList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(sslCertificates); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxy.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxy.java new file mode 100644 index 000000000000..d832bec89020 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxy.java @@ -0,0 +1,446 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetSslProxy implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String id; + private final String kind; + private final String name; + private final String proxyHeader; + private final String selfLink; + private final String service; + private final List sslCertificates; + private final String sslPolicy; + + private TargetSslProxy() { + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.kind = null; + this.name = null; + this.proxyHeader = null; + this.selfLink = null; + this.service = null; + this.sslCertificates = null; + this.sslPolicy = null; + } + + private TargetSslProxy( + String creationTimestamp, + String description, + String id, + String kind, + String name, + String proxyHeader, + String selfLink, + String service, + List sslCertificates, + String sslPolicy) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.kind = kind; + this.name = name; + this.proxyHeader = proxyHeader; + this.selfLink = selfLink; + this.service = service; + this.sslCertificates = sslCertificates; + this.sslPolicy = sslPolicy; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("proxyHeader")) { + return proxyHeader; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("service")) { + return service; + } + if (fieldName.equals("sslCertificates")) { + return sslCertificates; + } + if (fieldName.equals("sslPolicy")) { + return sslPolicy; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public String getSelfLink() { + return selfLink; + } + + public String getService() { + return service; + } + + public List getSslCertificatesList() { + return sslCertificates; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetSslProxy prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetSslProxy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetSslProxy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetSslProxy(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String id; + private String kind; + private String name; + private String proxyHeader; + private String selfLink; + private String service; + private List sslCertificates; + private String sslPolicy; + + Builder() {} + + public Builder mergeFrom(TargetSslProxy other) { + if (other == TargetSslProxy.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getProxyHeader() != null) { + this.proxyHeader = other.proxyHeader; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getService() != null) { + this.service = other.service; + } + if (other.getSslCertificatesList() != null) { + this.sslCertificates = other.sslCertificates; + } + if (other.getSslPolicy() != null) { + this.sslPolicy = other.sslPolicy; + } + return this; + } + + Builder(TargetSslProxy source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.proxyHeader = source.proxyHeader; + this.selfLink = source.selfLink; + this.service = source.service; + this.sslCertificates = source.sslCertificates; + this.sslPolicy = source.sslPolicy; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public Builder setProxyHeader(String proxyHeader) { + this.proxyHeader = proxyHeader; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getService() { + return service; + } + + public Builder setService(String service) { + this.service = service; + return this; + } + + public List getSslCertificatesList() { + return sslCertificates; + } + + public Builder addAllSslCertificates(List sslCertificates) { + if (this.sslCertificates == null) { + this.sslCertificates = new ArrayList<>(sslCertificates.size()); + } + this.sslCertificates.addAll(sslCertificates); + return this; + } + + public Builder addSslCertificates(String sslCertificates) { + this.sslCertificates.add(sslCertificates); + return this; + } + + public String getSslPolicy() { + return sslPolicy; + } + + public Builder setSslPolicy(String sslPolicy) { + this.sslPolicy = sslPolicy; + return this; + } + + public TargetSslProxy build() { + + return new TargetSslProxy( + creationTimestamp, + description, + id, + kind, + name, + proxyHeader, + selfLink, + service, + sslCertificates, + sslPolicy); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setProxyHeader(this.proxyHeader); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setService(this.service); + newBuilder.addAllSslCertificates(this.sslCertificates); + newBuilder.setSslPolicy(this.sslPolicy); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetSslProxy{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "proxyHeader=" + + proxyHeader + + ", " + + "selfLink=" + + selfLink + + ", " + + "service=" + + service + + ", " + + "sslCertificates=" + + sslCertificates + + ", " + + "sslPolicy=" + + sslPolicy + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetSslProxy) { + TargetSslProxy that = (TargetSslProxy) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.proxyHeader, that.getProxyHeader()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.service, that.getService()) + && Objects.equals(this.sslCertificates, that.getSslCertificatesList()) + && Objects.equals(this.sslPolicy, that.getSslPolicy()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + description, + id, + kind, + name, + proxyHeader, + selfLink, + service, + sslCertificates, + sslPolicy); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxyClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxyClient.java new file mode 100644 index 000000000000..e4987c986f75 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxyClient.java @@ -0,0 +1,1194 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.TargetSslProxyStub; +import com.google.cloud.compute.v1.stub.TargetSslProxyStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+ *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+ *   Operation response = targetSslProxyClient.deleteTargetSslProxy(targetSslProxy);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the targetSslProxyClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of TargetSslProxySettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * TargetSslProxySettings targetSslProxySettings =
+ *     TargetSslProxySettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * TargetSslProxyClient targetSslProxyClient =
+ *     TargetSslProxyClient.create(targetSslProxySettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * TargetSslProxySettings targetSslProxySettings =
+ *     TargetSslProxySettings.newBuilder().setEndpoint(myEndpoint).build();
+ * TargetSslProxyClient targetSslProxyClient =
+ *     TargetSslProxyClient.create(targetSslProxySettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetSslProxyClient implements BackgroundResource { + private final TargetSslProxySettings settings; + private final TargetSslProxyStub stub; + + /** Constructs an instance of TargetSslProxyClient with default settings. */ + public static final TargetSslProxyClient create() throws IOException { + return create(TargetSslProxySettings.newBuilder().build()); + } + + /** + * Constructs an instance of TargetSslProxyClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final TargetSslProxyClient create(TargetSslProxySettings settings) + throws IOException { + return new TargetSslProxyClient(settings); + } + + /** + * Constructs an instance of TargetSslProxyClient, using the given stub for making calls. This is + * for advanced usage - prefer to use TargetSslProxySettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final TargetSslProxyClient create(TargetSslProxyStub stub) { + return new TargetSslProxyClient(stub); + } + + /** + * Constructs an instance of TargetSslProxyClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected TargetSslProxyClient(TargetSslProxySettings settings) throws IOException { + this.settings = settings; + this.stub = ((TargetSslProxyStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected TargetSslProxyClient(TargetSslProxyStub stub) { + this.settings = null; + this.stub = stub; + } + + public final TargetSslProxySettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetSslProxyStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetSslProxy resource. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   Operation response = targetSslProxyClient.deleteTargetSslProxy(targetSslProxy);
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetSslProxy(ProjectGlobalTargetSslProxyName targetSslProxy) { + + DeleteTargetSslProxyHttpRequest request = + DeleteTargetSslProxyHttpRequest.newBuilder() + .setTargetSslProxy(targetSslProxy == null ? null : targetSslProxy.toString()) + .build(); + return deleteTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetSslProxy resource. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   Operation response = targetSslProxyClient.deleteTargetSslProxy(targetSslProxy.toString());
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetSslProxy(String targetSslProxy) { + + DeleteTargetSslProxyHttpRequest request = + DeleteTargetSslProxyHttpRequest.newBuilder().setTargetSslProxy(targetSslProxy).build(); + return deleteTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetSslProxy resource. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   DeleteTargetSslProxyHttpRequest request = DeleteTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .build();
+   *   Operation response = targetSslProxyClient.deleteTargetSslProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetSslProxy(DeleteTargetSslProxyHttpRequest request) { + return deleteTargetSslProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetSslProxy resource. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   DeleteTargetSslProxyHttpRequest request = DeleteTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = targetSslProxyClient.deleteTargetSslProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteTargetSslProxyCallable() { + return stub.deleteTargetSslProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetSslProxy resource. Gets a list of available target SSL proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxy response = targetSslProxyClient.getTargetSslProxy(targetSslProxy);
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetSslProxy getTargetSslProxy(ProjectGlobalTargetSslProxyName targetSslProxy) { + + GetTargetSslProxyHttpRequest request = + GetTargetSslProxyHttpRequest.newBuilder() + .setTargetSslProxy(targetSslProxy == null ? null : targetSslProxy.toString()) + .build(); + return getTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetSslProxy resource. Gets a list of available target SSL proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxy response = targetSslProxyClient.getTargetSslProxy(targetSslProxy.toString());
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetSslProxy getTargetSslProxy(String targetSslProxy) { + + GetTargetSslProxyHttpRequest request = + GetTargetSslProxyHttpRequest.newBuilder().setTargetSslProxy(targetSslProxy).build(); + return getTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetSslProxy resource. Gets a list of available target SSL proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   GetTargetSslProxyHttpRequest request = GetTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .build();
+   *   TargetSslProxy response = targetSslProxyClient.getTargetSslProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetSslProxy getTargetSslProxy(GetTargetSslProxyHttpRequest request) { + return getTargetSslProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetSslProxy resource. Gets a list of available target SSL proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   GetTargetSslProxyHttpRequest request = GetTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .build();
+   *   ApiFuture<TargetSslProxy> future = targetSslProxyClient.getTargetSslProxyCallable().futureCall(request);
+   *   // Do something
+   *   TargetSslProxy response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getTargetSslProxyCallable() { + return stub.getTargetSslProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetSslProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetSslProxy targetSslProxyResource = TargetSslProxy.newBuilder().build();
+   *   Operation response = targetSslProxyClient.insertTargetSslProxy(project, targetSslProxyResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param targetSslProxyResource A TargetSslProxy resource. This resource defines an SSL proxy. + * (== resource_for beta.targetSslProxies ==) (== resource_for v1.targetSslProxies ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetSslProxy( + ProjectName project, TargetSslProxy targetSslProxyResource) { + + InsertTargetSslProxyHttpRequest request = + InsertTargetSslProxyHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setTargetSslProxyResource(targetSslProxyResource) + .build(); + return insertTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetSslProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetSslProxy targetSslProxyResource = TargetSslProxy.newBuilder().build();
+   *   Operation response = targetSslProxyClient.insertTargetSslProxy(project.toString(), targetSslProxyResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param targetSslProxyResource A TargetSslProxy resource. This resource defines an SSL proxy. + * (== resource_for beta.targetSslProxies ==) (== resource_for v1.targetSslProxies ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetSslProxy( + String project, TargetSslProxy targetSslProxyResource) { + + InsertTargetSslProxyHttpRequest request = + InsertTargetSslProxyHttpRequest.newBuilder() + .setProject(project) + .setTargetSslProxyResource(targetSslProxyResource) + .build(); + return insertTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetSslProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetSslProxy targetSslProxyResource = TargetSslProxy.newBuilder().build();
+   *   InsertTargetSslProxyHttpRequest request = InsertTargetSslProxyHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setTargetSslProxyResource(targetSslProxyResource)
+   *     .build();
+   *   Operation response = targetSslProxyClient.insertTargetSslProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetSslProxy(InsertTargetSslProxyHttpRequest request) { + return insertTargetSslProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetSslProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetSslProxy targetSslProxyResource = TargetSslProxy.newBuilder().build();
+   *   InsertTargetSslProxyHttpRequest request = InsertTargetSslProxyHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setTargetSslProxyResource(targetSslProxyResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetSslProxyClient.insertTargetSslProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertTargetSslProxyCallable() { + return stub.insertTargetSslProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetSslProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetSslProxy element : targetSslProxyClient.listTargetSslProxies(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetSslProxiesPagedResponse listTargetSslProxies(ProjectName project) { + ListTargetSslProxiesHttpRequest request = + ListTargetSslProxiesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listTargetSslProxies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetSslProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetSslProxy element : targetSslProxyClient.listTargetSslProxies(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetSslProxiesPagedResponse listTargetSslProxies(String project) { + ListTargetSslProxiesHttpRequest request = + ListTargetSslProxiesHttpRequest.newBuilder().setProject(project).build(); + return listTargetSslProxies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetSslProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetSslProxiesHttpRequest request = ListTargetSslProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (TargetSslProxy element : targetSslProxyClient.listTargetSslProxies(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetSslProxiesPagedResponse listTargetSslProxies( + ListTargetSslProxiesHttpRequest request) { + return listTargetSslProxiesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetSslProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetSslProxiesHttpRequest request = ListTargetSslProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListTargetSslProxiesPagedResponse> future = targetSslProxyClient.listTargetSslProxiesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (TargetSslProxy element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetSslProxiesPagedCallable() { + return stub.listTargetSslProxiesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetSslProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetSslProxiesHttpRequest request = ListTargetSslProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     TargetSslProxyList response = targetSslProxyClient.listTargetSslProxiesCallable().call(request);
+   *     for (TargetSslProxy element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetSslProxiesCallable() { + return stub.listTargetSslProxiesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the BackendService for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetBackendServiceRequest targetSslProxiesSetBackendServiceRequestResource = TargetSslProxiesSetBackendServiceRequest.newBuilder().build();
+   *   Operation response = targetSslProxyClient.setBackendServiceTargetSslProxy(targetSslProxy, targetSslProxiesSetBackendServiceRequestResource);
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource whose BackendService resource is to + * be set. + * @param targetSslProxiesSetBackendServiceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setBackendServiceTargetSslProxy( + ProjectGlobalTargetSslProxyName targetSslProxy, + TargetSslProxiesSetBackendServiceRequest targetSslProxiesSetBackendServiceRequestResource) { + + SetBackendServiceTargetSslProxyHttpRequest request = + SetBackendServiceTargetSslProxyHttpRequest.newBuilder() + .setTargetSslProxy(targetSslProxy == null ? null : targetSslProxy.toString()) + .setTargetSslProxiesSetBackendServiceRequestResource( + targetSslProxiesSetBackendServiceRequestResource) + .build(); + return setBackendServiceTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the BackendService for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetBackendServiceRequest targetSslProxiesSetBackendServiceRequestResource = TargetSslProxiesSetBackendServiceRequest.newBuilder().build();
+   *   Operation response = targetSslProxyClient.setBackendServiceTargetSslProxy(targetSslProxy.toString(), targetSslProxiesSetBackendServiceRequestResource);
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource whose BackendService resource is to + * be set. + * @param targetSslProxiesSetBackendServiceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setBackendServiceTargetSslProxy( + String targetSslProxy, + TargetSslProxiesSetBackendServiceRequest targetSslProxiesSetBackendServiceRequestResource) { + + SetBackendServiceTargetSslProxyHttpRequest request = + SetBackendServiceTargetSslProxyHttpRequest.newBuilder() + .setTargetSslProxy(targetSslProxy) + .setTargetSslProxiesSetBackendServiceRequestResource( + targetSslProxiesSetBackendServiceRequestResource) + .build(); + return setBackendServiceTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the BackendService for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetBackendServiceRequest targetSslProxiesSetBackendServiceRequestResource = TargetSslProxiesSetBackendServiceRequest.newBuilder().build();
+   *   SetBackendServiceTargetSslProxyHttpRequest request = SetBackendServiceTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .setTargetSslProxiesSetBackendServiceRequestResource(targetSslProxiesSetBackendServiceRequestResource)
+   *     .build();
+   *   Operation response = targetSslProxyClient.setBackendServiceTargetSslProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setBackendServiceTargetSslProxy( + SetBackendServiceTargetSslProxyHttpRequest request) { + return setBackendServiceTargetSslProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the BackendService for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetBackendServiceRequest targetSslProxiesSetBackendServiceRequestResource = TargetSslProxiesSetBackendServiceRequest.newBuilder().build();
+   *   SetBackendServiceTargetSslProxyHttpRequest request = SetBackendServiceTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .setTargetSslProxiesSetBackendServiceRequestResource(targetSslProxiesSetBackendServiceRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetSslProxyClient.setBackendServiceTargetSslProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setBackendServiceTargetSslProxyCallable() { + return stub.setBackendServiceTargetSslProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the ProxyHeaderType for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource = TargetSslProxiesSetProxyHeaderRequest.newBuilder().build();
+   *   Operation response = targetSslProxyClient.setProxyHeaderTargetSslProxy(targetSslProxy, targetSslProxiesSetProxyHeaderRequestResource);
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource whose ProxyHeader is to be set. + * @param targetSslProxiesSetProxyHeaderRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setProxyHeaderTargetSslProxy( + ProjectGlobalTargetSslProxyName targetSslProxy, + TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource) { + + SetProxyHeaderTargetSslProxyHttpRequest request = + SetProxyHeaderTargetSslProxyHttpRequest.newBuilder() + .setTargetSslProxy(targetSslProxy == null ? null : targetSslProxy.toString()) + .setTargetSslProxiesSetProxyHeaderRequestResource( + targetSslProxiesSetProxyHeaderRequestResource) + .build(); + return setProxyHeaderTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the ProxyHeaderType for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource = TargetSslProxiesSetProxyHeaderRequest.newBuilder().build();
+   *   Operation response = targetSslProxyClient.setProxyHeaderTargetSslProxy(targetSslProxy.toString(), targetSslProxiesSetProxyHeaderRequestResource);
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource whose ProxyHeader is to be set. + * @param targetSslProxiesSetProxyHeaderRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setProxyHeaderTargetSslProxy( + String targetSslProxy, + TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource) { + + SetProxyHeaderTargetSslProxyHttpRequest request = + SetProxyHeaderTargetSslProxyHttpRequest.newBuilder() + .setTargetSslProxy(targetSslProxy) + .setTargetSslProxiesSetProxyHeaderRequestResource( + targetSslProxiesSetProxyHeaderRequestResource) + .build(); + return setProxyHeaderTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the ProxyHeaderType for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource = TargetSslProxiesSetProxyHeaderRequest.newBuilder().build();
+   *   SetProxyHeaderTargetSslProxyHttpRequest request = SetProxyHeaderTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .setTargetSslProxiesSetProxyHeaderRequestResource(targetSslProxiesSetProxyHeaderRequestResource)
+   *     .build();
+   *   Operation response = targetSslProxyClient.setProxyHeaderTargetSslProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setProxyHeaderTargetSslProxy( + SetProxyHeaderTargetSslProxyHttpRequest request) { + return setProxyHeaderTargetSslProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the ProxyHeaderType for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource = TargetSslProxiesSetProxyHeaderRequest.newBuilder().build();
+   *   SetProxyHeaderTargetSslProxyHttpRequest request = SetProxyHeaderTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .setTargetSslProxiesSetProxyHeaderRequestResource(targetSslProxiesSetProxyHeaderRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetSslProxyClient.setProxyHeaderTargetSslProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setProxyHeaderTargetSslProxyCallable() { + return stub.setProxyHeaderTargetSslProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes SslCertificates for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetSslCertificatesRequest targetSslProxiesSetSslCertificatesRequestResource = TargetSslProxiesSetSslCertificatesRequest.newBuilder().build();
+   *   Operation response = targetSslProxyClient.setSslCertificatesTargetSslProxy(targetSslProxy, targetSslProxiesSetSslCertificatesRequestResource);
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource whose SslCertificate resource is to + * be set. + * @param targetSslProxiesSetSslCertificatesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslCertificatesTargetSslProxy( + ProjectGlobalTargetSslProxyName targetSslProxy, + TargetSslProxiesSetSslCertificatesRequest targetSslProxiesSetSslCertificatesRequestResource) { + + SetSslCertificatesTargetSslProxyHttpRequest request = + SetSslCertificatesTargetSslProxyHttpRequest.newBuilder() + .setTargetSslProxy(targetSslProxy == null ? null : targetSslProxy.toString()) + .setTargetSslProxiesSetSslCertificatesRequestResource( + targetSslProxiesSetSslCertificatesRequestResource) + .build(); + return setSslCertificatesTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes SslCertificates for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetSslCertificatesRequest targetSslProxiesSetSslCertificatesRequestResource = TargetSslProxiesSetSslCertificatesRequest.newBuilder().build();
+   *   Operation response = targetSslProxyClient.setSslCertificatesTargetSslProxy(targetSslProxy.toString(), targetSslProxiesSetSslCertificatesRequestResource);
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource whose SslCertificate resource is to + * be set. + * @param targetSslProxiesSetSslCertificatesRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslCertificatesTargetSslProxy( + String targetSslProxy, + TargetSslProxiesSetSslCertificatesRequest targetSslProxiesSetSslCertificatesRequestResource) { + + SetSslCertificatesTargetSslProxyHttpRequest request = + SetSslCertificatesTargetSslProxyHttpRequest.newBuilder() + .setTargetSslProxy(targetSslProxy) + .setTargetSslProxiesSetSslCertificatesRequestResource( + targetSslProxiesSetSslCertificatesRequestResource) + .build(); + return setSslCertificatesTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes SslCertificates for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetSslCertificatesRequest targetSslProxiesSetSslCertificatesRequestResource = TargetSslProxiesSetSslCertificatesRequest.newBuilder().build();
+   *   SetSslCertificatesTargetSslProxyHttpRequest request = SetSslCertificatesTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .setTargetSslProxiesSetSslCertificatesRequestResource(targetSslProxiesSetSslCertificatesRequestResource)
+   *     .build();
+   *   Operation response = targetSslProxyClient.setSslCertificatesTargetSslProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslCertificatesTargetSslProxy( + SetSslCertificatesTargetSslProxyHttpRequest request) { + return setSslCertificatesTargetSslProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes SslCertificates for TargetSslProxy. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   TargetSslProxiesSetSslCertificatesRequest targetSslProxiesSetSslCertificatesRequestResource = TargetSslProxiesSetSslCertificatesRequest.newBuilder().build();
+   *   SetSslCertificatesTargetSslProxyHttpRequest request = SetSslCertificatesTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .setTargetSslProxiesSetSslCertificatesRequestResource(targetSslProxiesSetSslCertificatesRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetSslProxyClient.setSslCertificatesTargetSslProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setSslCertificatesTargetSslProxyCallable() { + return stub.setSslCertificatesTargetSslProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the SSL policy for TargetSslProxy. The SSL policy specifies the server-side support for + * SSL features. This affects connections between clients and the SSL proxy load balancer. They do + * not affect the connection between the load balancer and the backends. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build();
+   *   Operation response = targetSslProxyClient.setSslPolicyTargetSslProxy(targetSslProxy, sslPolicyReferenceResource);
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource whose SSL policy is to be set. The + * name must be 1-63 characters long, and comply with RFC1035. + * @param sslPolicyReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslPolicyTargetSslProxy( + ProjectGlobalTargetSslProxyName targetSslProxy, + SslPolicyReference sslPolicyReferenceResource) { + + SetSslPolicyTargetSslProxyHttpRequest request = + SetSslPolicyTargetSslProxyHttpRequest.newBuilder() + .setTargetSslProxy(targetSslProxy == null ? null : targetSslProxy.toString()) + .setSslPolicyReferenceResource(sslPolicyReferenceResource) + .build(); + return setSslPolicyTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the SSL policy for TargetSslProxy. The SSL policy specifies the server-side support for + * SSL features. This affects connections between clients and the SSL proxy load balancer. They do + * not affect the connection between the load balancer and the backends. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build();
+   *   Operation response = targetSslProxyClient.setSslPolicyTargetSslProxy(targetSslProxy.toString(), sslPolicyReferenceResource);
+   * }
+   * 
+ * + * @param targetSslProxy Name of the TargetSslProxy resource whose SSL policy is to be set. The + * name must be 1-63 characters long, and comply with RFC1035. + * @param sslPolicyReferenceResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslPolicyTargetSslProxy( + String targetSslProxy, SslPolicyReference sslPolicyReferenceResource) { + + SetSslPolicyTargetSslProxyHttpRequest request = + SetSslPolicyTargetSslProxyHttpRequest.newBuilder() + .setTargetSslProxy(targetSslProxy) + .setSslPolicyReferenceResource(sslPolicyReferenceResource) + .build(); + return setSslPolicyTargetSslProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the SSL policy for TargetSslProxy. The SSL policy specifies the server-side support for + * SSL features. This affects connections between clients and the SSL proxy load balancer. They do + * not affect the connection between the load balancer and the backends. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build();
+   *   SetSslPolicyTargetSslProxyHttpRequest request = SetSslPolicyTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .setSslPolicyReferenceResource(sslPolicyReferenceResource)
+   *     .build();
+   *   Operation response = targetSslProxyClient.setSslPolicyTargetSslProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setSslPolicyTargetSslProxy(SetSslPolicyTargetSslProxyHttpRequest request) { + return setSslPolicyTargetSslProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the SSL policy for TargetSslProxy. The SSL policy specifies the server-side support for + * SSL features. This affects connections between clients and the SSL proxy load balancer. They do + * not affect the connection between the load balancer and the backends. + * + *

Sample code: + * + *


+   * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+   *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+   *   SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build();
+   *   SetSslPolicyTargetSslProxyHttpRequest request = SetSslPolicyTargetSslProxyHttpRequest.newBuilder()
+   *     .setTargetSslProxy(targetSslProxy.toString())
+   *     .setSslPolicyReferenceResource(sslPolicyReferenceResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetSslProxyClient.setSslPolicyTargetSslProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setSslPolicyTargetSslProxyCallable() { + return stub.setSslPolicyTargetSslProxyCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListTargetSslProxiesPagedResponse + extends AbstractPagedListResponse< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, TargetSslProxy, + ListTargetSslProxiesPage, ListTargetSslProxiesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListTargetSslProxiesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListTargetSslProxiesPagedResponse apply(ListTargetSslProxiesPage input) { + return new ListTargetSslProxiesPagedResponse(input); + } + }); + } + + private ListTargetSslProxiesPagedResponse(ListTargetSslProxiesPage page) { + super(page, ListTargetSslProxiesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListTargetSslProxiesPage + extends AbstractPage< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, TargetSslProxy, + ListTargetSslProxiesPage> { + + private ListTargetSslProxiesPage( + PageContext context, + TargetSslProxyList response) { + super(context, response); + } + + private static ListTargetSslProxiesPage createEmptyPage() { + return new ListTargetSslProxiesPage(null, null); + } + + @Override + protected ListTargetSslProxiesPage createPage( + PageContext context, + TargetSslProxyList response) { + return new ListTargetSslProxiesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListTargetSslProxiesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, TargetSslProxy, + ListTargetSslProxiesPage, ListTargetSslProxiesFixedSizeCollection> { + + private ListTargetSslProxiesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListTargetSslProxiesFixedSizeCollection createEmptyCollection() { + return new ListTargetSslProxiesFixedSizeCollection(null, 0); + } + + @Override + protected ListTargetSslProxiesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListTargetSslProxiesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxyList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxyList.java new file mode 100644 index 000000000000..c99a0f47d210 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxyList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetSslProxyList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private TargetSslProxyList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private TargetSslProxyList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetSslProxyList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetSslProxyList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetSslProxyList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetSslProxyList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetSslProxyList other) { + if (other == TargetSslProxyList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetSslProxyList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(TargetSslProxy items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetSslProxyList build() { + + return new TargetSslProxyList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetSslProxyList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetSslProxyList) { + TargetSslProxyList that = (TargetSslProxyList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxySettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxySettings.java new file mode 100644 index 000000000000..467bb379d507 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetSslProxySettings.java @@ -0,0 +1,273 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetSslProxyClient.ListTargetSslProxiesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.TargetSslProxyStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetSslProxyClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetSslProxy to 30 seconds: + * + *

+ * 
+ * TargetSslProxySettings.Builder targetSslProxySettingsBuilder =
+ *     TargetSslProxySettings.newBuilder();
+ * targetSslProxySettingsBuilder.deleteTargetSslProxySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetSslProxySettings targetSslProxySettings = targetSslProxySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetSslProxySettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteTargetSslProxy. */ + public UnaryCallSettings + deleteTargetSslProxySettings() { + return ((TargetSslProxyStubSettings) getStubSettings()).deleteTargetSslProxySettings(); + } + + /** Returns the object with the settings used for calls to getTargetSslProxy. */ + public UnaryCallSettings + getTargetSslProxySettings() { + return ((TargetSslProxyStubSettings) getStubSettings()).getTargetSslProxySettings(); + } + + /** Returns the object with the settings used for calls to insertTargetSslProxy. */ + public UnaryCallSettings + insertTargetSslProxySettings() { + return ((TargetSslProxyStubSettings) getStubSettings()).insertTargetSslProxySettings(); + } + + /** Returns the object with the settings used for calls to listTargetSslProxies. */ + public PagedCallSettings< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, ListTargetSslProxiesPagedResponse> + listTargetSslProxiesSettings() { + return ((TargetSslProxyStubSettings) getStubSettings()).listTargetSslProxiesSettings(); + } + + /** Returns the object with the settings used for calls to setBackendServiceTargetSslProxy. */ + public UnaryCallSettings + setBackendServiceTargetSslProxySettings() { + return ((TargetSslProxyStubSettings) getStubSettings()) + .setBackendServiceTargetSslProxySettings(); + } + + /** Returns the object with the settings used for calls to setProxyHeaderTargetSslProxy. */ + public UnaryCallSettings + setProxyHeaderTargetSslProxySettings() { + return ((TargetSslProxyStubSettings) getStubSettings()).setProxyHeaderTargetSslProxySettings(); + } + + /** Returns the object with the settings used for calls to setSslCertificatesTargetSslProxy. */ + public UnaryCallSettings + setSslCertificatesTargetSslProxySettings() { + return ((TargetSslProxyStubSettings) getStubSettings()) + .setSslCertificatesTargetSslProxySettings(); + } + + /** Returns the object with the settings used for calls to setSslPolicyTargetSslProxy. */ + public UnaryCallSettings + setSslPolicyTargetSslProxySettings() { + return ((TargetSslProxyStubSettings) getStubSettings()).setSslPolicyTargetSslProxySettings(); + } + + public static final TargetSslProxySettings create(TargetSslProxyStubSettings stub) + throws IOException { + return new TargetSslProxySettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return TargetSslProxyStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return TargetSslProxyStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return TargetSslProxyStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return TargetSslProxyStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return TargetSslProxyStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return TargetSslProxyStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return TargetSslProxyStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TargetSslProxyStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetSslProxySettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for TargetSslProxySettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(TargetSslProxyStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(TargetSslProxyStubSettings.newBuilder()); + } + + protected Builder(TargetSslProxySettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(TargetSslProxyStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public TargetSslProxyStubSettings.Builder getStubSettingsBuilder() { + return ((TargetSslProxyStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteTargetSslProxy. */ + public UnaryCallSettings.Builder + deleteTargetSslProxySettings() { + return getStubSettingsBuilder().deleteTargetSslProxySettings(); + } + + /** Returns the builder for the settings used for calls to getTargetSslProxy. */ + public UnaryCallSettings.Builder + getTargetSslProxySettings() { + return getStubSettingsBuilder().getTargetSslProxySettings(); + } + + /** Returns the builder for the settings used for calls to insertTargetSslProxy. */ + public UnaryCallSettings.Builder + insertTargetSslProxySettings() { + return getStubSettingsBuilder().insertTargetSslProxySettings(); + } + + /** Returns the builder for the settings used for calls to listTargetSslProxies. */ + public PagedCallSettings.Builder< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, ListTargetSslProxiesPagedResponse> + listTargetSslProxiesSettings() { + return getStubSettingsBuilder().listTargetSslProxiesSettings(); + } + + /** Returns the builder for the settings used for calls to setBackendServiceTargetSslProxy. */ + public UnaryCallSettings.Builder + setBackendServiceTargetSslProxySettings() { + return getStubSettingsBuilder().setBackendServiceTargetSslProxySettings(); + } + + /** Returns the builder for the settings used for calls to setProxyHeaderTargetSslProxy. */ + public UnaryCallSettings.Builder + setProxyHeaderTargetSslProxySettings() { + return getStubSettingsBuilder().setProxyHeaderTargetSslProxySettings(); + } + + /** Returns the builder for the settings used for calls to setSslCertificatesTargetSslProxy. */ + public UnaryCallSettings.Builder + setSslCertificatesTargetSslProxySettings() { + return getStubSettingsBuilder().setSslCertificatesTargetSslProxySettings(); + } + + /** Returns the builder for the settings used for calls to setSslPolicyTargetSslProxy. */ + public UnaryCallSettings.Builder + setSslPolicyTargetSslProxySettings() { + return getStubSettingsBuilder().setSslPolicyTargetSslProxySettings(); + } + + @Override + public TargetSslProxySettings build() throws IOException { + return new TargetSslProxySettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxiesSetBackendServiceRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxiesSetBackendServiceRequest.java new file mode 100644 index 000000000000..147e6d889373 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxiesSetBackendServiceRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetTcpProxiesSetBackendServiceRequest implements ApiMessage { + private final String service; + + private TargetTcpProxiesSetBackendServiceRequest() { + this.service = null; + } + + private TargetTcpProxiesSetBackendServiceRequest(String service) { + this.service = service; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("service")) { + return service; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getService() { + return service; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetTcpProxiesSetBackendServiceRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetTcpProxiesSetBackendServiceRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetTcpProxiesSetBackendServiceRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetTcpProxiesSetBackendServiceRequest(); + } + + public static class Builder { + private String service; + + Builder() {} + + public Builder mergeFrom(TargetTcpProxiesSetBackendServiceRequest other) { + if (other == TargetTcpProxiesSetBackendServiceRequest.getDefaultInstance()) return this; + if (other.getService() != null) { + this.service = other.service; + } + return this; + } + + Builder(TargetTcpProxiesSetBackendServiceRequest source) { + this.service = source.service; + } + + public String getService() { + return service; + } + + public Builder setService(String service) { + this.service = service; + return this; + } + + public TargetTcpProxiesSetBackendServiceRequest build() { + return new TargetTcpProxiesSetBackendServiceRequest(service); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setService(this.service); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetTcpProxiesSetBackendServiceRequest{" + "service=" + service + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetTcpProxiesSetBackendServiceRequest) { + TargetTcpProxiesSetBackendServiceRequest that = (TargetTcpProxiesSetBackendServiceRequest) o; + return Objects.equals(this.service, that.getService()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(service); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxiesSetProxyHeaderRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxiesSetProxyHeaderRequest.java new file mode 100644 index 000000000000..9e77f3319352 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxiesSetProxyHeaderRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetTcpProxiesSetProxyHeaderRequest implements ApiMessage { + private final String proxyHeader; + + private TargetTcpProxiesSetProxyHeaderRequest() { + this.proxyHeader = null; + } + + private TargetTcpProxiesSetProxyHeaderRequest(String proxyHeader) { + this.proxyHeader = proxyHeader; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("proxyHeader")) { + return proxyHeader; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetTcpProxiesSetProxyHeaderRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetTcpProxiesSetProxyHeaderRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetTcpProxiesSetProxyHeaderRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetTcpProxiesSetProxyHeaderRequest(); + } + + public static class Builder { + private String proxyHeader; + + Builder() {} + + public Builder mergeFrom(TargetTcpProxiesSetProxyHeaderRequest other) { + if (other == TargetTcpProxiesSetProxyHeaderRequest.getDefaultInstance()) return this; + if (other.getProxyHeader() != null) { + this.proxyHeader = other.proxyHeader; + } + return this; + } + + Builder(TargetTcpProxiesSetProxyHeaderRequest source) { + this.proxyHeader = source.proxyHeader; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public Builder setProxyHeader(String proxyHeader) { + this.proxyHeader = proxyHeader; + return this; + } + + public TargetTcpProxiesSetProxyHeaderRequest build() { + return new TargetTcpProxiesSetProxyHeaderRequest(proxyHeader); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setProxyHeader(this.proxyHeader); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetTcpProxiesSetProxyHeaderRequest{" + "proxyHeader=" + proxyHeader + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetTcpProxiesSetProxyHeaderRequest) { + TargetTcpProxiesSetProxyHeaderRequest that = (TargetTcpProxiesSetProxyHeaderRequest) o; + return Objects.equals(this.proxyHeader, that.getProxyHeader()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(proxyHeader); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxy.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxy.java new file mode 100644 index 000000000000..b6f7a888ce6c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxy.java @@ -0,0 +1,359 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetTcpProxy implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String id; + private final String kind; + private final String name; + private final String proxyHeader; + private final String selfLink; + private final String service; + + private TargetTcpProxy() { + this.creationTimestamp = null; + this.description = null; + this.id = null; + this.kind = null; + this.name = null; + this.proxyHeader = null; + this.selfLink = null; + this.service = null; + } + + private TargetTcpProxy( + String creationTimestamp, + String description, + String id, + String kind, + String name, + String proxyHeader, + String selfLink, + String service) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.id = id; + this.kind = kind; + this.name = name; + this.proxyHeader = proxyHeader; + this.selfLink = selfLink; + this.service = service; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("proxyHeader")) { + return proxyHeader; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("service")) { + return service; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public String getSelfLink() { + return selfLink; + } + + public String getService() { + return service; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetTcpProxy prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetTcpProxy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetTcpProxy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetTcpProxy(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String id; + private String kind; + private String name; + private String proxyHeader; + private String selfLink; + private String service; + + Builder() {} + + public Builder mergeFrom(TargetTcpProxy other) { + if (other == TargetTcpProxy.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getProxyHeader() != null) { + this.proxyHeader = other.proxyHeader; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getService() != null) { + this.service = other.service; + } + return this; + } + + Builder(TargetTcpProxy source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.proxyHeader = source.proxyHeader; + this.selfLink = source.selfLink; + this.service = source.service; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getProxyHeader() { + return proxyHeader; + } + + public Builder setProxyHeader(String proxyHeader) { + this.proxyHeader = proxyHeader; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getService() { + return service; + } + + public Builder setService(String service) { + this.service = service; + return this; + } + + public TargetTcpProxy build() { + + return new TargetTcpProxy( + creationTimestamp, description, id, kind, name, proxyHeader, selfLink, service); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setProxyHeader(this.proxyHeader); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setService(this.service); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetTcpProxy{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "proxyHeader=" + + proxyHeader + + ", " + + "selfLink=" + + selfLink + + ", " + + "service=" + + service + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetTcpProxy) { + TargetTcpProxy that = (TargetTcpProxy) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.proxyHeader, that.getProxyHeader()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.service, that.getService()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, description, id, kind, name, proxyHeader, selfLink, service); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxyClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxyClient.java new file mode 100644 index 000000000000..853bf7608b7a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxyClient.java @@ -0,0 +1,952 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.TargetTcpProxyStub; +import com.google.cloud.compute.v1.stub.TargetTcpProxyStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+ *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+ *   Operation response = targetTcpProxyClient.deleteTargetTcpProxy(targetTcpProxy);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the targetTcpProxyClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of TargetTcpProxySettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * TargetTcpProxySettings targetTcpProxySettings =
+ *     TargetTcpProxySettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * TargetTcpProxyClient targetTcpProxyClient =
+ *     TargetTcpProxyClient.create(targetTcpProxySettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * TargetTcpProxySettings targetTcpProxySettings =
+ *     TargetTcpProxySettings.newBuilder().setEndpoint(myEndpoint).build();
+ * TargetTcpProxyClient targetTcpProxyClient =
+ *     TargetTcpProxyClient.create(targetTcpProxySettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetTcpProxyClient implements BackgroundResource { + private final TargetTcpProxySettings settings; + private final TargetTcpProxyStub stub; + + /** Constructs an instance of TargetTcpProxyClient with default settings. */ + public static final TargetTcpProxyClient create() throws IOException { + return create(TargetTcpProxySettings.newBuilder().build()); + } + + /** + * Constructs an instance of TargetTcpProxyClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final TargetTcpProxyClient create(TargetTcpProxySettings settings) + throws IOException { + return new TargetTcpProxyClient(settings); + } + + /** + * Constructs an instance of TargetTcpProxyClient, using the given stub for making calls. This is + * for advanced usage - prefer to use TargetTcpProxySettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final TargetTcpProxyClient create(TargetTcpProxyStub stub) { + return new TargetTcpProxyClient(stub); + } + + /** + * Constructs an instance of TargetTcpProxyClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected TargetTcpProxyClient(TargetTcpProxySettings settings) throws IOException { + this.settings = settings; + this.stub = ((TargetTcpProxyStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected TargetTcpProxyClient(TargetTcpProxyStub stub) { + this.settings = null; + this.stub = stub; + } + + public final TargetTcpProxySettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetTcpProxyStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetTcpProxy resource. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   Operation response = targetTcpProxyClient.deleteTargetTcpProxy(targetTcpProxy);
+   * }
+   * 
+ * + * @param targetTcpProxy Name of the TargetTcpProxy resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetTcpProxy(ProjectGlobalTargetTcpProxyName targetTcpProxy) { + + DeleteTargetTcpProxyHttpRequest request = + DeleteTargetTcpProxyHttpRequest.newBuilder() + .setTargetTcpProxy(targetTcpProxy == null ? null : targetTcpProxy.toString()) + .build(); + return deleteTargetTcpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetTcpProxy resource. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   Operation response = targetTcpProxyClient.deleteTargetTcpProxy(targetTcpProxy.toString());
+   * }
+   * 
+ * + * @param targetTcpProxy Name of the TargetTcpProxy resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetTcpProxy(String targetTcpProxy) { + + DeleteTargetTcpProxyHttpRequest request = + DeleteTargetTcpProxyHttpRequest.newBuilder().setTargetTcpProxy(targetTcpProxy).build(); + return deleteTargetTcpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetTcpProxy resource. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   DeleteTargetTcpProxyHttpRequest request = DeleteTargetTcpProxyHttpRequest.newBuilder()
+   *     .setTargetTcpProxy(targetTcpProxy.toString())
+   *     .build();
+   *   Operation response = targetTcpProxyClient.deleteTargetTcpProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetTcpProxy(DeleteTargetTcpProxyHttpRequest request) { + return deleteTargetTcpProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified TargetTcpProxy resource. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   DeleteTargetTcpProxyHttpRequest request = DeleteTargetTcpProxyHttpRequest.newBuilder()
+   *     .setTargetTcpProxy(targetTcpProxy.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = targetTcpProxyClient.deleteTargetTcpProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteTargetTcpProxyCallable() { + return stub.deleteTargetTcpProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetTcpProxy resource. Gets a list of available target TCP proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   TargetTcpProxy response = targetTcpProxyClient.getTargetTcpProxy(targetTcpProxy);
+   * }
+   * 
+ * + * @param targetTcpProxy Name of the TargetTcpProxy resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetTcpProxy getTargetTcpProxy(ProjectGlobalTargetTcpProxyName targetTcpProxy) { + + GetTargetTcpProxyHttpRequest request = + GetTargetTcpProxyHttpRequest.newBuilder() + .setTargetTcpProxy(targetTcpProxy == null ? null : targetTcpProxy.toString()) + .build(); + return getTargetTcpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetTcpProxy resource. Gets a list of available target TCP proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   TargetTcpProxy response = targetTcpProxyClient.getTargetTcpProxy(targetTcpProxy.toString());
+   * }
+   * 
+ * + * @param targetTcpProxy Name of the TargetTcpProxy resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetTcpProxy getTargetTcpProxy(String targetTcpProxy) { + + GetTargetTcpProxyHttpRequest request = + GetTargetTcpProxyHttpRequest.newBuilder().setTargetTcpProxy(targetTcpProxy).build(); + return getTargetTcpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetTcpProxy resource. Gets a list of available target TCP proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   GetTargetTcpProxyHttpRequest request = GetTargetTcpProxyHttpRequest.newBuilder()
+   *     .setTargetTcpProxy(targetTcpProxy.toString())
+   *     .build();
+   *   TargetTcpProxy response = targetTcpProxyClient.getTargetTcpProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetTcpProxy getTargetTcpProxy(GetTargetTcpProxyHttpRequest request) { + return getTargetTcpProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified TargetTcpProxy resource. Gets a list of available target TCP proxies by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   GetTargetTcpProxyHttpRequest request = GetTargetTcpProxyHttpRequest.newBuilder()
+   *     .setTargetTcpProxy(targetTcpProxy.toString())
+   *     .build();
+   *   ApiFuture<TargetTcpProxy> future = targetTcpProxyClient.getTargetTcpProxyCallable().futureCall(request);
+   *   // Do something
+   *   TargetTcpProxy response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getTargetTcpProxyCallable() { + return stub.getTargetTcpProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetTcpProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetTcpProxy targetTcpProxyResource = TargetTcpProxy.newBuilder().build();
+   *   Operation response = targetTcpProxyClient.insertTargetTcpProxy(project, targetTcpProxyResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param targetTcpProxyResource A TargetTcpProxy resource. This resource defines a TCP proxy. (== + * resource_for beta.targetTcpProxies ==) (== resource_for v1.targetTcpProxies ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetTcpProxy( + ProjectName project, TargetTcpProxy targetTcpProxyResource) { + + InsertTargetTcpProxyHttpRequest request = + InsertTargetTcpProxyHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setTargetTcpProxyResource(targetTcpProxyResource) + .build(); + return insertTargetTcpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetTcpProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetTcpProxy targetTcpProxyResource = TargetTcpProxy.newBuilder().build();
+   *   Operation response = targetTcpProxyClient.insertTargetTcpProxy(project.toString(), targetTcpProxyResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param targetTcpProxyResource A TargetTcpProxy resource. This resource defines a TCP proxy. (== + * resource_for beta.targetTcpProxies ==) (== resource_for v1.targetTcpProxies ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetTcpProxy( + String project, TargetTcpProxy targetTcpProxyResource) { + + InsertTargetTcpProxyHttpRequest request = + InsertTargetTcpProxyHttpRequest.newBuilder() + .setProject(project) + .setTargetTcpProxyResource(targetTcpProxyResource) + .build(); + return insertTargetTcpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetTcpProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetTcpProxy targetTcpProxyResource = TargetTcpProxy.newBuilder().build();
+   *   InsertTargetTcpProxyHttpRequest request = InsertTargetTcpProxyHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setTargetTcpProxyResource(targetTcpProxyResource)
+   *     .build();
+   *   Operation response = targetTcpProxyClient.insertTargetTcpProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetTcpProxy(InsertTargetTcpProxyHttpRequest request) { + return insertTargetTcpProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a TargetTcpProxy resource in the specified project using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   TargetTcpProxy targetTcpProxyResource = TargetTcpProxy.newBuilder().build();
+   *   InsertTargetTcpProxyHttpRequest request = InsertTargetTcpProxyHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setTargetTcpProxyResource(targetTcpProxyResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetTcpProxyClient.insertTargetTcpProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertTargetTcpProxyCallable() { + return stub.insertTargetTcpProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetTcpProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetTcpProxy element : targetTcpProxyClient.listTargetTcpProxies(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetTcpProxiesPagedResponse listTargetTcpProxies(ProjectName project) { + ListTargetTcpProxiesHttpRequest request = + ListTargetTcpProxiesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listTargetTcpProxies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetTcpProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetTcpProxy element : targetTcpProxyClient.listTargetTcpProxies(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetTcpProxiesPagedResponse listTargetTcpProxies(String project) { + ListTargetTcpProxiesHttpRequest request = + ListTargetTcpProxiesHttpRequest.newBuilder().setProject(project).build(); + return listTargetTcpProxies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetTcpProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetTcpProxiesHttpRequest request = ListTargetTcpProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (TargetTcpProxy element : targetTcpProxyClient.listTargetTcpProxies(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetTcpProxiesPagedResponse listTargetTcpProxies( + ListTargetTcpProxiesHttpRequest request) { + return listTargetTcpProxiesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetTcpProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetTcpProxiesHttpRequest request = ListTargetTcpProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListTargetTcpProxiesPagedResponse> future = targetTcpProxyClient.listTargetTcpProxiesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (TargetTcpProxy element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetTcpProxiesPagedCallable() { + return stub.listTargetTcpProxiesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of TargetTcpProxy resources available to the specified project. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListTargetTcpProxiesHttpRequest request = ListTargetTcpProxiesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     TargetTcpProxyList response = targetTcpProxyClient.listTargetTcpProxiesCallable().call(request);
+   *     for (TargetTcpProxy element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetTcpProxiesCallable() { + return stub.listTargetTcpProxiesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the BackendService for TargetTcpProxy. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource = TargetTcpProxiesSetBackendServiceRequest.newBuilder().build();
+   *   Operation response = targetTcpProxyClient.setBackendServiceTargetTcpProxy(targetTcpProxy, targetTcpProxiesSetBackendServiceRequestResource);
+   * }
+   * 
+ * + * @param targetTcpProxy Name of the TargetTcpProxy resource whose BackendService resource is to + * be set. + * @param targetTcpProxiesSetBackendServiceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setBackendServiceTargetTcpProxy( + ProjectGlobalTargetTcpProxyName targetTcpProxy, + TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource) { + + SetBackendServiceTargetTcpProxyHttpRequest request = + SetBackendServiceTargetTcpProxyHttpRequest.newBuilder() + .setTargetTcpProxy(targetTcpProxy == null ? null : targetTcpProxy.toString()) + .setTargetTcpProxiesSetBackendServiceRequestResource( + targetTcpProxiesSetBackendServiceRequestResource) + .build(); + return setBackendServiceTargetTcpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the BackendService for TargetTcpProxy. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource = TargetTcpProxiesSetBackendServiceRequest.newBuilder().build();
+   *   Operation response = targetTcpProxyClient.setBackendServiceTargetTcpProxy(targetTcpProxy.toString(), targetTcpProxiesSetBackendServiceRequestResource);
+   * }
+   * 
+ * + * @param targetTcpProxy Name of the TargetTcpProxy resource whose BackendService resource is to + * be set. + * @param targetTcpProxiesSetBackendServiceRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setBackendServiceTargetTcpProxy( + String targetTcpProxy, + TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource) { + + SetBackendServiceTargetTcpProxyHttpRequest request = + SetBackendServiceTargetTcpProxyHttpRequest.newBuilder() + .setTargetTcpProxy(targetTcpProxy) + .setTargetTcpProxiesSetBackendServiceRequestResource( + targetTcpProxiesSetBackendServiceRequestResource) + .build(); + return setBackendServiceTargetTcpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the BackendService for TargetTcpProxy. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource = TargetTcpProxiesSetBackendServiceRequest.newBuilder().build();
+   *   SetBackendServiceTargetTcpProxyHttpRequest request = SetBackendServiceTargetTcpProxyHttpRequest.newBuilder()
+   *     .setTargetTcpProxy(targetTcpProxy.toString())
+   *     .setTargetTcpProxiesSetBackendServiceRequestResource(targetTcpProxiesSetBackendServiceRequestResource)
+   *     .build();
+   *   Operation response = targetTcpProxyClient.setBackendServiceTargetTcpProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setBackendServiceTargetTcpProxy( + SetBackendServiceTargetTcpProxyHttpRequest request) { + return setBackendServiceTargetTcpProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the BackendService for TargetTcpProxy. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource = TargetTcpProxiesSetBackendServiceRequest.newBuilder().build();
+   *   SetBackendServiceTargetTcpProxyHttpRequest request = SetBackendServiceTargetTcpProxyHttpRequest.newBuilder()
+   *     .setTargetTcpProxy(targetTcpProxy.toString())
+   *     .setTargetTcpProxiesSetBackendServiceRequestResource(targetTcpProxiesSetBackendServiceRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetTcpProxyClient.setBackendServiceTargetTcpProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setBackendServiceTargetTcpProxyCallable() { + return stub.setBackendServiceTargetTcpProxyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the ProxyHeaderType for TargetTcpProxy. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource = TargetTcpProxiesSetProxyHeaderRequest.newBuilder().build();
+   *   Operation response = targetTcpProxyClient.setProxyHeaderTargetTcpProxy(targetTcpProxy, targetTcpProxiesSetProxyHeaderRequestResource);
+   * }
+   * 
+ * + * @param targetTcpProxy Name of the TargetTcpProxy resource whose ProxyHeader is to be set. + * @param targetTcpProxiesSetProxyHeaderRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setProxyHeaderTargetTcpProxy( + ProjectGlobalTargetTcpProxyName targetTcpProxy, + TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource) { + + SetProxyHeaderTargetTcpProxyHttpRequest request = + SetProxyHeaderTargetTcpProxyHttpRequest.newBuilder() + .setTargetTcpProxy(targetTcpProxy == null ? null : targetTcpProxy.toString()) + .setTargetTcpProxiesSetProxyHeaderRequestResource( + targetTcpProxiesSetProxyHeaderRequestResource) + .build(); + return setProxyHeaderTargetTcpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the ProxyHeaderType for TargetTcpProxy. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource = TargetTcpProxiesSetProxyHeaderRequest.newBuilder().build();
+   *   Operation response = targetTcpProxyClient.setProxyHeaderTargetTcpProxy(targetTcpProxy.toString(), targetTcpProxiesSetProxyHeaderRequestResource);
+   * }
+   * 
+ * + * @param targetTcpProxy Name of the TargetTcpProxy resource whose ProxyHeader is to be set. + * @param targetTcpProxiesSetProxyHeaderRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setProxyHeaderTargetTcpProxy( + String targetTcpProxy, + TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource) { + + SetProxyHeaderTargetTcpProxyHttpRequest request = + SetProxyHeaderTargetTcpProxyHttpRequest.newBuilder() + .setTargetTcpProxy(targetTcpProxy) + .setTargetTcpProxiesSetProxyHeaderRequestResource( + targetTcpProxiesSetProxyHeaderRequestResource) + .build(); + return setProxyHeaderTargetTcpProxy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the ProxyHeaderType for TargetTcpProxy. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource = TargetTcpProxiesSetProxyHeaderRequest.newBuilder().build();
+   *   SetProxyHeaderTargetTcpProxyHttpRequest request = SetProxyHeaderTargetTcpProxyHttpRequest.newBuilder()
+   *     .setTargetTcpProxy(targetTcpProxy.toString())
+   *     .setTargetTcpProxiesSetProxyHeaderRequestResource(targetTcpProxiesSetProxyHeaderRequestResource)
+   *     .build();
+   *   Operation response = targetTcpProxyClient.setProxyHeaderTargetTcpProxy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation setProxyHeaderTargetTcpProxy( + SetProxyHeaderTargetTcpProxyHttpRequest request) { + return setProxyHeaderTargetTcpProxyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes the ProxyHeaderType for TargetTcpProxy. + * + *

Sample code: + * + *


+   * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+   *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+   *   TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource = TargetTcpProxiesSetProxyHeaderRequest.newBuilder().build();
+   *   SetProxyHeaderTargetTcpProxyHttpRequest request = SetProxyHeaderTargetTcpProxyHttpRequest.newBuilder()
+   *     .setTargetTcpProxy(targetTcpProxy.toString())
+   *     .setTargetTcpProxiesSetProxyHeaderRequestResource(targetTcpProxiesSetProxyHeaderRequestResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetTcpProxyClient.setProxyHeaderTargetTcpProxyCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + setProxyHeaderTargetTcpProxyCallable() { + return stub.setProxyHeaderTargetTcpProxyCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListTargetTcpProxiesPagedResponse + extends AbstractPagedListResponse< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, TargetTcpProxy, + ListTargetTcpProxiesPage, ListTargetTcpProxiesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListTargetTcpProxiesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListTargetTcpProxiesPagedResponse apply(ListTargetTcpProxiesPage input) { + return new ListTargetTcpProxiesPagedResponse(input); + } + }); + } + + private ListTargetTcpProxiesPagedResponse(ListTargetTcpProxiesPage page) { + super(page, ListTargetTcpProxiesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListTargetTcpProxiesPage + extends AbstractPage< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, TargetTcpProxy, + ListTargetTcpProxiesPage> { + + private ListTargetTcpProxiesPage( + PageContext context, + TargetTcpProxyList response) { + super(context, response); + } + + private static ListTargetTcpProxiesPage createEmptyPage() { + return new ListTargetTcpProxiesPage(null, null); + } + + @Override + protected ListTargetTcpProxiesPage createPage( + PageContext context, + TargetTcpProxyList response) { + return new ListTargetTcpProxiesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListTargetTcpProxiesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, TargetTcpProxy, + ListTargetTcpProxiesPage, ListTargetTcpProxiesFixedSizeCollection> { + + private ListTargetTcpProxiesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListTargetTcpProxiesFixedSizeCollection createEmptyCollection() { + return new ListTargetTcpProxiesFixedSizeCollection(null, 0); + } + + @Override + protected ListTargetTcpProxiesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListTargetTcpProxiesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxyList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxyList.java new file mode 100644 index 000000000000..d7a118c6c3cd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxyList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetTcpProxyList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private TargetTcpProxyList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private TargetTcpProxyList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetTcpProxyList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetTcpProxyList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetTcpProxyList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetTcpProxyList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetTcpProxyList other) { + if (other == TargetTcpProxyList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetTcpProxyList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(TargetTcpProxy items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetTcpProxyList build() { + + return new TargetTcpProxyList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetTcpProxyList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetTcpProxyList) { + TargetTcpProxyList that = (TargetTcpProxyList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxySettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxySettings.java new file mode 100644 index 000000000000..505adac4f15c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetTcpProxySettings.java @@ -0,0 +1,248 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.TargetTcpProxyStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetTcpProxyClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetTcpProxy to 30 seconds: + * + *

+ * 
+ * TargetTcpProxySettings.Builder targetTcpProxySettingsBuilder =
+ *     TargetTcpProxySettings.newBuilder();
+ * targetTcpProxySettingsBuilder.deleteTargetTcpProxySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetTcpProxySettings targetTcpProxySettings = targetTcpProxySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetTcpProxySettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteTargetTcpProxy. */ + public UnaryCallSettings + deleteTargetTcpProxySettings() { + return ((TargetTcpProxyStubSettings) getStubSettings()).deleteTargetTcpProxySettings(); + } + + /** Returns the object with the settings used for calls to getTargetTcpProxy. */ + public UnaryCallSettings + getTargetTcpProxySettings() { + return ((TargetTcpProxyStubSettings) getStubSettings()).getTargetTcpProxySettings(); + } + + /** Returns the object with the settings used for calls to insertTargetTcpProxy. */ + public UnaryCallSettings + insertTargetTcpProxySettings() { + return ((TargetTcpProxyStubSettings) getStubSettings()).insertTargetTcpProxySettings(); + } + + /** Returns the object with the settings used for calls to listTargetTcpProxies. */ + public PagedCallSettings< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, ListTargetTcpProxiesPagedResponse> + listTargetTcpProxiesSettings() { + return ((TargetTcpProxyStubSettings) getStubSettings()).listTargetTcpProxiesSettings(); + } + + /** Returns the object with the settings used for calls to setBackendServiceTargetTcpProxy. */ + public UnaryCallSettings + setBackendServiceTargetTcpProxySettings() { + return ((TargetTcpProxyStubSettings) getStubSettings()) + .setBackendServiceTargetTcpProxySettings(); + } + + /** Returns the object with the settings used for calls to setProxyHeaderTargetTcpProxy. */ + public UnaryCallSettings + setProxyHeaderTargetTcpProxySettings() { + return ((TargetTcpProxyStubSettings) getStubSettings()).setProxyHeaderTargetTcpProxySettings(); + } + + public static final TargetTcpProxySettings create(TargetTcpProxyStubSettings stub) + throws IOException { + return new TargetTcpProxySettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return TargetTcpProxyStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return TargetTcpProxyStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return TargetTcpProxyStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return TargetTcpProxyStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return TargetTcpProxyStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return TargetTcpProxyStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return TargetTcpProxyStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TargetTcpProxyStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetTcpProxySettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for TargetTcpProxySettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(TargetTcpProxyStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(TargetTcpProxyStubSettings.newBuilder()); + } + + protected Builder(TargetTcpProxySettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(TargetTcpProxyStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public TargetTcpProxyStubSettings.Builder getStubSettingsBuilder() { + return ((TargetTcpProxyStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteTargetTcpProxy. */ + public UnaryCallSettings.Builder + deleteTargetTcpProxySettings() { + return getStubSettingsBuilder().deleteTargetTcpProxySettings(); + } + + /** Returns the builder for the settings used for calls to getTargetTcpProxy. */ + public UnaryCallSettings.Builder + getTargetTcpProxySettings() { + return getStubSettingsBuilder().getTargetTcpProxySettings(); + } + + /** Returns the builder for the settings used for calls to insertTargetTcpProxy. */ + public UnaryCallSettings.Builder + insertTargetTcpProxySettings() { + return getStubSettingsBuilder().insertTargetTcpProxySettings(); + } + + /** Returns the builder for the settings used for calls to listTargetTcpProxies. */ + public PagedCallSettings.Builder< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, ListTargetTcpProxiesPagedResponse> + listTargetTcpProxiesSettings() { + return getStubSettingsBuilder().listTargetTcpProxiesSettings(); + } + + /** Returns the builder for the settings used for calls to setBackendServiceTargetTcpProxy. */ + public UnaryCallSettings.Builder + setBackendServiceTargetTcpProxySettings() { + return getStubSettingsBuilder().setBackendServiceTargetTcpProxySettings(); + } + + /** Returns the builder for the settings used for calls to setProxyHeaderTargetTcpProxy. */ + public UnaryCallSettings.Builder + setProxyHeaderTargetTcpProxySettings() { + return getStubSettingsBuilder().setProxyHeaderTargetTcpProxySettings(); + } + + @Override + public TargetTcpProxySettings build() throws IOException { + return new TargetTcpProxySettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGateway.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGateway.java new file mode 100644 index 000000000000..70d886b3cb8e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGateway.java @@ -0,0 +1,486 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetVpnGateway implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final List forwardingRules; + private final String id; + private final String kind; + private final String name; + private final String network; + private final String region; + private final String selfLink; + private final String status; + private final List tunnels; + + private TargetVpnGateway() { + this.creationTimestamp = null; + this.description = null; + this.forwardingRules = null; + this.id = null; + this.kind = null; + this.name = null; + this.network = null; + this.region = null; + this.selfLink = null; + this.status = null; + this.tunnels = null; + } + + private TargetVpnGateway( + String creationTimestamp, + String description, + List forwardingRules, + String id, + String kind, + String name, + String network, + String region, + String selfLink, + String status, + List tunnels) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.forwardingRules = forwardingRules; + this.id = id; + this.kind = kind; + this.name = name; + this.network = network; + this.region = region; + this.selfLink = selfLink; + this.status = status; + this.tunnels = tunnels; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("forwardingRules")) { + return forwardingRules; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("network")) { + return network; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("status")) { + return status; + } + if (fieldName.equals("tunnels")) { + return tunnels; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public List getForwardingRulesList() { + return forwardingRules; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getNetwork() { + return network; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public String getStatus() { + return status; + } + + public List getTunnelsList() { + return tunnels; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetVpnGateway prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetVpnGateway getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetVpnGateway DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetVpnGateway(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private List forwardingRules; + private String id; + private String kind; + private String name; + private String network; + private String region; + private String selfLink; + private String status; + private List tunnels; + + Builder() {} + + public Builder mergeFrom(TargetVpnGateway other) { + if (other == TargetVpnGateway.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getForwardingRulesList() != null) { + this.forwardingRules = other.forwardingRules; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getNetwork() != null) { + this.network = other.network; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getStatus() != null) { + this.status = other.status; + } + if (other.getTunnelsList() != null) { + this.tunnels = other.tunnels; + } + return this; + } + + Builder(TargetVpnGateway source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.forwardingRules = source.forwardingRules; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.network = source.network; + this.region = source.region; + this.selfLink = source.selfLink; + this.status = source.status; + this.tunnels = source.tunnels; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public List getForwardingRulesList() { + return forwardingRules; + } + + public Builder addAllForwardingRules(List forwardingRules) { + if (this.forwardingRules == null) { + this.forwardingRules = new ArrayList<>(forwardingRules.size()); + } + this.forwardingRules.addAll(forwardingRules); + return this; + } + + public Builder addForwardingRules(String forwardingRules) { + this.forwardingRules.add(forwardingRules); + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getNetwork() { + return network; + } + + public Builder setNetwork(String network) { + this.network = network; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public List getTunnelsList() { + return tunnels; + } + + public Builder addAllTunnels(List tunnels) { + if (this.tunnels == null) { + this.tunnels = new ArrayList<>(tunnels.size()); + } + this.tunnels.addAll(tunnels); + return this; + } + + public Builder addTunnels(String tunnels) { + this.tunnels.add(tunnels); + return this; + } + + public TargetVpnGateway build() { + + return new TargetVpnGateway( + creationTimestamp, + description, + forwardingRules, + id, + kind, + name, + network, + region, + selfLink, + status, + tunnels); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.addAllForwardingRules(this.forwardingRules); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setNetwork(this.network); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setStatus(this.status); + newBuilder.addAllTunnels(this.tunnels); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetVpnGateway{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "forwardingRules=" + + forwardingRules + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "network=" + + network + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + ", " + + "status=" + + status + + ", " + + "tunnels=" + + tunnels + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetVpnGateway) { + TargetVpnGateway that = (TargetVpnGateway) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.forwardingRules, that.getForwardingRulesList()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.network, that.getNetwork()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.status, that.getStatus()) + && Objects.equals(this.tunnels, that.getTunnelsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + description, + forwardingRules, + id, + kind, + name, + network, + region, + selfLink, + status, + tunnels); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewayAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewayAggregatedList.java new file mode 100644 index 000000000000..e461f3ffcfe8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewayAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetVpnGatewayAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private TargetVpnGatewayAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private TargetVpnGatewayAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetVpnGatewayAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetVpnGatewayAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetVpnGatewayAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetVpnGatewayAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetVpnGatewayAggregatedList other) { + if (other == TargetVpnGatewayAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetVpnGatewayAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetVpnGatewayAggregatedList build() { + + return new TargetVpnGatewayAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetVpnGatewayAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetVpnGatewayAggregatedList) { + TargetVpnGatewayAggregatedList that = (TargetVpnGatewayAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewayClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewayClient.java new file mode 100644 index 000000000000..ff30faab874a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewayClient.java @@ -0,0 +1,960 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.TargetVpnGatewayStub; +import com.google.cloud.compute.v1.stub.TargetVpnGatewayStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+ *   ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
+ *   Operation response = targetVpnGatewayClient.deleteTargetVpnGateway(targetVpnGateway);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the targetVpnGatewayClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of TargetVpnGatewaySettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * TargetVpnGatewaySettings targetVpnGatewaySettings =
+ *     TargetVpnGatewaySettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * TargetVpnGatewayClient targetVpnGatewayClient =
+ *     TargetVpnGatewayClient.create(targetVpnGatewaySettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * TargetVpnGatewaySettings targetVpnGatewaySettings =
+ *     TargetVpnGatewaySettings.newBuilder().setEndpoint(myEndpoint).build();
+ * TargetVpnGatewayClient targetVpnGatewayClient =
+ *     TargetVpnGatewayClient.create(targetVpnGatewaySettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetVpnGatewayClient implements BackgroundResource { + private final TargetVpnGatewaySettings settings; + private final TargetVpnGatewayStub stub; + + /** Constructs an instance of TargetVpnGatewayClient with default settings. */ + public static final TargetVpnGatewayClient create() throws IOException { + return create(TargetVpnGatewaySettings.newBuilder().build()); + } + + /** + * Constructs an instance of TargetVpnGatewayClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final TargetVpnGatewayClient create(TargetVpnGatewaySettings settings) + throws IOException { + return new TargetVpnGatewayClient(settings); + } + + /** + * Constructs an instance of TargetVpnGatewayClient, using the given stub for making calls. This + * is for advanced usage - prefer to use TargetVpnGatewaySettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final TargetVpnGatewayClient create(TargetVpnGatewayStub stub) { + return new TargetVpnGatewayClient(stub); + } + + /** + * Constructs an instance of TargetVpnGatewayClient, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected TargetVpnGatewayClient(TargetVpnGatewaySettings settings) throws IOException { + this.settings = settings; + this.stub = ((TargetVpnGatewayStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected TargetVpnGatewayClient(TargetVpnGatewayStub stub) { + this.settings = null; + this.stub = stub; + } + + public final TargetVpnGatewaySettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetVpnGatewayStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target VPN gateways. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetVpnGatewaysScopedList element : targetVpnGatewayClient.aggregatedListTargetVpnGateways(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListTargetVpnGatewaysPagedResponse aggregatedListTargetVpnGateways( + ProjectName project) { + AggregatedListTargetVpnGatewaysHttpRequest request = + AggregatedListTargetVpnGatewaysHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListTargetVpnGateways(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target VPN gateways. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (TargetVpnGatewaysScopedList element : targetVpnGatewayClient.aggregatedListTargetVpnGateways(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListTargetVpnGatewaysPagedResponse aggregatedListTargetVpnGateways( + String project) { + AggregatedListTargetVpnGatewaysHttpRequest request = + AggregatedListTargetVpnGatewaysHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListTargetVpnGateways(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target VPN gateways. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListTargetVpnGatewaysHttpRequest request = AggregatedListTargetVpnGatewaysHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (TargetVpnGatewaysScopedList element : targetVpnGatewayClient.aggregatedListTargetVpnGateways(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListTargetVpnGatewaysPagedResponse aggregatedListTargetVpnGateways( + AggregatedListTargetVpnGatewaysHttpRequest request) { + return aggregatedListTargetVpnGatewaysPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target VPN gateways. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListTargetVpnGatewaysHttpRequest request = AggregatedListTargetVpnGatewaysHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListTargetVpnGatewaysPagedResponse> future = targetVpnGatewayClient.aggregatedListTargetVpnGatewaysPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (TargetVpnGatewaysScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListTargetVpnGatewaysHttpRequest, AggregatedListTargetVpnGatewaysPagedResponse> + aggregatedListTargetVpnGatewaysPagedCallable() { + return stub.aggregatedListTargetVpnGatewaysPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of target VPN gateways. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListTargetVpnGatewaysHttpRequest request = AggregatedListTargetVpnGatewaysHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     TargetVpnGatewayAggregatedList response = targetVpnGatewayClient.aggregatedListTargetVpnGatewaysCallable().call(request);
+   *     for (TargetVpnGatewaysScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList> + aggregatedListTargetVpnGatewaysCallable() { + return stub.aggregatedListTargetVpnGatewaysCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified target VPN gateway. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
+   *   Operation response = targetVpnGatewayClient.deleteTargetVpnGateway(targetVpnGateway);
+   * }
+   * 
+ * + * @param targetVpnGateway Name of the target VPN gateway to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetVpnGateway( + ProjectRegionTargetVpnGatewayName targetVpnGateway) { + + DeleteTargetVpnGatewayHttpRequest request = + DeleteTargetVpnGatewayHttpRequest.newBuilder() + .setTargetVpnGateway(targetVpnGateway == null ? null : targetVpnGateway.toString()) + .build(); + return deleteTargetVpnGateway(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified target VPN gateway. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
+   *   Operation response = targetVpnGatewayClient.deleteTargetVpnGateway(targetVpnGateway.toString());
+   * }
+   * 
+ * + * @param targetVpnGateway Name of the target VPN gateway to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetVpnGateway(String targetVpnGateway) { + + DeleteTargetVpnGatewayHttpRequest request = + DeleteTargetVpnGatewayHttpRequest.newBuilder() + .setTargetVpnGateway(targetVpnGateway) + .build(); + return deleteTargetVpnGateway(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified target VPN gateway. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
+   *   DeleteTargetVpnGatewayHttpRequest request = DeleteTargetVpnGatewayHttpRequest.newBuilder()
+   *     .setTargetVpnGateway(targetVpnGateway.toString())
+   *     .build();
+   *   Operation response = targetVpnGatewayClient.deleteTargetVpnGateway(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteTargetVpnGateway(DeleteTargetVpnGatewayHttpRequest request) { + return deleteTargetVpnGatewayCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified target VPN gateway. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
+   *   DeleteTargetVpnGatewayHttpRequest request = DeleteTargetVpnGatewayHttpRequest.newBuilder()
+   *     .setTargetVpnGateway(targetVpnGateway.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = targetVpnGatewayClient.deleteTargetVpnGatewayCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + deleteTargetVpnGatewayCallable() { + return stub.deleteTargetVpnGatewayCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified target VPN gateway. Gets a list of available target VPN gateways by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
+   *   TargetVpnGateway response = targetVpnGatewayClient.getTargetVpnGateway(targetVpnGateway);
+   * }
+   * 
+ * + * @param targetVpnGateway Name of the target VPN gateway to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetVpnGateway getTargetVpnGateway( + ProjectRegionTargetVpnGatewayName targetVpnGateway) { + + GetTargetVpnGatewayHttpRequest request = + GetTargetVpnGatewayHttpRequest.newBuilder() + .setTargetVpnGateway(targetVpnGateway == null ? null : targetVpnGateway.toString()) + .build(); + return getTargetVpnGateway(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified target VPN gateway. Gets a list of available target VPN gateways by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
+   *   TargetVpnGateway response = targetVpnGatewayClient.getTargetVpnGateway(targetVpnGateway.toString());
+   * }
+   * 
+ * + * @param targetVpnGateway Name of the target VPN gateway to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetVpnGateway getTargetVpnGateway(String targetVpnGateway) { + + GetTargetVpnGatewayHttpRequest request = + GetTargetVpnGatewayHttpRequest.newBuilder().setTargetVpnGateway(targetVpnGateway).build(); + return getTargetVpnGateway(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified target VPN gateway. Gets a list of available target VPN gateways by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
+   *   GetTargetVpnGatewayHttpRequest request = GetTargetVpnGatewayHttpRequest.newBuilder()
+   *     .setTargetVpnGateway(targetVpnGateway.toString())
+   *     .build();
+   *   TargetVpnGateway response = targetVpnGatewayClient.getTargetVpnGateway(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final TargetVpnGateway getTargetVpnGateway(GetTargetVpnGatewayHttpRequest request) { + return getTargetVpnGatewayCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified target VPN gateway. Gets a list of available target VPN gateways by + * making a list() request. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
+   *   GetTargetVpnGatewayHttpRequest request = GetTargetVpnGatewayHttpRequest.newBuilder()
+   *     .setTargetVpnGateway(targetVpnGateway.toString())
+   *     .build();
+   *   ApiFuture<TargetVpnGateway> future = targetVpnGatewayClient.getTargetVpnGatewayCallable().futureCall(request);
+   *   // Do something
+   *   TargetVpnGateway response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + getTargetVpnGatewayCallable() { + return stub.getTargetVpnGatewayCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a target VPN gateway in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   TargetVpnGateway targetVpnGatewayResource = TargetVpnGateway.newBuilder().build();
+   *   Operation response = targetVpnGatewayClient.insertTargetVpnGateway(region, targetVpnGatewayResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param targetVpnGatewayResource Represents a Target VPN gateway resource. (== resource_for + * beta.targetVpnGateways ==) (== resource_for v1.targetVpnGateways ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetVpnGateway( + ProjectRegionName region, TargetVpnGateway targetVpnGatewayResource) { + + InsertTargetVpnGatewayHttpRequest request = + InsertTargetVpnGatewayHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setTargetVpnGatewayResource(targetVpnGatewayResource) + .build(); + return insertTargetVpnGateway(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a target VPN gateway in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   TargetVpnGateway targetVpnGatewayResource = TargetVpnGateway.newBuilder().build();
+   *   Operation response = targetVpnGatewayClient.insertTargetVpnGateway(region.toString(), targetVpnGatewayResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param targetVpnGatewayResource Represents a Target VPN gateway resource. (== resource_for + * beta.targetVpnGateways ==) (== resource_for v1.targetVpnGateways ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetVpnGateway( + String region, TargetVpnGateway targetVpnGatewayResource) { + + InsertTargetVpnGatewayHttpRequest request = + InsertTargetVpnGatewayHttpRequest.newBuilder() + .setRegion(region) + .setTargetVpnGatewayResource(targetVpnGatewayResource) + .build(); + return insertTargetVpnGateway(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a target VPN gateway in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   TargetVpnGateway targetVpnGatewayResource = TargetVpnGateway.newBuilder().build();
+   *   InsertTargetVpnGatewayHttpRequest request = InsertTargetVpnGatewayHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setTargetVpnGatewayResource(targetVpnGatewayResource)
+   *     .build();
+   *   Operation response = targetVpnGatewayClient.insertTargetVpnGateway(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertTargetVpnGateway(InsertTargetVpnGatewayHttpRequest request) { + return insertTargetVpnGatewayCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a target VPN gateway in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   TargetVpnGateway targetVpnGatewayResource = TargetVpnGateway.newBuilder().build();
+   *   InsertTargetVpnGatewayHttpRequest request = InsertTargetVpnGatewayHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setTargetVpnGatewayResource(targetVpnGatewayResource)
+   *     .build();
+   *   ApiFuture<Operation> future = targetVpnGatewayClient.insertTargetVpnGatewayCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + insertTargetVpnGatewayCallable() { + return stub.insertTargetVpnGatewayCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of target VPN gateways available to the specified project and region. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (TargetVpnGateway element : targetVpnGatewayClient.listTargetVpnGateways(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetVpnGatewaysPagedResponse listTargetVpnGateways(ProjectRegionName region) { + ListTargetVpnGatewaysHttpRequest request = + ListTargetVpnGatewaysHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listTargetVpnGateways(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of target VPN gateways available to the specified project and region. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (TargetVpnGateway element : targetVpnGatewayClient.listTargetVpnGateways(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetVpnGatewaysPagedResponse listTargetVpnGateways(String region) { + ListTargetVpnGatewaysHttpRequest request = + ListTargetVpnGatewaysHttpRequest.newBuilder().setRegion(region).build(); + return listTargetVpnGateways(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of target VPN gateways available to the specified project and region. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListTargetVpnGatewaysHttpRequest request = ListTargetVpnGatewaysHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (TargetVpnGateway element : targetVpnGatewayClient.listTargetVpnGateways(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListTargetVpnGatewaysPagedResponse listTargetVpnGateways( + ListTargetVpnGatewaysHttpRequest request) { + return listTargetVpnGatewaysPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of target VPN gateways available to the specified project and region. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListTargetVpnGatewaysHttpRequest request = ListTargetVpnGatewaysHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListTargetVpnGatewaysPagedResponse> future = targetVpnGatewayClient.listTargetVpnGatewaysPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (TargetVpnGateway element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetVpnGatewaysPagedCallable() { + return stub.listTargetVpnGatewaysPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of target VPN gateways available to the specified project and region. + * + *

Sample code: + * + *


+   * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListTargetVpnGatewaysHttpRequest request = ListTargetVpnGatewaysHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     TargetVpnGatewayList response = targetVpnGatewayClient.listTargetVpnGatewaysCallable().call(request);
+   *     for (TargetVpnGateway element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listTargetVpnGatewaysCallable() { + return stub.listTargetVpnGatewaysCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListTargetVpnGatewaysPagedResponse + extends AbstractPagedListResponse< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + TargetVpnGatewaysScopedList, AggregatedListTargetVpnGatewaysPage, + AggregatedListTargetVpnGatewaysFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + TargetVpnGatewaysScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListTargetVpnGatewaysPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + AggregatedListTargetVpnGatewaysPage, AggregatedListTargetVpnGatewaysPagedResponse>() { + @Override + public AggregatedListTargetVpnGatewaysPagedResponse apply( + AggregatedListTargetVpnGatewaysPage input) { + return new AggregatedListTargetVpnGatewaysPagedResponse(input); + } + }); + } + + private AggregatedListTargetVpnGatewaysPagedResponse(AggregatedListTargetVpnGatewaysPage page) { + super(page, AggregatedListTargetVpnGatewaysFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListTargetVpnGatewaysPage + extends AbstractPage< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + TargetVpnGatewaysScopedList, AggregatedListTargetVpnGatewaysPage> { + + private AggregatedListTargetVpnGatewaysPage( + PageContext< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + TargetVpnGatewaysScopedList> + context, + TargetVpnGatewayAggregatedList response) { + super(context, response); + } + + private static AggregatedListTargetVpnGatewaysPage createEmptyPage() { + return new AggregatedListTargetVpnGatewaysPage(null, null); + } + + @Override + protected AggregatedListTargetVpnGatewaysPage createPage( + PageContext< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + TargetVpnGatewaysScopedList> + context, + TargetVpnGatewayAggregatedList response) { + return new AggregatedListTargetVpnGatewaysPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + TargetVpnGatewaysScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListTargetVpnGatewaysFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + TargetVpnGatewaysScopedList, AggregatedListTargetVpnGatewaysPage, + AggregatedListTargetVpnGatewaysFixedSizeCollection> { + + private AggregatedListTargetVpnGatewaysFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListTargetVpnGatewaysFixedSizeCollection createEmptyCollection() { + return new AggregatedListTargetVpnGatewaysFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListTargetVpnGatewaysFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListTargetVpnGatewaysFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListTargetVpnGatewaysPagedResponse + extends AbstractPagedListResponse< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, TargetVpnGateway, + ListTargetVpnGatewaysPage, ListTargetVpnGatewaysFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListTargetVpnGatewaysPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListTargetVpnGatewaysPagedResponse apply(ListTargetVpnGatewaysPage input) { + return new ListTargetVpnGatewaysPagedResponse(input); + } + }); + } + + private ListTargetVpnGatewaysPagedResponse(ListTargetVpnGatewaysPage page) { + super(page, ListTargetVpnGatewaysFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListTargetVpnGatewaysPage + extends AbstractPage< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, TargetVpnGateway, + ListTargetVpnGatewaysPage> { + + private ListTargetVpnGatewaysPage( + PageContext + context, + TargetVpnGatewayList response) { + super(context, response); + } + + private static ListTargetVpnGatewaysPage createEmptyPage() { + return new ListTargetVpnGatewaysPage(null, null); + } + + @Override + protected ListTargetVpnGatewaysPage createPage( + PageContext + context, + TargetVpnGatewayList response) { + return new ListTargetVpnGatewaysPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListTargetVpnGatewaysFixedSizeCollection + extends AbstractFixedSizeCollection< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, TargetVpnGateway, + ListTargetVpnGatewaysPage, ListTargetVpnGatewaysFixedSizeCollection> { + + private ListTargetVpnGatewaysFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListTargetVpnGatewaysFixedSizeCollection createEmptyCollection() { + return new ListTargetVpnGatewaysFixedSizeCollection(null, 0); + } + + @Override + protected ListTargetVpnGatewaysFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListTargetVpnGatewaysFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewayList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewayList.java new file mode 100644 index 000000000000..5c854db00c19 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewayList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetVpnGatewayList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private TargetVpnGatewayList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private TargetVpnGatewayList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetVpnGatewayList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetVpnGatewayList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetVpnGatewayList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetVpnGatewayList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetVpnGatewayList other) { + if (other == TargetVpnGatewayList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetVpnGatewayList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(TargetVpnGateway items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetVpnGatewayList build() { + + return new TargetVpnGatewayList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetVpnGatewayList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetVpnGatewayList) { + TargetVpnGatewayList that = (TargetVpnGatewayList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewaySettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewaySettings.java new file mode 100644 index 000000000000..87f837af53f8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewaySettings.java @@ -0,0 +1,243 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse; +import static com.google.cloud.compute.v1.TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.TargetVpnGatewayStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetVpnGatewayClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetVpnGateway to 30 seconds: + * + *

+ * 
+ * TargetVpnGatewaySettings.Builder targetVpnGatewaySettingsBuilder =
+ *     TargetVpnGatewaySettings.newBuilder();
+ * targetVpnGatewaySettingsBuilder.deleteTargetVpnGatewaySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetVpnGatewaySettings targetVpnGatewaySettings = targetVpnGatewaySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetVpnGatewaySettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListTargetVpnGateways. */ + public PagedCallSettings< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + AggregatedListTargetVpnGatewaysPagedResponse> + aggregatedListTargetVpnGatewaysSettings() { + return ((TargetVpnGatewayStubSettings) getStubSettings()) + .aggregatedListTargetVpnGatewaysSettings(); + } + + /** Returns the object with the settings used for calls to deleteTargetVpnGateway. */ + public UnaryCallSettings + deleteTargetVpnGatewaySettings() { + return ((TargetVpnGatewayStubSettings) getStubSettings()).deleteTargetVpnGatewaySettings(); + } + + /** Returns the object with the settings used for calls to getTargetVpnGateway. */ + public UnaryCallSettings + getTargetVpnGatewaySettings() { + return ((TargetVpnGatewayStubSettings) getStubSettings()).getTargetVpnGatewaySettings(); + } + + /** Returns the object with the settings used for calls to insertTargetVpnGateway. */ + public UnaryCallSettings + insertTargetVpnGatewaySettings() { + return ((TargetVpnGatewayStubSettings) getStubSettings()).insertTargetVpnGatewaySettings(); + } + + /** Returns the object with the settings used for calls to listTargetVpnGateways. */ + public PagedCallSettings< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, + ListTargetVpnGatewaysPagedResponse> + listTargetVpnGatewaysSettings() { + return ((TargetVpnGatewayStubSettings) getStubSettings()).listTargetVpnGatewaysSettings(); + } + + public static final TargetVpnGatewaySettings create(TargetVpnGatewayStubSettings stub) + throws IOException { + return new TargetVpnGatewaySettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return TargetVpnGatewayStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return TargetVpnGatewayStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return TargetVpnGatewayStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return TargetVpnGatewayStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return TargetVpnGatewayStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return TargetVpnGatewayStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return TargetVpnGatewayStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TargetVpnGatewayStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetVpnGatewaySettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for TargetVpnGatewaySettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(TargetVpnGatewayStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(TargetVpnGatewayStubSettings.newBuilder()); + } + + protected Builder(TargetVpnGatewaySettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(TargetVpnGatewayStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public TargetVpnGatewayStubSettings.Builder getStubSettingsBuilder() { + return ((TargetVpnGatewayStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListTargetVpnGateways. */ + public PagedCallSettings.Builder< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + AggregatedListTargetVpnGatewaysPagedResponse> + aggregatedListTargetVpnGatewaysSettings() { + return getStubSettingsBuilder().aggregatedListTargetVpnGatewaysSettings(); + } + + /** Returns the builder for the settings used for calls to deleteTargetVpnGateway. */ + public UnaryCallSettings.Builder + deleteTargetVpnGatewaySettings() { + return getStubSettingsBuilder().deleteTargetVpnGatewaySettings(); + } + + /** Returns the builder for the settings used for calls to getTargetVpnGateway. */ + public UnaryCallSettings.Builder + getTargetVpnGatewaySettings() { + return getStubSettingsBuilder().getTargetVpnGatewaySettings(); + } + + /** Returns the builder for the settings used for calls to insertTargetVpnGateway. */ + public UnaryCallSettings.Builder + insertTargetVpnGatewaySettings() { + return getStubSettingsBuilder().insertTargetVpnGatewaySettings(); + } + + /** Returns the builder for the settings used for calls to listTargetVpnGateways. */ + public PagedCallSettings.Builder< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, + ListTargetVpnGatewaysPagedResponse> + listTargetVpnGatewaysSettings() { + return getStubSettingsBuilder().listTargetVpnGatewaysSettings(); + } + + @Override + public TargetVpnGatewaySettings build() throws IOException { + return new TargetVpnGatewaySettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewaysScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewaysScopedList.java new file mode 100644 index 000000000000..11cbdff73336 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetVpnGatewaysScopedList.java @@ -0,0 +1,184 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetVpnGatewaysScopedList implements ApiMessage { + private final List targetVpnGateways; + private final Warning warning; + + private TargetVpnGatewaysScopedList() { + this.targetVpnGateways = null; + this.warning = null; + } + + private TargetVpnGatewaysScopedList(List targetVpnGateways, Warning warning) { + this.targetVpnGateways = targetVpnGateways; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("targetVpnGateways")) { + return targetVpnGateways; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getTargetVpnGatewaysList() { + return targetVpnGateways; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetVpnGatewaysScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetVpnGatewaysScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetVpnGatewaysScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetVpnGatewaysScopedList(); + } + + public static class Builder { + private List targetVpnGateways; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(TargetVpnGatewaysScopedList other) { + if (other == TargetVpnGatewaysScopedList.getDefaultInstance()) return this; + if (other.getTargetVpnGatewaysList() != null) { + this.targetVpnGateways = other.targetVpnGateways; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(TargetVpnGatewaysScopedList source) { + this.targetVpnGateways = source.targetVpnGateways; + this.warning = source.warning; + } + + public List getTargetVpnGatewaysList() { + return targetVpnGateways; + } + + public Builder addAllTargetVpnGateways(List targetVpnGateways) { + if (this.targetVpnGateways == null) { + this.targetVpnGateways = new ArrayList<>(targetVpnGateways.size()); + } + this.targetVpnGateways.addAll(targetVpnGateways); + return this; + } + + public Builder addTargetVpnGateways(TargetVpnGateway targetVpnGateways) { + this.targetVpnGateways.add(targetVpnGateways); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public TargetVpnGatewaysScopedList build() { + + return new TargetVpnGatewaysScopedList(targetVpnGateways, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllTargetVpnGateways(this.targetVpnGateways); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetVpnGatewaysScopedList{" + + "targetVpnGateways=" + + targetVpnGateways + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetVpnGatewaysScopedList) { + TargetVpnGatewaysScopedList that = (TargetVpnGatewaysScopedList) o; + return Objects.equals(this.targetVpnGateways, that.getTargetVpnGatewaysList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(targetVpnGateways, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestFailure.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestFailure.java new file mode 100644 index 000000000000..df706e89fc10 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestFailure.java @@ -0,0 +1,233 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TestFailure implements ApiMessage { + private final String actualService; + private final String expectedService; + private final String host; + private final String path; + + private TestFailure() { + this.actualService = null; + this.expectedService = null; + this.host = null; + this.path = null; + } + + private TestFailure(String actualService, String expectedService, String host, String path) { + this.actualService = actualService; + this.expectedService = expectedService; + this.host = host; + this.path = path; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("actualService")) { + return actualService; + } + if (fieldName.equals("expectedService")) { + return expectedService; + } + if (fieldName.equals("host")) { + return host; + } + if (fieldName.equals("path")) { + return path; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getActualService() { + return actualService; + } + + public String getExpectedService() { + return expectedService; + } + + public String getHost() { + return host; + } + + public String getPath() { + return path; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TestFailure prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TestFailure getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TestFailure DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TestFailure(); + } + + public static class Builder { + private String actualService; + private String expectedService; + private String host; + private String path; + + Builder() {} + + public Builder mergeFrom(TestFailure other) { + if (other == TestFailure.getDefaultInstance()) return this; + if (other.getActualService() != null) { + this.actualService = other.actualService; + } + if (other.getExpectedService() != null) { + this.expectedService = other.expectedService; + } + if (other.getHost() != null) { + this.host = other.host; + } + if (other.getPath() != null) { + this.path = other.path; + } + return this; + } + + Builder(TestFailure source) { + this.actualService = source.actualService; + this.expectedService = source.expectedService; + this.host = source.host; + this.path = source.path; + } + + public String getActualService() { + return actualService; + } + + public Builder setActualService(String actualService) { + this.actualService = actualService; + return this; + } + + public String getExpectedService() { + return expectedService; + } + + public Builder setExpectedService(String expectedService) { + this.expectedService = expectedService; + return this; + } + + public String getHost() { + return host; + } + + public Builder setHost(String host) { + this.host = host; + return this; + } + + public String getPath() { + return path; + } + + public Builder setPath(String path) { + this.path = path; + return this; + } + + public TestFailure build() { + + return new TestFailure(actualService, expectedService, host, path); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setActualService(this.actualService); + newBuilder.setExpectedService(this.expectedService); + newBuilder.setHost(this.host); + newBuilder.setPath(this.path); + return newBuilder; + } + } + + @Override + public String toString() { + return "TestFailure{" + + "actualService=" + + actualService + + ", " + + "expectedService=" + + expectedService + + ", " + + "host=" + + host + + ", " + + "path=" + + path + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TestFailure) { + TestFailure that = (TestFailure) o; + return Objects.equals(this.actualService, that.getActualService()) + && Objects.equals(this.expectedService, that.getExpectedService()) + && Objects.equals(this.host, that.getHost()) + && Objects.equals(this.path, that.getPath()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(actualService, expectedService, host, path); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestIamPermissionsLicenseCodeHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestIamPermissionsLicenseCodeHttpRequest.java new file mode 100644 index 000000000000..f1ed4d30d813 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestIamPermissionsLicenseCodeHttpRequest.java @@ -0,0 +1,415 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TestIamPermissionsLicenseCodeHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String resource; + private final TestPermissionsRequest testPermissionsRequestResource; + private final String userIp; + + private TestIamPermissionsLicenseCodeHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.resource = null; + this.testPermissionsRequestResource = null; + this.userIp = null; + } + + private TestIamPermissionsLicenseCodeHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String resource, + TestPermissionsRequest testPermissionsRequestResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.resource = resource; + this.testPermissionsRequestResource = testPermissionsRequestResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("resource")) { + return resource; + } + if (fieldName.equals("testPermissionsRequestResource")) { + return testPermissionsRequestResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TestPermissionsRequest getApiMessageRequestBody() { + return testPermissionsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getResource() { + return resource; + } + + public TestPermissionsRequest getTestPermissionsRequestResource() { + return testPermissionsRequestResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TestIamPermissionsLicenseCodeHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TestIamPermissionsLicenseCodeHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TestIamPermissionsLicenseCodeHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TestIamPermissionsLicenseCodeHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String resource; + private TestPermissionsRequest testPermissionsRequestResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(TestIamPermissionsLicenseCodeHttpRequest other) { + if (other == TestIamPermissionsLicenseCodeHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getResource() != null) { + this.resource = other.resource; + } + if (other.getTestPermissionsRequestResource() != null) { + this.testPermissionsRequestResource = other.testPermissionsRequestResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(TestIamPermissionsLicenseCodeHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.resource = source.resource; + this.testPermissionsRequestResource = source.testPermissionsRequestResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getResource() { + return resource; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + public TestPermissionsRequest getTestPermissionsRequestResource() { + return testPermissionsRequestResource; + } + + public Builder setTestPermissionsRequestResource( + TestPermissionsRequest testPermissionsRequestResource) { + this.testPermissionsRequestResource = testPermissionsRequestResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public TestIamPermissionsLicenseCodeHttpRequest build() { + String missing = ""; + + if (resource == null) { + missing += " resource"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new TestIamPermissionsLicenseCodeHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + resource, + testPermissionsRequestResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setResource(this.resource); + newBuilder.setTestPermissionsRequestResource(this.testPermissionsRequestResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "TestIamPermissionsLicenseCodeHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "resource=" + + resource + + ", " + + "testPermissionsRequestResource=" + + testPermissionsRequestResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TestIamPermissionsLicenseCodeHttpRequest) { + TestIamPermissionsLicenseCodeHttpRequest that = (TestIamPermissionsLicenseCodeHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.resource, that.getResource()) + && Objects.equals( + this.testPermissionsRequestResource, that.getTestPermissionsRequestResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + resource, + testPermissionsRequestResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestIamPermissionsLicenseHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestIamPermissionsLicenseHttpRequest.java new file mode 100644 index 000000000000..3813b199cda8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestIamPermissionsLicenseHttpRequest.java @@ -0,0 +1,415 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TestIamPermissionsLicenseHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String resource; + private final TestPermissionsRequest testPermissionsRequestResource; + private final String userIp; + + private TestIamPermissionsLicenseHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.resource = null; + this.testPermissionsRequestResource = null; + this.userIp = null; + } + + private TestIamPermissionsLicenseHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String resource, + TestPermissionsRequest testPermissionsRequestResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.resource = resource; + this.testPermissionsRequestResource = testPermissionsRequestResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("resource")) { + return resource; + } + if (fieldName.equals("testPermissionsRequestResource")) { + return testPermissionsRequestResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TestPermissionsRequest getApiMessageRequestBody() { + return testPermissionsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getResource() { + return resource; + } + + public TestPermissionsRequest getTestPermissionsRequestResource() { + return testPermissionsRequestResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TestIamPermissionsLicenseHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TestIamPermissionsLicenseHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TestIamPermissionsLicenseHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TestIamPermissionsLicenseHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String resource; + private TestPermissionsRequest testPermissionsRequestResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(TestIamPermissionsLicenseHttpRequest other) { + if (other == TestIamPermissionsLicenseHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getResource() != null) { + this.resource = other.resource; + } + if (other.getTestPermissionsRequestResource() != null) { + this.testPermissionsRequestResource = other.testPermissionsRequestResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(TestIamPermissionsLicenseHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.resource = source.resource; + this.testPermissionsRequestResource = source.testPermissionsRequestResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getResource() { + return resource; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + public TestPermissionsRequest getTestPermissionsRequestResource() { + return testPermissionsRequestResource; + } + + public Builder setTestPermissionsRequestResource( + TestPermissionsRequest testPermissionsRequestResource) { + this.testPermissionsRequestResource = testPermissionsRequestResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public TestIamPermissionsLicenseHttpRequest build() { + String missing = ""; + + if (resource == null) { + missing += " resource"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new TestIamPermissionsLicenseHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + resource, + testPermissionsRequestResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setResource(this.resource); + newBuilder.setTestPermissionsRequestResource(this.testPermissionsRequestResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "TestIamPermissionsLicenseHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "resource=" + + resource + + ", " + + "testPermissionsRequestResource=" + + testPermissionsRequestResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TestIamPermissionsLicenseHttpRequest) { + TestIamPermissionsLicenseHttpRequest that = (TestIamPermissionsLicenseHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.resource, that.getResource()) + && Objects.equals( + this.testPermissionsRequestResource, that.getTestPermissionsRequestResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + resource, + testPermissionsRequestResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestIamPermissionsRegionDiskHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestIamPermissionsRegionDiskHttpRequest.java new file mode 100644 index 000000000000..8c2f58e277bc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestIamPermissionsRegionDiskHttpRequest.java @@ -0,0 +1,415 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TestIamPermissionsRegionDiskHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String resource; + private final TestPermissionsRequest testPermissionsRequestResource; + private final String userIp; + + private TestIamPermissionsRegionDiskHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.resource = null; + this.testPermissionsRequestResource = null; + this.userIp = null; + } + + private TestIamPermissionsRegionDiskHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String resource, + TestPermissionsRequest testPermissionsRequestResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.resource = resource; + this.testPermissionsRequestResource = testPermissionsRequestResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("resource")) { + return resource; + } + if (fieldName.equals("testPermissionsRequestResource")) { + return testPermissionsRequestResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public TestPermissionsRequest getApiMessageRequestBody() { + return testPermissionsRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getResource() { + return resource; + } + + public TestPermissionsRequest getTestPermissionsRequestResource() { + return testPermissionsRequestResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TestIamPermissionsRegionDiskHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TestIamPermissionsRegionDiskHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TestIamPermissionsRegionDiskHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TestIamPermissionsRegionDiskHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String resource; + private TestPermissionsRequest testPermissionsRequestResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(TestIamPermissionsRegionDiskHttpRequest other) { + if (other == TestIamPermissionsRegionDiskHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getResource() != null) { + this.resource = other.resource; + } + if (other.getTestPermissionsRequestResource() != null) { + this.testPermissionsRequestResource = other.testPermissionsRequestResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(TestIamPermissionsRegionDiskHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.resource = source.resource; + this.testPermissionsRequestResource = source.testPermissionsRequestResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getResource() { + return resource; + } + + public Builder setResource(String resource) { + this.resource = resource; + return this; + } + + public TestPermissionsRequest getTestPermissionsRequestResource() { + return testPermissionsRequestResource; + } + + public Builder setTestPermissionsRequestResource( + TestPermissionsRequest testPermissionsRequestResource) { + this.testPermissionsRequestResource = testPermissionsRequestResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public TestIamPermissionsRegionDiskHttpRequest build() { + String missing = ""; + + if (resource == null) { + missing += " resource"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new TestIamPermissionsRegionDiskHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + resource, + testPermissionsRequestResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setResource(this.resource); + newBuilder.setTestPermissionsRequestResource(this.testPermissionsRequestResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "TestIamPermissionsRegionDiskHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "resource=" + + resource + + ", " + + "testPermissionsRequestResource=" + + testPermissionsRequestResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TestIamPermissionsRegionDiskHttpRequest) { + TestIamPermissionsRegionDiskHttpRequest that = (TestIamPermissionsRegionDiskHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.resource, that.getResource()) + && Objects.equals( + this.testPermissionsRequestResource, that.getTestPermissionsRequestResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + resource, + testPermissionsRequestResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestPermissionsRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestPermissionsRequest.java new file mode 100644 index 000000000000..ff9b408e5c8b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestPermissionsRequest.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TestPermissionsRequest implements ApiMessage { + private final List permissions; + + private TestPermissionsRequest() { + this.permissions = null; + } + + private TestPermissionsRequest(List permissions) { + this.permissions = permissions; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("permissions")) { + return permissions; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getPermissionsList() { + return permissions; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TestPermissionsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TestPermissionsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TestPermissionsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TestPermissionsRequest(); + } + + public static class Builder { + private List permissions; + + Builder() {} + + public Builder mergeFrom(TestPermissionsRequest other) { + if (other == TestPermissionsRequest.getDefaultInstance()) return this; + if (other.getPermissionsList() != null) { + this.permissions = other.permissions; + } + return this; + } + + Builder(TestPermissionsRequest source) { + this.permissions = source.permissions; + } + + public List getPermissionsList() { + return permissions; + } + + public Builder addAllPermissions(List permissions) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(permissions.size()); + } + this.permissions.addAll(permissions); + return this; + } + + public Builder addPermissions(String permissions) { + this.permissions.add(permissions); + return this; + } + + public TestPermissionsRequest build() { + return new TestPermissionsRequest(permissions); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllPermissions(this.permissions); + return newBuilder; + } + } + + @Override + public String toString() { + return "TestPermissionsRequest{" + "permissions=" + permissions + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TestPermissionsRequest) { + TestPermissionsRequest that = (TestPermissionsRequest) o; + return Objects.equals(this.permissions, that.getPermissionsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(permissions); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestPermissionsResponse.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestPermissionsResponse.java new file mode 100644 index 000000000000..8f29bbd7bce2 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TestPermissionsResponse.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TestPermissionsResponse implements ApiMessage { + private final List permissions; + + private TestPermissionsResponse() { + this.permissions = null; + } + + private TestPermissionsResponse(List permissions) { + this.permissions = permissions; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("permissions")) { + return permissions; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getPermissionsList() { + return permissions; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TestPermissionsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TestPermissionsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TestPermissionsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TestPermissionsResponse(); + } + + public static class Builder { + private List permissions; + + Builder() {} + + public Builder mergeFrom(TestPermissionsResponse other) { + if (other == TestPermissionsResponse.getDefaultInstance()) return this; + if (other.getPermissionsList() != null) { + this.permissions = other.permissions; + } + return this; + } + + Builder(TestPermissionsResponse source) { + this.permissions = source.permissions; + } + + public List getPermissionsList() { + return permissions; + } + + public Builder addAllPermissions(List permissions) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(permissions.size()); + } + this.permissions.addAll(permissions); + return this; + } + + public Builder addPermissions(String permissions) { + this.permissions.add(permissions); + return this; + } + + public TestPermissionsResponse build() { + return new TestPermissionsResponse(permissions); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllPermissions(this.permissions); + return newBuilder; + } + } + + @Override + public String toString() { + return "TestPermissionsResponse{" + "permissions=" + permissions + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TestPermissionsResponse) { + TestPermissionsResponse that = (TestPermissionsResponse) o; + return Objects.equals(this.permissions, that.getPermissionsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(permissions); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateAccessConfigInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateAccessConfigInstanceHttpRequest.java new file mode 100644 index 000000000000..29f7d04ec065 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateAccessConfigInstanceHttpRequest.java @@ -0,0 +1,481 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateAccessConfigInstanceHttpRequest implements ApiMessage { + private final AccessConfig accessConfigResource; + private final String access_token; + private final String callback; + private final String fields; + private final String instance; + private final String key; + private final String networkInterface; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private UpdateAccessConfigInstanceHttpRequest() { + this.accessConfigResource = null; + this.access_token = null; + this.callback = null; + this.fields = null; + this.instance = null; + this.key = null; + this.networkInterface = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private UpdateAccessConfigInstanceHttpRequest( + AccessConfig accessConfigResource, + String access_token, + String callback, + String fields, + String instance, + String key, + String networkInterface, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.accessConfigResource = accessConfigResource; + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.instance = instance; + this.key = key; + this.networkInterface = networkInterface; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("accessConfigResource")) { + return accessConfigResource; + } + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("networkInterface")) { + return networkInterface; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public AccessConfig getApiMessageRequestBody() { + return accessConfigResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public AccessConfig getAccessConfigResource() { + return accessConfigResource; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getNetworkInterface() { + return networkInterface; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateAccessConfigInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateAccessConfigInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateAccessConfigInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateAccessConfigInstanceHttpRequest(); + } + + public static class Builder { + private AccessConfig accessConfigResource; + private String access_token; + private String callback; + private String fields; + private String instance; + private String key; + private String networkInterface; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateAccessConfigInstanceHttpRequest other) { + if (other == UpdateAccessConfigInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessConfigResource() != null) { + this.accessConfigResource = other.accessConfigResource; + } + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getNetworkInterface() != null) { + this.networkInterface = other.networkInterface; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateAccessConfigInstanceHttpRequest source) { + this.accessConfigResource = source.accessConfigResource; + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.networkInterface = source.networkInterface; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public AccessConfig getAccessConfigResource() { + return accessConfigResource; + } + + public Builder setAccessConfigResource(AccessConfig accessConfigResource) { + this.accessConfigResource = accessConfigResource; + return this; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getNetworkInterface() { + return networkInterface; + } + + public Builder setNetworkInterface(String networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateAccessConfigInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (networkInterface == null) { + missing += " networkInterface"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateAccessConfigInstanceHttpRequest( + accessConfigResource, + access_token, + callback, + fields, + instance, + key, + networkInterface, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessConfigResource(this.accessConfigResource); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setNetworkInterface(this.networkInterface); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateAccessConfigInstanceHttpRequest{" + + "accessConfigResource=" + + accessConfigResource + + ", " + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "networkInterface=" + + networkInterface + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateAccessConfigInstanceHttpRequest) { + UpdateAccessConfigInstanceHttpRequest that = (UpdateAccessConfigInstanceHttpRequest) o; + return Objects.equals(this.accessConfigResource, that.getAccessConfigResource()) + && Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.networkInterface, that.getNetworkInterface()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + accessConfigResource, + access_token, + callback, + fields, + instance, + key, + networkInterface, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateAutoscalerHttpRequest.java new file mode 100644 index 000000000000..8f44596273da --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateAutoscalerHttpRequest.java @@ -0,0 +1,504 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateAutoscalerHttpRequest implements ApiMessage { + private final String access_token; + private final String autoscaler; + private final Autoscaler autoscalerResource; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + private final String zone; + + private UpdateAutoscalerHttpRequest() { + this.access_token = null; + this.autoscaler = null; + this.autoscalerResource = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + this.zone = null; + } + + private UpdateAutoscalerHttpRequest( + String access_token, + String autoscaler, + Autoscaler autoscalerResource, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp, + String zone) { + this.access_token = access_token; + this.autoscaler = autoscaler; + this.autoscalerResource = autoscalerResource; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + this.zone = zone; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("autoscaler")) { + return autoscaler; + } + if (fieldName.equals("autoscalerResource")) { + return autoscalerResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + if (fieldName.equals("zone")) { + return zone; + } + return null; + } + + @Nullable + @Override + public Autoscaler getApiMessageRequestBody() { + return autoscalerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public String getZone() { + return zone; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateAutoscalerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateAutoscalerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateAutoscalerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateAutoscalerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String autoscaler; + private Autoscaler autoscalerResource; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + private String zone; + + Builder() {} + + public Builder mergeFrom(UpdateAutoscalerHttpRequest other) { + if (other == UpdateAutoscalerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAutoscaler() != null) { + this.autoscaler = other.autoscaler; + } + if (other.getAutoscalerResource() != null) { + this.autoscalerResource = other.autoscalerResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + if (other.getZone() != null) { + this.zone = other.zone; + } + return this; + } + + Builder(UpdateAutoscalerHttpRequest source) { + this.access_token = source.access_token; + this.autoscaler = source.autoscaler; + this.autoscalerResource = source.autoscalerResource; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + this.zone = source.zone; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Builder setAutoscaler(String autoscaler) { + this.autoscaler = autoscaler; + return this; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public Builder setAutoscalerResource(Autoscaler autoscalerResource) { + this.autoscalerResource = autoscalerResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public String getZone() { + return zone; + } + + public Builder setZone(String zone) { + this.zone = zone; + return this; + } + + public UpdateAutoscalerHttpRequest build() { + String missing = ""; + + if (zone == null) { + missing += " zone"; + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateAutoscalerHttpRequest( + access_token, + autoscaler, + autoscalerResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp, + zone); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAutoscaler(this.autoscaler); + newBuilder.setAutoscalerResource(this.autoscalerResource); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + newBuilder.setZone(this.zone); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateAutoscalerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "autoscaler=" + + autoscaler + + ", " + + "autoscalerResource=" + + autoscalerResource + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + ", " + + "zone=" + + zone + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateAutoscalerHttpRequest) { + UpdateAutoscalerHttpRequest that = (UpdateAutoscalerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.autoscaler, that.getAutoscaler()) + && Objects.equals(this.autoscalerResource, that.getAutoscalerResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()) + && Objects.equals(this.zone, that.getZone()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + autoscaler, + autoscalerResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp, + zone); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendBucketHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendBucketHttpRequest.java new file mode 100644 index 000000000000..4c40aef2a060 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendBucketHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateBackendBucketHttpRequest implements ApiMessage { + private final String access_token; + private final String backendBucket; + private final BackendBucket backendBucketResource; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private UpdateBackendBucketHttpRequest() { + this.access_token = null; + this.backendBucket = null; + this.backendBucketResource = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private UpdateBackendBucketHttpRequest( + String access_token, + String backendBucket, + BackendBucket backendBucketResource, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendBucket = backendBucket; + this.backendBucketResource = backendBucketResource; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendBucket")) { + return backendBucket; + } + if (fieldName.equals("backendBucketResource")) { + return backendBucketResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public BackendBucket getApiMessageRequestBody() { + return backendBucketResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendBucket() { + return backendBucket; + } + + public BackendBucket getBackendBucketResource() { + return backendBucketResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateBackendBucketHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateBackendBucketHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateBackendBucketHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateBackendBucketHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendBucket; + private BackendBucket backendBucketResource; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateBackendBucketHttpRequest other) { + if (other == UpdateBackendBucketHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendBucket() != null) { + this.backendBucket = other.backendBucket; + } + if (other.getBackendBucketResource() != null) { + this.backendBucketResource = other.backendBucketResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateBackendBucketHttpRequest source) { + this.access_token = source.access_token; + this.backendBucket = source.backendBucket; + this.backendBucketResource = source.backendBucketResource; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendBucket() { + return backendBucket; + } + + public Builder setBackendBucket(String backendBucket) { + this.backendBucket = backendBucket; + return this; + } + + public BackendBucket getBackendBucketResource() { + return backendBucketResource; + } + + public Builder setBackendBucketResource(BackendBucket backendBucketResource) { + this.backendBucketResource = backendBucketResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateBackendBucketHttpRequest build() { + String missing = ""; + + if (backendBucket == null) { + missing += " backendBucket"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateBackendBucketHttpRequest( + access_token, + backendBucket, + backendBucketResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendBucket(this.backendBucket); + newBuilder.setBackendBucketResource(this.backendBucketResource); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateBackendBucketHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendBucket=" + + backendBucket + + ", " + + "backendBucketResource=" + + backendBucketResource + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateBackendBucketHttpRequest) { + UpdateBackendBucketHttpRequest that = (UpdateBackendBucketHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendBucket, that.getBackendBucket()) + && Objects.equals(this.backendBucketResource, that.getBackendBucketResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendBucket, + backendBucketResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendServiceHttpRequest.java new file mode 100644 index 000000000000..c2db0a34accb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendServiceHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final String backendService; + private final BackendService backendServiceResource; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private UpdateBackendServiceHttpRequest() { + this.access_token = null; + this.backendService = null; + this.backendServiceResource = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private UpdateBackendServiceHttpRequest( + String access_token, + String backendService, + BackendService backendServiceResource, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendService = backendService; + this.backendServiceResource = backendServiceResource; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendService")) { + return backendService; + } + if (fieldName.equals("backendServiceResource")) { + return backendServiceResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public BackendService getApiMessageRequestBody() { + return backendServiceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendService() { + return backendService; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendService; + private BackendService backendServiceResource; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateBackendServiceHttpRequest other) { + if (other == UpdateBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendService() != null) { + this.backendService = other.backendService; + } + if (other.getBackendServiceResource() != null) { + this.backendServiceResource = other.backendServiceResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendService = source.backendService; + this.backendServiceResource = source.backendServiceResource; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendService() { + return backendService; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public Builder setBackendServiceResource(BackendService backendServiceResource) { + this.backendServiceResource = backendServiceResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateBackendServiceHttpRequest build() { + String missing = ""; + + if (backendService == null) { + missing += " backendService"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateBackendServiceHttpRequest( + access_token, + backendService, + backendServiceResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendService(this.backendService); + newBuilder.setBackendServiceResource(this.backendServiceResource); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendService=" + + backendService + + ", " + + "backendServiceResource=" + + backendServiceResource + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateBackendServiceHttpRequest) { + UpdateBackendServiceHttpRequest that = (UpdateBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.backendServiceResource, that.getBackendServiceResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendService, + backendServiceResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateFirewallHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateFirewallHttpRequest.java new file mode 100644 index 000000000000..bc40d74b3fdc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateFirewallHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateFirewallHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String firewall; + private final Firewall firewallResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private UpdateFirewallHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.firewall = null; + this.firewallResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private UpdateFirewallHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String firewall, + Firewall firewallResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.firewall = firewall; + this.firewallResource = firewallResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("firewall")) { + return firewall; + } + if (fieldName.equals("firewallResource")) { + return firewallResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Firewall getApiMessageRequestBody() { + return firewallResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getFirewall() { + return firewall; + } + + public Firewall getFirewallResource() { + return firewallResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateFirewallHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateFirewallHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateFirewallHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateFirewallHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String firewall; + private Firewall firewallResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateFirewallHttpRequest other) { + if (other == UpdateFirewallHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getFirewall() != null) { + this.firewall = other.firewall; + } + if (other.getFirewallResource() != null) { + this.firewallResource = other.firewallResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateFirewallHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.firewall = source.firewall; + this.firewallResource = source.firewallResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getFirewall() { + return firewall; + } + + public Builder setFirewall(String firewall) { + this.firewall = firewall; + return this; + } + + public Firewall getFirewallResource() { + return firewallResource; + } + + public Builder setFirewallResource(Firewall firewallResource) { + this.firewallResource = firewallResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateFirewallHttpRequest build() { + String missing = ""; + + if (firewall == null) { + missing += " firewall"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateFirewallHttpRequest( + access_token, + callback, + fieldMask, + fields, + firewall, + firewallResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setFirewall(this.firewall); + newBuilder.setFirewallResource(this.firewallResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateFirewallHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "firewall=" + + firewall + + ", " + + "firewallResource=" + + firewallResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateFirewallHttpRequest) { + UpdateFirewallHttpRequest that = (UpdateFirewallHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.firewall, that.getFirewall()) + && Objects.equals(this.firewallResource, that.getFirewallResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + firewall, + firewallResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHealthCheckHttpRequest.java new file mode 100644 index 000000000000..dd475e3ce0f8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHealthCheckHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String healthCheck; + private final HealthCheck healthCheckResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private UpdateHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.healthCheck = null; + this.healthCheckResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private UpdateHealthCheckHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String healthCheck, + HealthCheck healthCheckResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.healthCheck = healthCheck; + this.healthCheckResource = healthCheckResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("healthCheck")) { + return healthCheck; + } + if (fieldName.equals("healthCheckResource")) { + return healthCheckResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public HealthCheck getApiMessageRequestBody() { + return healthCheckResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHealthCheck() { + return healthCheck; + } + + public HealthCheck getHealthCheckResource() { + return healthCheckResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String healthCheck; + private HealthCheck healthCheckResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateHealthCheckHttpRequest other) { + if (other == UpdateHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHealthCheck() != null) { + this.healthCheck = other.healthCheck; + } + if (other.getHealthCheckResource() != null) { + this.healthCheckResource = other.healthCheckResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.healthCheck = source.healthCheck; + this.healthCheckResource = source.healthCheckResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHealthCheck() { + return healthCheck; + } + + public Builder setHealthCheck(String healthCheck) { + this.healthCheck = healthCheck; + return this; + } + + public HealthCheck getHealthCheckResource() { + return healthCheckResource; + } + + public Builder setHealthCheckResource(HealthCheck healthCheckResource) { + this.healthCheckResource = healthCheckResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateHealthCheckHttpRequest build() { + String missing = ""; + + if (healthCheck == null) { + missing += " healthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateHealthCheckHttpRequest( + access_token, + callback, + fieldMask, + fields, + healthCheck, + healthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setHealthCheck(this.healthCheck); + newBuilder.setHealthCheckResource(this.healthCheckResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "healthCheck=" + + healthCheck + + ", " + + "healthCheckResource=" + + healthCheckResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateHealthCheckHttpRequest) { + UpdateHealthCheckHttpRequest that = (UpdateHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.healthCheck, that.getHealthCheck()) + && Objects.equals(this.healthCheckResource, that.getHealthCheckResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + healthCheck, + healthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpHealthCheckHttpRequest.java new file mode 100644 index 000000000000..268b31281559 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpHealthCheckHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateHttpHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String httpHealthCheck; + private final HttpHealthCheck2 httpHealthCheckResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private UpdateHttpHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.httpHealthCheck = null; + this.httpHealthCheckResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private UpdateHttpHealthCheckHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String httpHealthCheck, + HttpHealthCheck2 httpHealthCheckResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.httpHealthCheck = httpHealthCheck; + this.httpHealthCheckResource = httpHealthCheckResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("httpHealthCheck")) { + return httpHealthCheck; + } + if (fieldName.equals("httpHealthCheckResource")) { + return httpHealthCheckResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public HttpHealthCheck2 getApiMessageRequestBody() { + return httpHealthCheckResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHttpHealthCheck() { + return httpHealthCheck; + } + + public HttpHealthCheck2 getHttpHealthCheckResource() { + return httpHealthCheckResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateHttpHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateHttpHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateHttpHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateHttpHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String httpHealthCheck; + private HttpHealthCheck2 httpHealthCheckResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateHttpHealthCheckHttpRequest other) { + if (other == UpdateHttpHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHttpHealthCheck() != null) { + this.httpHealthCheck = other.httpHealthCheck; + } + if (other.getHttpHealthCheckResource() != null) { + this.httpHealthCheckResource = other.httpHealthCheckResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateHttpHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.httpHealthCheck = source.httpHealthCheck; + this.httpHealthCheckResource = source.httpHealthCheckResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHttpHealthCheck() { + return httpHealthCheck; + } + + public Builder setHttpHealthCheck(String httpHealthCheck) { + this.httpHealthCheck = httpHealthCheck; + return this; + } + + public HttpHealthCheck2 getHttpHealthCheckResource() { + return httpHealthCheckResource; + } + + public Builder setHttpHealthCheckResource(HttpHealthCheck2 httpHealthCheckResource) { + this.httpHealthCheckResource = httpHealthCheckResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateHttpHealthCheckHttpRequest build() { + String missing = ""; + + if (httpHealthCheck == null) { + missing += " httpHealthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateHttpHealthCheckHttpRequest( + access_token, + callback, + fieldMask, + fields, + httpHealthCheck, + httpHealthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setHttpHealthCheck(this.httpHealthCheck); + newBuilder.setHttpHealthCheckResource(this.httpHealthCheckResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateHttpHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "httpHealthCheck=" + + httpHealthCheck + + ", " + + "httpHealthCheckResource=" + + httpHealthCheckResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateHttpHealthCheckHttpRequest) { + UpdateHttpHealthCheckHttpRequest that = (UpdateHttpHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.httpHealthCheck, that.getHttpHealthCheck()) + && Objects.equals(this.httpHealthCheckResource, that.getHttpHealthCheckResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + httpHealthCheck, + httpHealthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpsHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpsHealthCheckHttpRequest.java new file mode 100644 index 000000000000..4e1efc4c27ba --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpsHealthCheckHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateHttpsHealthCheckHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String httpsHealthCheck; + private final HttpsHealthCheck2 httpsHealthCheckResource; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private UpdateHttpsHealthCheckHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.httpsHealthCheck = null; + this.httpsHealthCheckResource = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private UpdateHttpsHealthCheckHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String httpsHealthCheck, + HttpsHealthCheck2 httpsHealthCheckResource, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.httpsHealthCheck = httpsHealthCheck; + this.httpsHealthCheckResource = httpsHealthCheckResource; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("httpsHealthCheck")) { + return httpsHealthCheck; + } + if (fieldName.equals("httpsHealthCheckResource")) { + return httpsHealthCheckResource; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public HttpsHealthCheck2 getApiMessageRequestBody() { + return httpsHealthCheckResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public HttpsHealthCheck2 getHttpsHealthCheckResource() { + return httpsHealthCheckResource; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateHttpsHealthCheckHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateHttpsHealthCheckHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateHttpsHealthCheckHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateHttpsHealthCheckHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String httpsHealthCheck; + private HttpsHealthCheck2 httpsHealthCheckResource; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateHttpsHealthCheckHttpRequest other) { + if (other == UpdateHttpsHealthCheckHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getHttpsHealthCheck() != null) { + this.httpsHealthCheck = other.httpsHealthCheck; + } + if (other.getHttpsHealthCheckResource() != null) { + this.httpsHealthCheckResource = other.httpsHealthCheckResource; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateHttpsHealthCheckHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.httpsHealthCheck = source.httpsHealthCheck; + this.httpsHealthCheckResource = source.httpsHealthCheckResource; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getHttpsHealthCheck() { + return httpsHealthCheck; + } + + public Builder setHttpsHealthCheck(String httpsHealthCheck) { + this.httpsHealthCheck = httpsHealthCheck; + return this; + } + + public HttpsHealthCheck2 getHttpsHealthCheckResource() { + return httpsHealthCheckResource; + } + + public Builder setHttpsHealthCheckResource(HttpsHealthCheck2 httpsHealthCheckResource) { + this.httpsHealthCheckResource = httpsHealthCheckResource; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateHttpsHealthCheckHttpRequest build() { + String missing = ""; + + if (httpsHealthCheck == null) { + missing += " httpsHealthCheck"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateHttpsHealthCheckHttpRequest( + access_token, + callback, + fieldMask, + fields, + httpsHealthCheck, + httpsHealthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setHttpsHealthCheck(this.httpsHealthCheck); + newBuilder.setHttpsHealthCheckResource(this.httpsHealthCheckResource); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateHttpsHealthCheckHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "httpsHealthCheck=" + + httpsHealthCheck + + ", " + + "httpsHealthCheckResource=" + + httpsHealthCheckResource + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateHttpsHealthCheckHttpRequest) { + UpdateHttpsHealthCheckHttpRequest that = (UpdateHttpsHealthCheckHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.httpsHealthCheck, that.getHttpsHealthCheck()) + && Objects.equals(this.httpsHealthCheckResource, that.getHttpsHealthCheckResource()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + httpsHealthCheck, + httpsHealthCheckResource, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateNetworkInterfaceInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateNetworkInterfaceInstanceHttpRequest.java new file mode 100644 index 000000000000..4d23d4d321e7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateNetworkInterfaceInstanceHttpRequest.java @@ -0,0 +1,510 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateNetworkInterfaceInstanceHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String instance; + private final String key; + private final String networkInterface; + private final NetworkInterface networkInterfaceResource; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private UpdateNetworkInterfaceInstanceHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.instance = null; + this.key = null; + this.networkInterface = null; + this.networkInterfaceResource = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private UpdateNetworkInterfaceInstanceHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String instance, + String key, + String networkInterface, + NetworkInterface networkInterfaceResource, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.instance = instance; + this.key = key; + this.networkInterface = networkInterface; + this.networkInterfaceResource = networkInterfaceResource; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("instance")) { + return instance; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("networkInterface")) { + return networkInterface; + } + if (fieldName.equals("networkInterfaceResource")) { + return networkInterfaceResource; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public NetworkInterface getApiMessageRequestBody() { + return networkInterfaceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getInstance() { + return instance; + } + + public String getKey() { + return key; + } + + public String getNetworkInterface() { + return networkInterface; + } + + public NetworkInterface getNetworkInterfaceResource() { + return networkInterfaceResource; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateNetworkInterfaceInstanceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateNetworkInterfaceInstanceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateNetworkInterfaceInstanceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateNetworkInterfaceInstanceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String instance; + private String key; + private String networkInterface; + private NetworkInterface networkInterfaceResource; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateNetworkInterfaceInstanceHttpRequest other) { + if (other == UpdateNetworkInterfaceInstanceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getInstance() != null) { + this.instance = other.instance; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getNetworkInterface() != null) { + this.networkInterface = other.networkInterface; + } + if (other.getNetworkInterfaceResource() != null) { + this.networkInterfaceResource = other.networkInterfaceResource; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateNetworkInterfaceInstanceHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.instance = source.instance; + this.key = source.key; + this.networkInterface = source.networkInterface; + this.networkInterfaceResource = source.networkInterfaceResource; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getInstance() { + return instance; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getNetworkInterface() { + return networkInterface; + } + + public Builder setNetworkInterface(String networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + public NetworkInterface getNetworkInterfaceResource() { + return networkInterfaceResource; + } + + public Builder setNetworkInterfaceResource(NetworkInterface networkInterfaceResource) { + this.networkInterfaceResource = networkInterfaceResource; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateNetworkInterfaceInstanceHttpRequest build() { + String missing = ""; + + if (instance == null) { + missing += " instance"; + } + + if (networkInterface == null) { + missing += " networkInterface"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateNetworkInterfaceInstanceHttpRequest( + access_token, + callback, + fieldMask, + fields, + instance, + key, + networkInterface, + networkInterfaceResource, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setInstance(this.instance); + newBuilder.setKey(this.key); + newBuilder.setNetworkInterface(this.networkInterface); + newBuilder.setNetworkInterfaceResource(this.networkInterfaceResource); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateNetworkInterfaceInstanceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "instance=" + + instance + + ", " + + "key=" + + key + + ", " + + "networkInterface=" + + networkInterface + + ", " + + "networkInterfaceResource=" + + networkInterfaceResource + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateNetworkInterfaceInstanceHttpRequest) { + UpdateNetworkInterfaceInstanceHttpRequest that = + (UpdateNetworkInterfaceInstanceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.instance, that.getInstance()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.networkInterface, that.getNetworkInterface()) + && Objects.equals(this.networkInterfaceResource, that.getNetworkInterfaceResource()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + instance, + key, + networkInterface, + networkInterfaceResource, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionAutoscalerHttpRequest.java new file mode 100644 index 000000000000..fe33e4ccc64d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionAutoscalerHttpRequest.java @@ -0,0 +1,505 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateRegionAutoscalerHttpRequest implements ApiMessage { + private final String access_token; + private final String autoscaler; + private final Autoscaler autoscalerResource; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String region; + private final String requestId; + private final String userIp; + + private UpdateRegionAutoscalerHttpRequest() { + this.access_token = null; + this.autoscaler = null; + this.autoscalerResource = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.region = null; + this.requestId = null; + this.userIp = null; + } + + private UpdateRegionAutoscalerHttpRequest( + String access_token, + String autoscaler, + Autoscaler autoscalerResource, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String region, + String requestId, + String userIp) { + this.access_token = access_token; + this.autoscaler = autoscaler; + this.autoscalerResource = autoscalerResource; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.region = region; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("autoscaler")) { + return autoscaler; + } + if (fieldName.equals("autoscalerResource")) { + return autoscalerResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Autoscaler getApiMessageRequestBody() { + return autoscalerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRegion() { + return region; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateRegionAutoscalerHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateRegionAutoscalerHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateRegionAutoscalerHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateRegionAutoscalerHttpRequest(); + } + + public static class Builder { + private String access_token; + private String autoscaler; + private Autoscaler autoscalerResource; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String region; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateRegionAutoscalerHttpRequest other) { + if (other == UpdateRegionAutoscalerHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getAutoscaler() != null) { + this.autoscaler = other.autoscaler; + } + if (other.getAutoscalerResource() != null) { + this.autoscalerResource = other.autoscalerResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateRegionAutoscalerHttpRequest source) { + this.access_token = source.access_token; + this.autoscaler = source.autoscaler; + this.autoscalerResource = source.autoscalerResource; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.region = source.region; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getAutoscaler() { + return autoscaler; + } + + public Builder setAutoscaler(String autoscaler) { + this.autoscaler = autoscaler; + return this; + } + + public Autoscaler getAutoscalerResource() { + return autoscalerResource; + } + + public Builder setAutoscalerResource(Autoscaler autoscalerResource) { + this.autoscalerResource = autoscalerResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateRegionAutoscalerHttpRequest build() { + String missing = ""; + + if (region == null) { + missing += " region"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateRegionAutoscalerHttpRequest( + access_token, + autoscaler, + autoscalerResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setAutoscaler(this.autoscaler); + newBuilder.setAutoscalerResource(this.autoscalerResource); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRegion(this.region); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateRegionAutoscalerHttpRequest{" + + "access_token=" + + access_token + + ", " + + "autoscaler=" + + autoscaler + + ", " + + "autoscalerResource=" + + autoscalerResource + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "region=" + + region + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateRegionAutoscalerHttpRequest) { + UpdateRegionAutoscalerHttpRequest that = (UpdateRegionAutoscalerHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.autoscaler, that.getAutoscaler()) + && Objects.equals(this.autoscalerResource, that.getAutoscalerResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + autoscaler, + autoscalerResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + region, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionBackendServiceHttpRequest.java new file mode 100644 index 000000000000..50ff784603bb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionBackendServiceHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateRegionBackendServiceHttpRequest implements ApiMessage { + private final String access_token; + private final String backendService; + private final BackendService backendServiceResource; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String userIp; + + private UpdateRegionBackendServiceHttpRequest() { + this.access_token = null; + this.backendService = null; + this.backendServiceResource = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.userIp = null; + } + + private UpdateRegionBackendServiceHttpRequest( + String access_token, + String backendService, + BackendService backendServiceResource, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String userIp) { + this.access_token = access_token; + this.backendService = backendService; + this.backendServiceResource = backendServiceResource; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("backendService")) { + return backendService; + } + if (fieldName.equals("backendServiceResource")) { + return backendServiceResource; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public BackendService getApiMessageRequestBody() { + return backendServiceResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getBackendService() { + return backendService; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateRegionBackendServiceHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateRegionBackendServiceHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateRegionBackendServiceHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateRegionBackendServiceHttpRequest(); + } + + public static class Builder { + private String access_token; + private String backendService; + private BackendService backendServiceResource; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateRegionBackendServiceHttpRequest other) { + if (other == UpdateRegionBackendServiceHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getBackendService() != null) { + this.backendService = other.backendService; + } + if (other.getBackendServiceResource() != null) { + this.backendServiceResource = other.backendServiceResource; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateRegionBackendServiceHttpRequest source) { + this.access_token = source.access_token; + this.backendService = source.backendService; + this.backendServiceResource = source.backendServiceResource; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getBackendService() { + return backendService; + } + + public Builder setBackendService(String backendService) { + this.backendService = backendService; + return this; + } + + public BackendService getBackendServiceResource() { + return backendServiceResource; + } + + public Builder setBackendServiceResource(BackendService backendServiceResource) { + this.backendServiceResource = backendServiceResource; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateRegionBackendServiceHttpRequest build() { + String missing = ""; + + if (backendService == null) { + missing += " backendService"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateRegionBackendServiceHttpRequest( + access_token, + backendService, + backendServiceResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setBackendService(this.backendService); + newBuilder.setBackendServiceResource(this.backendServiceResource); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateRegionBackendServiceHttpRequest{" + + "access_token=" + + access_token + + ", " + + "backendService=" + + backendService + + ", " + + "backendServiceResource=" + + backendServiceResource + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateRegionBackendServiceHttpRequest) { + UpdateRegionBackendServiceHttpRequest that = (UpdateRegionBackendServiceHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.backendService, that.getBackendService()) + && Objects.equals(this.backendServiceResource, that.getBackendServiceResource()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + backendService, + backendServiceResource, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRouterHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRouterHttpRequest.java new file mode 100644 index 000000000000..33353765119e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRouterHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateRouterHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String router; + private final Router routerResource; + private final String userIp; + + private UpdateRouterHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.router = null; + this.routerResource = null; + this.userIp = null; + } + + private UpdateRouterHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String router, + Router routerResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.router = router; + this.routerResource = routerResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("router")) { + return router; + } + if (fieldName.equals("routerResource")) { + return routerResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public Router getApiMessageRequestBody() { + return routerResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getRouter() { + return router; + } + + public Router getRouterResource() { + return routerResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateRouterHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateRouterHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateRouterHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateRouterHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String router; + private Router routerResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateRouterHttpRequest other) { + if (other == UpdateRouterHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getRouter() != null) { + this.router = other.router; + } + if (other.getRouterResource() != null) { + this.routerResource = other.routerResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateRouterHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.router = source.router; + this.routerResource = source.routerResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getRouter() { + return router; + } + + public Builder setRouter(String router) { + this.router = router; + return this; + } + + public Router getRouterResource() { + return routerResource; + } + + public Builder setRouterResource(Router routerResource) { + this.routerResource = routerResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateRouterHttpRequest build() { + String missing = ""; + + if (router == null) { + missing += " router"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateRouterHttpRequest( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + router, + routerResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setRouter(this.router); + newBuilder.setRouterResource(this.routerResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateRouterHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "router=" + + router + + ", " + + "routerResource=" + + routerResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateRouterHttpRequest) { + UpdateRouterHttpRequest that = (UpdateRouterHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.router, that.getRouter()) + && Objects.equals(this.routerResource, that.getRouterResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + router, + routerResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateUrlMapHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateUrlMapHttpRequest.java new file mode 100644 index 000000000000..d10954b5d792 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateUrlMapHttpRequest.java @@ -0,0 +1,473 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UpdateUrlMapHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final List fieldMask; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String requestId; + private final String urlMap; + private final UrlMap urlMapResource; + private final String userIp; + + private UpdateUrlMapHttpRequest() { + this.access_token = null; + this.callback = null; + this.fieldMask = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.requestId = null; + this.urlMap = null; + this.urlMapResource = null; + this.userIp = null; + } + + private UpdateUrlMapHttpRequest( + String access_token, + String callback, + List fieldMask, + String fields, + String key, + String prettyPrint, + String quotaUser, + String requestId, + String urlMap, + UrlMap urlMapResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fieldMask = fieldMask; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.requestId = requestId; + this.urlMap = urlMap; + this.urlMapResource = urlMapResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fieldMask")) { + return fieldMask; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("requestId")) { + return requestId; + } + if (fieldName.equals("urlMap")) { + return urlMap; + } + if (fieldName.equals("urlMapResource")) { + return urlMapResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public UrlMap getApiMessageRequestBody() { + return urlMapResource; + } + + @Nullable + @Override + public List getFieldMask() { + return fieldMask; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getRequestId() { + return requestId; + } + + public String getUrlMap() { + return urlMap; + } + + public UrlMap getUrlMapResource() { + return urlMapResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UpdateUrlMapHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UpdateUrlMapHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UpdateUrlMapHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UpdateUrlMapHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private List fieldMask; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String requestId; + private String urlMap; + private UrlMap urlMapResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(UpdateUrlMapHttpRequest other) { + if (other == UpdateUrlMapHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFieldMask() != null) { + this.fieldMask = other.fieldMask; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getRequestId() != null) { + this.requestId = other.requestId; + } + if (other.getUrlMap() != null) { + this.urlMap = other.urlMap; + } + if (other.getUrlMapResource() != null) { + this.urlMapResource = other.urlMapResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(UpdateUrlMapHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fieldMask = source.fieldMask; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.requestId = source.requestId; + this.urlMap = source.urlMap; + this.urlMapResource = source.urlMapResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public List getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(List fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getRequestId() { + return requestId; + } + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public String getUrlMap() { + return urlMap; + } + + public Builder setUrlMap(String urlMap) { + this.urlMap = urlMap; + return this; + } + + public UrlMap getUrlMapResource() { + return urlMapResource; + } + + public Builder setUrlMapResource(UrlMap urlMapResource) { + this.urlMapResource = urlMapResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public UpdateUrlMapHttpRequest build() { + String missing = ""; + + if (urlMap == null) { + missing += " urlMap"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new UpdateUrlMapHttpRequest( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + urlMap, + urlMapResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFieldMask(this.fieldMask); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setRequestId(this.requestId); + newBuilder.setUrlMap(this.urlMap); + newBuilder.setUrlMapResource(this.urlMapResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "UpdateUrlMapHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fieldMask=" + + fieldMask + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "requestId=" + + requestId + + ", " + + "urlMap=" + + urlMap + + ", " + + "urlMapResource=" + + urlMapResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UpdateUrlMapHttpRequest) { + UpdateUrlMapHttpRequest that = (UpdateUrlMapHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fieldMask, that.getFieldMask()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.requestId, that.getRequestId()) + && Objects.equals(this.urlMap, that.getUrlMap()) + && Objects.equals(this.urlMapResource, that.getUrlMapResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fieldMask, + fields, + key, + prettyPrint, + quotaUser, + requestId, + urlMap, + urlMapResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMap.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMap.java new file mode 100644 index 000000000000..8480218f299c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMap.java @@ -0,0 +1,494 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UrlMap implements ApiMessage { + private final String creationTimestamp; + private final String defaultService; + private final String description; + private final String fingerprint; + private final List hostRules; + private final String id; + private final String kind; + private final String name; + private final List pathMatchers; + private final String selfLink; + private final List tests; + + private UrlMap() { + this.creationTimestamp = null; + this.defaultService = null; + this.description = null; + this.fingerprint = null; + this.hostRules = null; + this.id = null; + this.kind = null; + this.name = null; + this.pathMatchers = null; + this.selfLink = null; + this.tests = null; + } + + private UrlMap( + String creationTimestamp, + String defaultService, + String description, + String fingerprint, + List hostRules, + String id, + String kind, + String name, + List pathMatchers, + String selfLink, + List tests) { + this.creationTimestamp = creationTimestamp; + this.defaultService = defaultService; + this.description = description; + this.fingerprint = fingerprint; + this.hostRules = hostRules; + this.id = id; + this.kind = kind; + this.name = name; + this.pathMatchers = pathMatchers; + this.selfLink = selfLink; + this.tests = tests; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("defaultService")) { + return defaultService; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("fingerprint")) { + return fingerprint; + } + if (fieldName.equals("hostRules")) { + return hostRules; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("pathMatchers")) { + return pathMatchers; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("tests")) { + return tests; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDefaultService() { + return defaultService; + } + + public String getDescription() { + return description; + } + + public String getFingerprint() { + return fingerprint; + } + + public List getHostRulesList() { + return hostRules; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public List getPathMatchersList() { + return pathMatchers; + } + + public String getSelfLink() { + return selfLink; + } + + public List getTestsList() { + return tests; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UrlMap prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UrlMap getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UrlMap DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UrlMap(); + } + + public static class Builder { + private String creationTimestamp; + private String defaultService; + private String description; + private String fingerprint; + private List hostRules; + private String id; + private String kind; + private String name; + private List pathMatchers; + private String selfLink; + private List tests; + + Builder() {} + + public Builder mergeFrom(UrlMap other) { + if (other == UrlMap.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDefaultService() != null) { + this.defaultService = other.defaultService; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getFingerprint() != null) { + this.fingerprint = other.fingerprint; + } + if (other.getHostRulesList() != null) { + this.hostRules = other.hostRules; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPathMatchersList() != null) { + this.pathMatchers = other.pathMatchers; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getTestsList() != null) { + this.tests = other.tests; + } + return this; + } + + Builder(UrlMap source) { + this.creationTimestamp = source.creationTimestamp; + this.defaultService = source.defaultService; + this.description = source.description; + this.fingerprint = source.fingerprint; + this.hostRules = source.hostRules; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.pathMatchers = source.pathMatchers; + this.selfLink = source.selfLink; + this.tests = source.tests; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDefaultService() { + return defaultService; + } + + public Builder setDefaultService(String defaultService) { + this.defaultService = defaultService; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getFingerprint() { + return fingerprint; + } + + public Builder setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public List getHostRulesList() { + return hostRules; + } + + public Builder addAllHostRules(List hostRules) { + if (this.hostRules == null) { + this.hostRules = new ArrayList<>(hostRules.size()); + } + this.hostRules.addAll(hostRules); + return this; + } + + public Builder addHostRules(HostRule hostRules) { + this.hostRules.add(hostRules); + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public List getPathMatchersList() { + return pathMatchers; + } + + public Builder addAllPathMatchers(List pathMatchers) { + if (this.pathMatchers == null) { + this.pathMatchers = new ArrayList<>(pathMatchers.size()); + } + this.pathMatchers.addAll(pathMatchers); + return this; + } + + public Builder addPathMatchers(PathMatcher pathMatchers) { + this.pathMatchers.add(pathMatchers); + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public List getTestsList() { + return tests; + } + + public Builder addAllTests(List tests) { + if (this.tests == null) { + this.tests = new ArrayList<>(tests.size()); + } + this.tests.addAll(tests); + return this; + } + + public Builder addTests(UrlMapTest tests) { + this.tests.add(tests); + return this; + } + + public UrlMap build() { + + return new UrlMap( + creationTimestamp, + defaultService, + description, + fingerprint, + hostRules, + id, + kind, + name, + pathMatchers, + selfLink, + tests); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDefaultService(this.defaultService); + newBuilder.setDescription(this.description); + newBuilder.setFingerprint(this.fingerprint); + newBuilder.addAllHostRules(this.hostRules); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.addAllPathMatchers(this.pathMatchers); + newBuilder.setSelfLink(this.selfLink); + newBuilder.addAllTests(this.tests); + return newBuilder; + } + } + + @Override + public String toString() { + return "UrlMap{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "defaultService=" + + defaultService + + ", " + + "description=" + + description + + ", " + + "fingerprint=" + + fingerprint + + ", " + + "hostRules=" + + hostRules + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "pathMatchers=" + + pathMatchers + + ", " + + "selfLink=" + + selfLink + + ", " + + "tests=" + + tests + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UrlMap) { + UrlMap that = (UrlMap) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.defaultService, that.getDefaultService()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.fingerprint, that.getFingerprint()) + && Objects.equals(this.hostRules, that.getHostRulesList()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.pathMatchers, that.getPathMatchersList()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.tests, that.getTestsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + defaultService, + description, + fingerprint, + hostRules, + id, + kind, + name, + pathMatchers, + selfLink, + tests); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapClient.java new file mode 100644 index 000000000000..01ae9bc7ebfa --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapClient.java @@ -0,0 +1,1155 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.UrlMapStub; +import com.google.cloud.compute.v1.stub.UrlMapStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+ *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+ *   Operation response = urlMapClient.deleteUrlMap(urlMap);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the urlMapClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of UrlMapSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * UrlMapSettings urlMapSettings =
+ *     UrlMapSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * UrlMapClient urlMapClient =
+ *     UrlMapClient.create(urlMapSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * UrlMapSettings urlMapSettings =
+ *     UrlMapSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * UrlMapClient urlMapClient =
+ *     UrlMapClient.create(urlMapSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class UrlMapClient implements BackgroundResource { + private final UrlMapSettings settings; + private final UrlMapStub stub; + + /** Constructs an instance of UrlMapClient with default settings. */ + public static final UrlMapClient create() throws IOException { + return create(UrlMapSettings.newBuilder().build()); + } + + /** + * Constructs an instance of UrlMapClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final UrlMapClient create(UrlMapSettings settings) throws IOException { + return new UrlMapClient(settings); + } + + /** + * Constructs an instance of UrlMapClient, using the given stub for making calls. This is for + * advanced usage - prefer to use UrlMapSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final UrlMapClient create(UrlMapStub stub) { + return new UrlMapClient(stub); + } + + /** + * Constructs an instance of UrlMapClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected UrlMapClient(UrlMapSettings settings) throws IOException { + this.settings = settings; + this.stub = ((UrlMapStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected UrlMapClient(UrlMapStub stub) { + this.settings = null; + this.stub = stub; + } + + public final UrlMapSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public UrlMapStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified UrlMap resource. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   Operation response = urlMapClient.deleteUrlMap(urlMap);
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteUrlMap(ProjectGlobalUrlMapName urlMap) { + + DeleteUrlMapHttpRequest request = + DeleteUrlMapHttpRequest.newBuilder() + .setUrlMap(urlMap == null ? null : urlMap.toString()) + .build(); + return deleteUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified UrlMap resource. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   Operation response = urlMapClient.deleteUrlMap(urlMap.toString());
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteUrlMap(String urlMap) { + + DeleteUrlMapHttpRequest request = + DeleteUrlMapHttpRequest.newBuilder().setUrlMap(urlMap).build(); + return deleteUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified UrlMap resource. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   DeleteUrlMapHttpRequest request = DeleteUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .build();
+   *   Operation response = urlMapClient.deleteUrlMap(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteUrlMap(DeleteUrlMapHttpRequest request) { + return deleteUrlMapCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified UrlMap resource. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   DeleteUrlMapHttpRequest request = DeleteUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = urlMapClient.deleteUrlMapCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteUrlMapCallable() { + return stub.deleteUrlMapCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified UrlMap resource. Gets a list of available URL maps by making a list() + * request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMap response = urlMapClient.getUrlMap(urlMap);
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final UrlMap getUrlMap(ProjectGlobalUrlMapName urlMap) { + + GetUrlMapHttpRequest request = + GetUrlMapHttpRequest.newBuilder() + .setUrlMap(urlMap == null ? null : urlMap.toString()) + .build(); + return getUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified UrlMap resource. Gets a list of available URL maps by making a list() + * request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMap response = urlMapClient.getUrlMap(urlMap.toString());
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final UrlMap getUrlMap(String urlMap) { + + GetUrlMapHttpRequest request = GetUrlMapHttpRequest.newBuilder().setUrlMap(urlMap).build(); + return getUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified UrlMap resource. Gets a list of available URL maps by making a list() + * request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   GetUrlMapHttpRequest request = GetUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .build();
+   *   UrlMap response = urlMapClient.getUrlMap(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final UrlMap getUrlMap(GetUrlMapHttpRequest request) { + return getUrlMapCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified UrlMap resource. Gets a list of available URL maps by making a list() + * request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   GetUrlMapHttpRequest request = GetUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .build();
+   *   ApiFuture<UrlMap> future = urlMapClient.getUrlMapCallable().futureCall(request);
+   *   // Do something
+   *   UrlMap response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getUrlMapCallable() { + return stub.getUrlMapCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a UrlMap resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   Operation response = urlMapClient.insertUrlMap(project, urlMapResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param urlMapResource A UrlMap resource. This resource defines the mapping from URL to the + * BackendService resource, based on the "longest-match" of the URL's host and path. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertUrlMap(ProjectName project, UrlMap urlMapResource) { + + InsertUrlMapHttpRequest request = + InsertUrlMapHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .setUrlMapResource(urlMapResource) + .build(); + return insertUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a UrlMap resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   Operation response = urlMapClient.insertUrlMap(project.toString(), urlMapResource);
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @param urlMapResource A UrlMap resource. This resource defines the mapping from URL to the + * BackendService resource, based on the "longest-match" of the URL's host and path. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertUrlMap(String project, UrlMap urlMapResource) { + + InsertUrlMapHttpRequest request = + InsertUrlMapHttpRequest.newBuilder() + .setProject(project) + .setUrlMapResource(urlMapResource) + .build(); + return insertUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a UrlMap resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   InsertUrlMapHttpRequest request = InsertUrlMapHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setUrlMapResource(urlMapResource)
+   *     .build();
+   *   Operation response = urlMapClient.insertUrlMap(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertUrlMap(InsertUrlMapHttpRequest request) { + return insertUrlMapCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a UrlMap resource in the specified project using the data included in the request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   InsertUrlMapHttpRequest request = InsertUrlMapHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .setUrlMapResource(urlMapResource)
+   *     .build();
+   *   ApiFuture<Operation> future = urlMapClient.insertUrlMapCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertUrlMapCallable() { + return stub.insertUrlMapCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Initiates a cache invalidation operation, invalidating the specified path, scoped to the + * specified UrlMap. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   CacheInvalidationRule cacheInvalidationRuleResource = CacheInvalidationRule.newBuilder().build();
+   *   Operation response = urlMapClient.invalidateCacheUrlMap(urlMap, cacheInvalidationRuleResource);
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap scoping this request. + * @param cacheInvalidationRuleResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation invalidateCacheUrlMap( + ProjectGlobalUrlMapName urlMap, CacheInvalidationRule cacheInvalidationRuleResource) { + + InvalidateCacheUrlMapHttpRequest request = + InvalidateCacheUrlMapHttpRequest.newBuilder() + .setUrlMap(urlMap == null ? null : urlMap.toString()) + .setCacheInvalidationRuleResource(cacheInvalidationRuleResource) + .build(); + return invalidateCacheUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Initiates a cache invalidation operation, invalidating the specified path, scoped to the + * specified UrlMap. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   CacheInvalidationRule cacheInvalidationRuleResource = CacheInvalidationRule.newBuilder().build();
+   *   Operation response = urlMapClient.invalidateCacheUrlMap(urlMap.toString(), cacheInvalidationRuleResource);
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap scoping this request. + * @param cacheInvalidationRuleResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation invalidateCacheUrlMap( + String urlMap, CacheInvalidationRule cacheInvalidationRuleResource) { + + InvalidateCacheUrlMapHttpRequest request = + InvalidateCacheUrlMapHttpRequest.newBuilder() + .setUrlMap(urlMap) + .setCacheInvalidationRuleResource(cacheInvalidationRuleResource) + .build(); + return invalidateCacheUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Initiates a cache invalidation operation, invalidating the specified path, scoped to the + * specified UrlMap. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   CacheInvalidationRule cacheInvalidationRuleResource = CacheInvalidationRule.newBuilder().build();
+   *   InvalidateCacheUrlMapHttpRequest request = InvalidateCacheUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .setCacheInvalidationRuleResource(cacheInvalidationRuleResource)
+   *     .build();
+   *   Operation response = urlMapClient.invalidateCacheUrlMap(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation invalidateCacheUrlMap(InvalidateCacheUrlMapHttpRequest request) { + return invalidateCacheUrlMapCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Initiates a cache invalidation operation, invalidating the specified path, scoped to the + * specified UrlMap. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   CacheInvalidationRule cacheInvalidationRuleResource = CacheInvalidationRule.newBuilder().build();
+   *   InvalidateCacheUrlMapHttpRequest request = InvalidateCacheUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .setCacheInvalidationRuleResource(cacheInvalidationRuleResource)
+   *     .build();
+   *   ApiFuture<Operation> future = urlMapClient.invalidateCacheUrlMapCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + invalidateCacheUrlMapCallable() { + return stub.invalidateCacheUrlMapCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of UrlMap resources available to the specified project. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (UrlMap element : urlMapClient.listUrlMaps(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListUrlMapsPagedResponse listUrlMaps(ProjectName project) { + ListUrlMapsHttpRequest request = + ListUrlMapsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listUrlMaps(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of UrlMap resources available to the specified project. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (UrlMap element : urlMapClient.listUrlMaps(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListUrlMapsPagedResponse listUrlMaps(String project) { + ListUrlMapsHttpRequest request = + ListUrlMapsHttpRequest.newBuilder().setProject(project).build(); + return listUrlMaps(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of UrlMap resources available to the specified project. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListUrlMapsHttpRequest request = ListUrlMapsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (UrlMap element : urlMapClient.listUrlMaps(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListUrlMapsPagedResponse listUrlMaps(ListUrlMapsHttpRequest request) { + return listUrlMapsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of UrlMap resources available to the specified project. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListUrlMapsHttpRequest request = ListUrlMapsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListUrlMapsPagedResponse> future = urlMapClient.listUrlMapsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (UrlMap element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listUrlMapsPagedCallable() { + return stub.listUrlMapsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of UrlMap resources available to the specified project. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListUrlMapsHttpRequest request = ListUrlMapsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     UrlMapList response = urlMapClient.listUrlMapsCallable().call(request);
+   *     for (UrlMap element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listUrlMapsCallable() { + return stub.listUrlMapsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified UrlMap resource with the data included in the request. This method + * supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   Operation response = urlMapClient.patchUrlMap(urlMap, urlMapResource);
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap resource to patch. + * @param urlMapResource A UrlMap resource. This resource defines the mapping from URL to the + * BackendService resource, based on the "longest-match" of the URL's host and path. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchUrlMap(ProjectGlobalUrlMapName urlMap, UrlMap urlMapResource) { + + PatchUrlMapHttpRequest request = + PatchUrlMapHttpRequest.newBuilder() + .setUrlMap(urlMap == null ? null : urlMap.toString()) + .setUrlMapResource(urlMapResource) + .build(); + return patchUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified UrlMap resource with the data included in the request. This method + * supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   Operation response = urlMapClient.patchUrlMap(urlMap.toString(), urlMapResource);
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap resource to patch. + * @param urlMapResource A UrlMap resource. This resource defines the mapping from URL to the + * BackendService resource, based on the "longest-match" of the URL's host and path. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchUrlMap(String urlMap, UrlMap urlMapResource) { + + PatchUrlMapHttpRequest request = + PatchUrlMapHttpRequest.newBuilder() + .setUrlMap(urlMap) + .setUrlMapResource(urlMapResource) + .build(); + return patchUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified UrlMap resource with the data included in the request. This method + * supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   PatchUrlMapHttpRequest request = PatchUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .setUrlMapResource(urlMapResource)
+   *     .build();
+   *   Operation response = urlMapClient.patchUrlMap(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation patchUrlMap(PatchUrlMapHttpRequest request) { + return patchUrlMapCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Patches the specified UrlMap resource with the data included in the request. This method + * supports PATCH semantics and uses the JSON merge patch format and processing rules. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   PatchUrlMapHttpRequest request = PatchUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .setUrlMapResource(urlMapResource)
+   *     .build();
+   *   ApiFuture<Operation> future = urlMapClient.patchUrlMapCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable patchUrlMapCallable() { + return stub.patchUrlMapCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified UrlMap resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   Operation response = urlMapClient.updateUrlMap(urlMap, urlMapResource);
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap resource to update. + * @param urlMapResource A UrlMap resource. This resource defines the mapping from URL to the + * BackendService resource, based on the "longest-match" of the URL's host and path. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateUrlMap(ProjectGlobalUrlMapName urlMap, UrlMap urlMapResource) { + + UpdateUrlMapHttpRequest request = + UpdateUrlMapHttpRequest.newBuilder() + .setUrlMap(urlMap == null ? null : urlMap.toString()) + .setUrlMapResource(urlMapResource) + .build(); + return updateUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified UrlMap resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   Operation response = urlMapClient.updateUrlMap(urlMap.toString(), urlMapResource);
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap resource to update. + * @param urlMapResource A UrlMap resource. This resource defines the mapping from URL to the + * BackendService resource, based on the "longest-match" of the URL's host and path. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateUrlMap(String urlMap, UrlMap urlMapResource) { + + UpdateUrlMapHttpRequest request = + UpdateUrlMapHttpRequest.newBuilder() + .setUrlMap(urlMap) + .setUrlMapResource(urlMapResource) + .build(); + return updateUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified UrlMap resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   UpdateUrlMapHttpRequest request = UpdateUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .setUrlMapResource(urlMapResource)
+   *     .build();
+   *   Operation response = urlMapClient.updateUrlMap(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation updateUrlMap(UpdateUrlMapHttpRequest request) { + return updateUrlMapCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified UrlMap resource with the data included in the request. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMap urlMapResource = UrlMap.newBuilder().build();
+   *   UpdateUrlMapHttpRequest request = UpdateUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .setUrlMapResource(urlMapResource)
+   *     .build();
+   *   ApiFuture<Operation> future = urlMapClient.updateUrlMapCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable updateUrlMapCallable() { + return stub.updateUrlMapCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be + * run. Calling this method does NOT create the UrlMap. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMapsValidateRequest urlMapsValidateRequestResource = UrlMapsValidateRequest.newBuilder().build();
+   *   UrlMapsValidateResponse response = urlMapClient.validateUrlMap(urlMap, urlMapsValidateRequestResource);
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap resource to be validated as. + * @param urlMapsValidateRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final UrlMapsValidateResponse validateUrlMap( + ProjectGlobalUrlMapName urlMap, UrlMapsValidateRequest urlMapsValidateRequestResource) { + + ValidateUrlMapHttpRequest request = + ValidateUrlMapHttpRequest.newBuilder() + .setUrlMap(urlMap == null ? null : urlMap.toString()) + .setUrlMapsValidateRequestResource(urlMapsValidateRequestResource) + .build(); + return validateUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be + * run. Calling this method does NOT create the UrlMap. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMapsValidateRequest urlMapsValidateRequestResource = UrlMapsValidateRequest.newBuilder().build();
+   *   UrlMapsValidateResponse response = urlMapClient.validateUrlMap(urlMap.toString(), urlMapsValidateRequestResource);
+   * }
+   * 
+ * + * @param urlMap Name of the UrlMap resource to be validated as. + * @param urlMapsValidateRequestResource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final UrlMapsValidateResponse validateUrlMap( + String urlMap, UrlMapsValidateRequest urlMapsValidateRequestResource) { + + ValidateUrlMapHttpRequest request = + ValidateUrlMapHttpRequest.newBuilder() + .setUrlMap(urlMap) + .setUrlMapsValidateRequestResource(urlMapsValidateRequestResource) + .build(); + return validateUrlMap(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be + * run. Calling this method does NOT create the UrlMap. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMapsValidateRequest urlMapsValidateRequestResource = UrlMapsValidateRequest.newBuilder().build();
+   *   ValidateUrlMapHttpRequest request = ValidateUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .setUrlMapsValidateRequestResource(urlMapsValidateRequestResource)
+   *     .build();
+   *   UrlMapsValidateResponse response = urlMapClient.validateUrlMap(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final UrlMapsValidateResponse validateUrlMap(ValidateUrlMapHttpRequest request) { + return validateUrlMapCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be + * run. Calling this method does NOT create the UrlMap. + * + *

Sample code: + * + *


+   * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+   *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+   *   UrlMapsValidateRequest urlMapsValidateRequestResource = UrlMapsValidateRequest.newBuilder().build();
+   *   ValidateUrlMapHttpRequest request = ValidateUrlMapHttpRequest.newBuilder()
+   *     .setUrlMap(urlMap.toString())
+   *     .setUrlMapsValidateRequestResource(urlMapsValidateRequestResource)
+   *     .build();
+   *   ApiFuture<UrlMapsValidateResponse> future = urlMapClient.validateUrlMapCallable().futureCall(request);
+   *   // Do something
+   *   UrlMapsValidateResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + validateUrlMapCallable() { + return stub.validateUrlMapCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListUrlMapsPagedResponse + extends AbstractPagedListResponse< + ListUrlMapsHttpRequest, UrlMapList, UrlMap, ListUrlMapsPage, + ListUrlMapsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListUrlMapsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListUrlMapsPagedResponse apply(ListUrlMapsPage input) { + return new ListUrlMapsPagedResponse(input); + } + }); + } + + private ListUrlMapsPagedResponse(ListUrlMapsPage page) { + super(page, ListUrlMapsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListUrlMapsPage + extends AbstractPage { + + private ListUrlMapsPage( + PageContext context, UrlMapList response) { + super(context, response); + } + + private static ListUrlMapsPage createEmptyPage() { + return new ListUrlMapsPage(null, null); + } + + @Override + protected ListUrlMapsPage createPage( + PageContext context, UrlMapList response) { + return new ListUrlMapsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListUrlMapsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListUrlMapsHttpRequest, UrlMapList, UrlMap, ListUrlMapsPage, + ListUrlMapsFixedSizeCollection> { + + private ListUrlMapsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListUrlMapsFixedSizeCollection createEmptyCollection() { + return new ListUrlMapsFixedSizeCollection(null, 0); + } + + @Override + protected ListUrlMapsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListUrlMapsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapList.java new file mode 100644 index 000000000000..01de00a6b4b7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UrlMapList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private UrlMapList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private UrlMapList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UrlMapList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UrlMapList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UrlMapList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UrlMapList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(UrlMapList other) { + if (other == UrlMapList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(UrlMapList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(UrlMap items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public UrlMapList build() { + + return new UrlMapList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "UrlMapList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UrlMapList) { + UrlMapList that = (UrlMapList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapReference.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapReference.java new file mode 100644 index 000000000000..eedff2c1705e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapReference.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UrlMapReference implements ApiMessage { + private final String urlMap; + + private UrlMapReference() { + this.urlMap = null; + } + + private UrlMapReference(String urlMap) { + this.urlMap = urlMap; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("urlMap")) { + return urlMap; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getUrlMap() { + return urlMap; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UrlMapReference prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UrlMapReference getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UrlMapReference DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UrlMapReference(); + } + + public static class Builder { + private String urlMap; + + Builder() {} + + public Builder mergeFrom(UrlMapReference other) { + if (other == UrlMapReference.getDefaultInstance()) return this; + if (other.getUrlMap() != null) { + this.urlMap = other.urlMap; + } + return this; + } + + Builder(UrlMapReference source) { + this.urlMap = source.urlMap; + } + + public String getUrlMap() { + return urlMap; + } + + public Builder setUrlMap(String urlMap) { + this.urlMap = urlMap; + return this; + } + + public UrlMapReference build() { + return new UrlMapReference(urlMap); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setUrlMap(this.urlMap); + return newBuilder; + } + } + + @Override + public String toString() { + return "UrlMapReference{" + "urlMap=" + urlMap + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UrlMapReference) { + UrlMapReference that = (UrlMapReference) o; + return Objects.equals(this.urlMap, that.getUrlMap()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(urlMap); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapSettings.java new file mode 100644 index 000000000000..3c89299d6d9d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapSettings.java @@ -0,0 +1,258 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.UrlMapClient.ListUrlMapsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.UrlMapStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link UrlMapClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteUrlMap to 30 seconds: + * + *

+ * 
+ * UrlMapSettings.Builder urlMapSettingsBuilder =
+ *     UrlMapSettings.newBuilder();
+ * urlMapSettingsBuilder.deleteUrlMapSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * UrlMapSettings urlMapSettings = urlMapSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class UrlMapSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteUrlMap. */ + public UnaryCallSettings deleteUrlMapSettings() { + return ((UrlMapStubSettings) getStubSettings()).deleteUrlMapSettings(); + } + + /** Returns the object with the settings used for calls to getUrlMap. */ + public UnaryCallSettings getUrlMapSettings() { + return ((UrlMapStubSettings) getStubSettings()).getUrlMapSettings(); + } + + /** Returns the object with the settings used for calls to insertUrlMap. */ + public UnaryCallSettings insertUrlMapSettings() { + return ((UrlMapStubSettings) getStubSettings()).insertUrlMapSettings(); + } + + /** Returns the object with the settings used for calls to invalidateCacheUrlMap. */ + public UnaryCallSettings + invalidateCacheUrlMapSettings() { + return ((UrlMapStubSettings) getStubSettings()).invalidateCacheUrlMapSettings(); + } + + /** Returns the object with the settings used for calls to listUrlMaps. */ + public PagedCallSettings + listUrlMapsSettings() { + return ((UrlMapStubSettings) getStubSettings()).listUrlMapsSettings(); + } + + /** Returns the object with the settings used for calls to patchUrlMap. */ + public UnaryCallSettings patchUrlMapSettings() { + return ((UrlMapStubSettings) getStubSettings()).patchUrlMapSettings(); + } + + /** Returns the object with the settings used for calls to updateUrlMap. */ + public UnaryCallSettings updateUrlMapSettings() { + return ((UrlMapStubSettings) getStubSettings()).updateUrlMapSettings(); + } + + /** Returns the object with the settings used for calls to validateUrlMap. */ + public UnaryCallSettings + validateUrlMapSettings() { + return ((UrlMapStubSettings) getStubSettings()).validateUrlMapSettings(); + } + + public static final UrlMapSettings create(UrlMapStubSettings stub) throws IOException { + return new UrlMapSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return UrlMapStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return UrlMapStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return UrlMapStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return UrlMapStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return UrlMapStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return UrlMapStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return UrlMapStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return UrlMapStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected UrlMapSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for UrlMapSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(UrlMapStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(UrlMapStubSettings.newBuilder()); + } + + protected Builder(UrlMapSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(UrlMapStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public UrlMapStubSettings.Builder getStubSettingsBuilder() { + return ((UrlMapStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteUrlMap. */ + public UnaryCallSettings.Builder deleteUrlMapSettings() { + return getStubSettingsBuilder().deleteUrlMapSettings(); + } + + /** Returns the builder for the settings used for calls to getUrlMap. */ + public UnaryCallSettings.Builder getUrlMapSettings() { + return getStubSettingsBuilder().getUrlMapSettings(); + } + + /** Returns the builder for the settings used for calls to insertUrlMap. */ + public UnaryCallSettings.Builder insertUrlMapSettings() { + return getStubSettingsBuilder().insertUrlMapSettings(); + } + + /** Returns the builder for the settings used for calls to invalidateCacheUrlMap. */ + public UnaryCallSettings.Builder + invalidateCacheUrlMapSettings() { + return getStubSettingsBuilder().invalidateCacheUrlMapSettings(); + } + + /** Returns the builder for the settings used for calls to listUrlMaps. */ + public PagedCallSettings.Builder + listUrlMapsSettings() { + return getStubSettingsBuilder().listUrlMapsSettings(); + } + + /** Returns the builder for the settings used for calls to patchUrlMap. */ + public UnaryCallSettings.Builder patchUrlMapSettings() { + return getStubSettingsBuilder().patchUrlMapSettings(); + } + + /** Returns the builder for the settings used for calls to updateUrlMap. */ + public UnaryCallSettings.Builder updateUrlMapSettings() { + return getStubSettingsBuilder().updateUrlMapSettings(); + } + + /** Returns the builder for the settings used for calls to validateUrlMap. */ + public UnaryCallSettings.Builder + validateUrlMapSettings() { + return getStubSettingsBuilder().validateUrlMapSettings(); + } + + @Override + public UrlMapSettings build() throws IOException { + return new UrlMapSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapTest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapTest.java new file mode 100644 index 000000000000..3807f0fcc592 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapTest.java @@ -0,0 +1,233 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UrlMapTest implements ApiMessage { + private final String description; + private final String host; + private final String path; + private final String service; + + private UrlMapTest() { + this.description = null; + this.host = null; + this.path = null; + this.service = null; + } + + private UrlMapTest(String description, String host, String path, String service) { + this.description = description; + this.host = host; + this.path = path; + this.service = service; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("host")) { + return host; + } + if (fieldName.equals("path")) { + return path; + } + if (fieldName.equals("service")) { + return service; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getDescription() { + return description; + } + + public String getHost() { + return host; + } + + public String getPath() { + return path; + } + + public String getService() { + return service; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UrlMapTest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UrlMapTest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UrlMapTest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UrlMapTest(); + } + + public static class Builder { + private String description; + private String host; + private String path; + private String service; + + Builder() {} + + public Builder mergeFrom(UrlMapTest other) { + if (other == UrlMapTest.getDefaultInstance()) return this; + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getHost() != null) { + this.host = other.host; + } + if (other.getPath() != null) { + this.path = other.path; + } + if (other.getService() != null) { + this.service = other.service; + } + return this; + } + + Builder(UrlMapTest source) { + this.description = source.description; + this.host = source.host; + this.path = source.path; + this.service = source.service; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getHost() { + return host; + } + + public Builder setHost(String host) { + this.host = host; + return this; + } + + public String getPath() { + return path; + } + + public Builder setPath(String path) { + this.path = path; + return this; + } + + public String getService() { + return service; + } + + public Builder setService(String service) { + this.service = service; + return this; + } + + public UrlMapTest build() { + + return new UrlMapTest(description, host, path, service); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setDescription(this.description); + newBuilder.setHost(this.host); + newBuilder.setPath(this.path); + newBuilder.setService(this.service); + return newBuilder; + } + } + + @Override + public String toString() { + return "UrlMapTest{" + + "description=" + + description + + ", " + + "host=" + + host + + ", " + + "path=" + + path + + ", " + + "service=" + + service + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UrlMapTest) { + UrlMapTest that = (UrlMapTest) o; + return Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.host, that.getHost()) + && Objects.equals(this.path, that.getPath()) + && Objects.equals(this.service, that.getService()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(description, host, path, service); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapValidationResult.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapValidationResult.java new file mode 100644 index 000000000000..57a9eef7757b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapValidationResult.java @@ -0,0 +1,254 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UrlMapValidationResult implements ApiMessage { + private final List loadErrors; + private final Boolean loadSucceeded; + private final List testFailures; + private final Boolean testPassed; + + private UrlMapValidationResult() { + this.loadErrors = null; + this.loadSucceeded = null; + this.testFailures = null; + this.testPassed = null; + } + + private UrlMapValidationResult( + List loadErrors, + Boolean loadSucceeded, + List testFailures, + Boolean testPassed) { + this.loadErrors = loadErrors; + this.loadSucceeded = loadSucceeded; + this.testFailures = testFailures; + this.testPassed = testPassed; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("loadErrors")) { + return loadErrors; + } + if (fieldName.equals("loadSucceeded")) { + return loadSucceeded; + } + if (fieldName.equals("testFailures")) { + return testFailures; + } + if (fieldName.equals("testPassed")) { + return testPassed; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getLoadErrorsList() { + return loadErrors; + } + + public Boolean getLoadSucceeded() { + return loadSucceeded; + } + + public List getTestFailuresList() { + return testFailures; + } + + public Boolean getTestPassed() { + return testPassed; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UrlMapValidationResult prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UrlMapValidationResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UrlMapValidationResult DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UrlMapValidationResult(); + } + + public static class Builder { + private List loadErrors; + private Boolean loadSucceeded; + private List testFailures; + private Boolean testPassed; + + Builder() {} + + public Builder mergeFrom(UrlMapValidationResult other) { + if (other == UrlMapValidationResult.getDefaultInstance()) return this; + if (other.getLoadErrorsList() != null) { + this.loadErrors = other.loadErrors; + } + if (other.getLoadSucceeded() != null) { + this.loadSucceeded = other.loadSucceeded; + } + if (other.getTestFailuresList() != null) { + this.testFailures = other.testFailures; + } + if (other.getTestPassed() != null) { + this.testPassed = other.testPassed; + } + return this; + } + + Builder(UrlMapValidationResult source) { + this.loadErrors = source.loadErrors; + this.loadSucceeded = source.loadSucceeded; + this.testFailures = source.testFailures; + this.testPassed = source.testPassed; + } + + public List getLoadErrorsList() { + return loadErrors; + } + + public Builder addAllLoadErrors(List loadErrors) { + if (this.loadErrors == null) { + this.loadErrors = new ArrayList<>(loadErrors.size()); + } + this.loadErrors.addAll(loadErrors); + return this; + } + + public Builder addLoadErrors(String loadErrors) { + this.loadErrors.add(loadErrors); + return this; + } + + public Boolean getLoadSucceeded() { + return loadSucceeded; + } + + public Builder setLoadSucceeded(Boolean loadSucceeded) { + this.loadSucceeded = loadSucceeded; + return this; + } + + public List getTestFailuresList() { + return testFailures; + } + + public Builder addAllTestFailures(List testFailures) { + if (this.testFailures == null) { + this.testFailures = new ArrayList<>(testFailures.size()); + } + this.testFailures.addAll(testFailures); + return this; + } + + public Builder addTestFailures(TestFailure testFailures) { + this.testFailures.add(testFailures); + return this; + } + + public Boolean getTestPassed() { + return testPassed; + } + + public Builder setTestPassed(Boolean testPassed) { + this.testPassed = testPassed; + return this; + } + + public UrlMapValidationResult build() { + + return new UrlMapValidationResult(loadErrors, loadSucceeded, testFailures, testPassed); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllLoadErrors(this.loadErrors); + newBuilder.setLoadSucceeded(this.loadSucceeded); + newBuilder.addAllTestFailures(this.testFailures); + newBuilder.setTestPassed(this.testPassed); + return newBuilder; + } + } + + @Override + public String toString() { + return "UrlMapValidationResult{" + + "loadErrors=" + + loadErrors + + ", " + + "loadSucceeded=" + + loadSucceeded + + ", " + + "testFailures=" + + testFailures + + ", " + + "testPassed=" + + testPassed + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UrlMapValidationResult) { + UrlMapValidationResult that = (UrlMapValidationResult) o; + return Objects.equals(this.loadErrors, that.getLoadErrorsList()) + && Objects.equals(this.loadSucceeded, that.getLoadSucceeded()) + && Objects.equals(this.testFailures, that.getTestFailuresList()) + && Objects.equals(this.testPassed, that.getTestPassed()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(loadErrors, loadSucceeded, testFailures, testPassed); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapsValidateRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapsValidateRequest.java new file mode 100644 index 000000000000..b966c622365a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapsValidateRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UrlMapsValidateRequest implements ApiMessage { + private final UrlMap resource; + + private UrlMapsValidateRequest() { + this.resource = null; + } + + private UrlMapsValidateRequest(UrlMap resource) { + this.resource = resource; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("resource")) { + return resource; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public UrlMap getResource() { + return resource; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UrlMapsValidateRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UrlMapsValidateRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UrlMapsValidateRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UrlMapsValidateRequest(); + } + + public static class Builder { + private UrlMap resource; + + Builder() {} + + public Builder mergeFrom(UrlMapsValidateRequest other) { + if (other == UrlMapsValidateRequest.getDefaultInstance()) return this; + if (other.getResource() != null) { + this.resource = other.resource; + } + return this; + } + + Builder(UrlMapsValidateRequest source) { + this.resource = source.resource; + } + + public UrlMap getResource() { + return resource; + } + + public Builder setResource(UrlMap resource) { + this.resource = resource; + return this; + } + + public UrlMapsValidateRequest build() { + return new UrlMapsValidateRequest(resource); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setResource(this.resource); + return newBuilder; + } + } + + @Override + public String toString() { + return "UrlMapsValidateRequest{" + "resource=" + resource + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UrlMapsValidateRequest) { + UrlMapsValidateRequest that = (UrlMapsValidateRequest) o; + return Objects.equals(this.resource, that.getResource()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(resource); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapsValidateResponse.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapsValidateResponse.java new file mode 100644 index 000000000000..5ea9b6d68757 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UrlMapsValidateResponse.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UrlMapsValidateResponse implements ApiMessage { + private final UrlMapValidationResult result; + + private UrlMapsValidateResponse() { + this.result = null; + } + + private UrlMapsValidateResponse(UrlMapValidationResult result) { + this.result = result; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("result")) { + return result; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public UrlMapValidationResult getResult() { + return result; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UrlMapsValidateResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UrlMapsValidateResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UrlMapsValidateResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UrlMapsValidateResponse(); + } + + public static class Builder { + private UrlMapValidationResult result; + + Builder() {} + + public Builder mergeFrom(UrlMapsValidateResponse other) { + if (other == UrlMapsValidateResponse.getDefaultInstance()) return this; + if (other.getResult() != null) { + this.result = other.result; + } + return this; + } + + Builder(UrlMapsValidateResponse source) { + this.result = source.result; + } + + public UrlMapValidationResult getResult() { + return result; + } + + public Builder setResult(UrlMapValidationResult result) { + this.result = result; + return this; + } + + public UrlMapsValidateResponse build() { + return new UrlMapsValidateResponse(result); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setResult(this.result); + return newBuilder; + } + } + + @Override + public String toString() { + return "UrlMapsValidateResponse{" + "result=" + result + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UrlMapsValidateResponse) { + UrlMapsValidateResponse that = (UrlMapsValidateResponse) o; + return Objects.equals(this.result, that.getResult()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(result); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UsageExportLocation.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UsageExportLocation.java new file mode 100644 index 000000000000..bc102b38b4a5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UsageExportLocation.java @@ -0,0 +1,175 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class UsageExportLocation implements ApiMessage { + private final String bucketName; + private final String reportNamePrefix; + + private UsageExportLocation() { + this.bucketName = null; + this.reportNamePrefix = null; + } + + private UsageExportLocation(String bucketName, String reportNamePrefix) { + this.bucketName = bucketName; + this.reportNamePrefix = reportNamePrefix; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("bucketName")) { + return bucketName; + } + if (fieldName.equals("reportNamePrefix")) { + return reportNamePrefix; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getBucketName() { + return bucketName; + } + + public String getReportNamePrefix() { + return reportNamePrefix; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(UsageExportLocation prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static UsageExportLocation getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final UsageExportLocation DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new UsageExportLocation(); + } + + public static class Builder { + private String bucketName; + private String reportNamePrefix; + + Builder() {} + + public Builder mergeFrom(UsageExportLocation other) { + if (other == UsageExportLocation.getDefaultInstance()) return this; + if (other.getBucketName() != null) { + this.bucketName = other.bucketName; + } + if (other.getReportNamePrefix() != null) { + this.reportNamePrefix = other.reportNamePrefix; + } + return this; + } + + Builder(UsageExportLocation source) { + this.bucketName = source.bucketName; + this.reportNamePrefix = source.reportNamePrefix; + } + + public String getBucketName() { + return bucketName; + } + + public Builder setBucketName(String bucketName) { + this.bucketName = bucketName; + return this; + } + + public String getReportNamePrefix() { + return reportNamePrefix; + } + + public Builder setReportNamePrefix(String reportNamePrefix) { + this.reportNamePrefix = reportNamePrefix; + return this; + } + + public UsageExportLocation build() { + + return new UsageExportLocation(bucketName, reportNamePrefix); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setBucketName(this.bucketName); + newBuilder.setReportNamePrefix(this.reportNamePrefix); + return newBuilder; + } + } + + @Override + public String toString() { + return "UsageExportLocation{" + + "bucketName=" + + bucketName + + ", " + + "reportNamePrefix=" + + reportNamePrefix + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UsageExportLocation) { + UsageExportLocation that = (UsageExportLocation) o; + return Objects.equals(this.bucketName, that.getBucketName()) + && Objects.equals(this.reportNamePrefix, that.getReportNamePrefix()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(bucketName, reportNamePrefix); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ValidateUrlMapHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ValidateUrlMapHttpRequest.java new file mode 100644 index 000000000000..1e5b6f4c84f4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ValidateUrlMapHttpRequest.java @@ -0,0 +1,415 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ValidateUrlMapHttpRequest implements ApiMessage { + private final String access_token; + private final String callback; + private final String fields; + private final String key; + private final String prettyPrint; + private final String quotaUser; + private final String urlMap; + private final UrlMapsValidateRequest urlMapsValidateRequestResource; + private final String userIp; + + private ValidateUrlMapHttpRequest() { + this.access_token = null; + this.callback = null; + this.fields = null; + this.key = null; + this.prettyPrint = null; + this.quotaUser = null; + this.urlMap = null; + this.urlMapsValidateRequestResource = null; + this.userIp = null; + } + + private ValidateUrlMapHttpRequest( + String access_token, + String callback, + String fields, + String key, + String prettyPrint, + String quotaUser, + String urlMap, + UrlMapsValidateRequest urlMapsValidateRequestResource, + String userIp) { + this.access_token = access_token; + this.callback = callback; + this.fields = fields; + this.key = key; + this.prettyPrint = prettyPrint; + this.quotaUser = quotaUser; + this.urlMap = urlMap; + this.urlMapsValidateRequestResource = urlMapsValidateRequestResource; + this.userIp = userIp; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("access_token")) { + return access_token; + } + if (fieldName.equals("callback")) { + return callback; + } + if (fieldName.equals("fields")) { + return fields; + } + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("prettyPrint")) { + return prettyPrint; + } + if (fieldName.equals("quotaUser")) { + return quotaUser; + } + if (fieldName.equals("urlMap")) { + return urlMap; + } + if (fieldName.equals("urlMapsValidateRequestResource")) { + return urlMapsValidateRequestResource; + } + if (fieldName.equals("userIp")) { + return userIp; + } + return null; + } + + @Nullable + @Override + public UrlMapsValidateRequest getApiMessageRequestBody() { + return urlMapsValidateRequestResource; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getAccessToken() { + return access_token; + } + + public String getCallback() { + return callback; + } + + public String getFields() { + return fields; + } + + public String getKey() { + return key; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public String getQuotaUser() { + return quotaUser; + } + + public String getUrlMap() { + return urlMap; + } + + public UrlMapsValidateRequest getUrlMapsValidateRequestResource() { + return urlMapsValidateRequestResource; + } + + public String getUserIp() { + return userIp; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ValidateUrlMapHttpRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ValidateUrlMapHttpRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ValidateUrlMapHttpRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ValidateUrlMapHttpRequest(); + } + + public static class Builder { + private String access_token; + private String callback; + private String fields; + private String key; + private String prettyPrint; + private String quotaUser; + private String urlMap; + private UrlMapsValidateRequest urlMapsValidateRequestResource; + private String userIp; + + Builder() {} + + public Builder mergeFrom(ValidateUrlMapHttpRequest other) { + if (other == ValidateUrlMapHttpRequest.getDefaultInstance()) return this; + if (other.getAccessToken() != null) { + this.access_token = other.access_token; + } + if (other.getCallback() != null) { + this.callback = other.callback; + } + if (other.getFields() != null) { + this.fields = other.fields; + } + if (other.getKey() != null) { + this.key = other.key; + } + if (other.getPrettyPrint() != null) { + this.prettyPrint = other.prettyPrint; + } + if (other.getQuotaUser() != null) { + this.quotaUser = other.quotaUser; + } + if (other.getUrlMap() != null) { + this.urlMap = other.urlMap; + } + if (other.getUrlMapsValidateRequestResource() != null) { + this.urlMapsValidateRequestResource = other.urlMapsValidateRequestResource; + } + if (other.getUserIp() != null) { + this.userIp = other.userIp; + } + return this; + } + + Builder(ValidateUrlMapHttpRequest source) { + this.access_token = source.access_token; + this.callback = source.callback; + this.fields = source.fields; + this.key = source.key; + this.prettyPrint = source.prettyPrint; + this.quotaUser = source.quotaUser; + this.urlMap = source.urlMap; + this.urlMapsValidateRequestResource = source.urlMapsValidateRequestResource; + this.userIp = source.userIp; + } + + public String getAccessToken() { + return access_token; + } + + public Builder setAccessToken(String access_token) { + this.access_token = access_token; + return this; + } + + public String getCallback() { + return callback; + } + + public Builder setCallback(String callback) { + this.callback = callback; + return this; + } + + public String getFields() { + return fields; + } + + public Builder setFields(String fields) { + this.fields = fields; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public String getPrettyPrint() { + return prettyPrint; + } + + public Builder setPrettyPrint(String prettyPrint) { + this.prettyPrint = prettyPrint; + return this; + } + + public String getQuotaUser() { + return quotaUser; + } + + public Builder setQuotaUser(String quotaUser) { + this.quotaUser = quotaUser; + return this; + } + + public String getUrlMap() { + return urlMap; + } + + public Builder setUrlMap(String urlMap) { + this.urlMap = urlMap; + return this; + } + + public UrlMapsValidateRequest getUrlMapsValidateRequestResource() { + return urlMapsValidateRequestResource; + } + + public Builder setUrlMapsValidateRequestResource( + UrlMapsValidateRequest urlMapsValidateRequestResource) { + this.urlMapsValidateRequestResource = urlMapsValidateRequestResource; + return this; + } + + public String getUserIp() { + return userIp; + } + + public Builder setUserIp(String userIp) { + this.userIp = userIp; + return this; + } + + public ValidateUrlMapHttpRequest build() { + String missing = ""; + + if (urlMap == null) { + missing += " urlMap"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + return new ValidateUrlMapHttpRequest( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + urlMap, + urlMapsValidateRequestResource, + userIp); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAccessToken(this.access_token); + newBuilder.setCallback(this.callback); + newBuilder.setFields(this.fields); + newBuilder.setKey(this.key); + newBuilder.setPrettyPrint(this.prettyPrint); + newBuilder.setQuotaUser(this.quotaUser); + newBuilder.setUrlMap(this.urlMap); + newBuilder.setUrlMapsValidateRequestResource(this.urlMapsValidateRequestResource); + newBuilder.setUserIp(this.userIp); + return newBuilder; + } + } + + @Override + public String toString() { + return "ValidateUrlMapHttpRequest{" + + "access_token=" + + access_token + + ", " + + "callback=" + + callback + + ", " + + "fields=" + + fields + + ", " + + "key=" + + key + + ", " + + "prettyPrint=" + + prettyPrint + + ", " + + "quotaUser=" + + quotaUser + + ", " + + "urlMap=" + + urlMap + + ", " + + "urlMapsValidateRequestResource=" + + urlMapsValidateRequestResource + + ", " + + "userIp=" + + userIp + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ValidateUrlMapHttpRequest) { + ValidateUrlMapHttpRequest that = (ValidateUrlMapHttpRequest) o; + return Objects.equals(this.access_token, that.getAccessToken()) + && Objects.equals(this.callback, that.getCallback()) + && Objects.equals(this.fields, that.getFields()) + && Objects.equals(this.key, that.getKey()) + && Objects.equals(this.prettyPrint, that.getPrettyPrint()) + && Objects.equals(this.quotaUser, that.getQuotaUser()) + && Objects.equals(this.urlMap, that.getUrlMap()) + && Objects.equals( + this.urlMapsValidateRequestResource, that.getUrlMapsValidateRequestResource()) + && Objects.equals(this.userIp, that.getUserIp()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + access_token, + callback, + fields, + key, + prettyPrint, + quotaUser, + urlMap, + urlMapsValidateRequestResource, + userIp); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnel.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnel.java new file mode 100644 index 000000000000..b363aa3aa3d5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnel.java @@ -0,0 +1,678 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class VpnTunnel implements ApiMessage { + private final String creationTimestamp; + private final String description; + private final String detailedStatus; + private final String id; + private final Integer ikeVersion; + private final String kind; + private final List localTrafficSelector; + private final String name; + private final String peerIp; + private final String region; + private final List remoteTrafficSelector; + private final String router; + private final String selfLink; + private final String sharedSecret; + private final String sharedSecretHash; + private final String status; + private final String targetVpnGateway; + + private VpnTunnel() { + this.creationTimestamp = null; + this.description = null; + this.detailedStatus = null; + this.id = null; + this.ikeVersion = null; + this.kind = null; + this.localTrafficSelector = null; + this.name = null; + this.peerIp = null; + this.region = null; + this.remoteTrafficSelector = null; + this.router = null; + this.selfLink = null; + this.sharedSecret = null; + this.sharedSecretHash = null; + this.status = null; + this.targetVpnGateway = null; + } + + private VpnTunnel( + String creationTimestamp, + String description, + String detailedStatus, + String id, + Integer ikeVersion, + String kind, + List localTrafficSelector, + String name, + String peerIp, + String region, + List remoteTrafficSelector, + String router, + String selfLink, + String sharedSecret, + String sharedSecretHash, + String status, + String targetVpnGateway) { + this.creationTimestamp = creationTimestamp; + this.description = description; + this.detailedStatus = detailedStatus; + this.id = id; + this.ikeVersion = ikeVersion; + this.kind = kind; + this.localTrafficSelector = localTrafficSelector; + this.name = name; + this.peerIp = peerIp; + this.region = region; + this.remoteTrafficSelector = remoteTrafficSelector; + this.router = router; + this.selfLink = selfLink; + this.sharedSecret = sharedSecret; + this.sharedSecretHash = sharedSecretHash; + this.status = status; + this.targetVpnGateway = targetVpnGateway; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("detailedStatus")) { + return detailedStatus; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("ikeVersion")) { + return ikeVersion; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("localTrafficSelector")) { + return localTrafficSelector; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("peerIp")) { + return peerIp; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("remoteTrafficSelector")) { + return remoteTrafficSelector; + } + if (fieldName.equals("router")) { + return router; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("sharedSecret")) { + return sharedSecret; + } + if (fieldName.equals("sharedSecretHash")) { + return sharedSecretHash; + } + if (fieldName.equals("status")) { + return status; + } + if (fieldName.equals("targetVpnGateway")) { + return targetVpnGateway; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public String getDescription() { + return description; + } + + public String getDetailedStatus() { + return detailedStatus; + } + + public String getId() { + return id; + } + + public Integer getIkeVersion() { + return ikeVersion; + } + + public String getKind() { + return kind; + } + + public List getLocalTrafficSelectorList() { + return localTrafficSelector; + } + + public String getName() { + return name; + } + + public String getPeerIp() { + return peerIp; + } + + public String getRegion() { + return region; + } + + public List getRemoteTrafficSelectorList() { + return remoteTrafficSelector; + } + + public String getRouter() { + return router; + } + + public String getSelfLink() { + return selfLink; + } + + public String getSharedSecret() { + return sharedSecret; + } + + public String getSharedSecretHash() { + return sharedSecretHash; + } + + public String getStatus() { + return status; + } + + public String getTargetVpnGateway() { + return targetVpnGateway; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(VpnTunnel prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static VpnTunnel getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final VpnTunnel DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new VpnTunnel(); + } + + public static class Builder { + private String creationTimestamp; + private String description; + private String detailedStatus; + private String id; + private Integer ikeVersion; + private String kind; + private List localTrafficSelector; + private String name; + private String peerIp; + private String region; + private List remoteTrafficSelector; + private String router; + private String selfLink; + private String sharedSecret; + private String sharedSecretHash; + private String status; + private String targetVpnGateway; + + Builder() {} + + public Builder mergeFrom(VpnTunnel other) { + if (other == VpnTunnel.getDefaultInstance()) return this; + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getDetailedStatus() != null) { + this.detailedStatus = other.detailedStatus; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getIkeVersion() != null) { + this.ikeVersion = other.ikeVersion; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getLocalTrafficSelectorList() != null) { + this.localTrafficSelector = other.localTrafficSelector; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getPeerIp() != null) { + this.peerIp = other.peerIp; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getRemoteTrafficSelectorList() != null) { + this.remoteTrafficSelector = other.remoteTrafficSelector; + } + if (other.getRouter() != null) { + this.router = other.router; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getSharedSecret() != null) { + this.sharedSecret = other.sharedSecret; + } + if (other.getSharedSecretHash() != null) { + this.sharedSecretHash = other.sharedSecretHash; + } + if (other.getStatus() != null) { + this.status = other.status; + } + if (other.getTargetVpnGateway() != null) { + this.targetVpnGateway = other.targetVpnGateway; + } + return this; + } + + Builder(VpnTunnel source) { + this.creationTimestamp = source.creationTimestamp; + this.description = source.description; + this.detailedStatus = source.detailedStatus; + this.id = source.id; + this.ikeVersion = source.ikeVersion; + this.kind = source.kind; + this.localTrafficSelector = source.localTrafficSelector; + this.name = source.name; + this.peerIp = source.peerIp; + this.region = source.region; + this.remoteTrafficSelector = source.remoteTrafficSelector; + this.router = source.router; + this.selfLink = source.selfLink; + this.sharedSecret = source.sharedSecret; + this.sharedSecretHash = source.sharedSecretHash; + this.status = source.status; + this.targetVpnGateway = source.targetVpnGateway; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getDetailedStatus() { + return detailedStatus; + } + + public Builder setDetailedStatus(String detailedStatus) { + this.detailedStatus = detailedStatus; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Integer getIkeVersion() { + return ikeVersion; + } + + public Builder setIkeVersion(Integer ikeVersion) { + this.ikeVersion = ikeVersion; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public List getLocalTrafficSelectorList() { + return localTrafficSelector; + } + + public Builder addAllLocalTrafficSelector(List localTrafficSelector) { + if (this.localTrafficSelector == null) { + this.localTrafficSelector = new ArrayList<>(localTrafficSelector.size()); + } + this.localTrafficSelector.addAll(localTrafficSelector); + return this; + } + + public Builder addLocalTrafficSelector(String localTrafficSelector) { + this.localTrafficSelector.add(localTrafficSelector); + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getPeerIp() { + return peerIp; + } + + public Builder setPeerIp(String peerIp) { + this.peerIp = peerIp; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public List getRemoteTrafficSelectorList() { + return remoteTrafficSelector; + } + + public Builder addAllRemoteTrafficSelector(List remoteTrafficSelector) { + if (this.remoteTrafficSelector == null) { + this.remoteTrafficSelector = new ArrayList<>(remoteTrafficSelector.size()); + } + this.remoteTrafficSelector.addAll(remoteTrafficSelector); + return this; + } + + public Builder addRemoteTrafficSelector(String remoteTrafficSelector) { + this.remoteTrafficSelector.add(remoteTrafficSelector); + return this; + } + + public String getRouter() { + return router; + } + + public Builder setRouter(String router) { + this.router = router; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getSharedSecret() { + return sharedSecret; + } + + public Builder setSharedSecret(String sharedSecret) { + this.sharedSecret = sharedSecret; + return this; + } + + public String getSharedSecretHash() { + return sharedSecretHash; + } + + public Builder setSharedSecretHash(String sharedSecretHash) { + this.sharedSecretHash = sharedSecretHash; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public String getTargetVpnGateway() { + return targetVpnGateway; + } + + public Builder setTargetVpnGateway(String targetVpnGateway) { + this.targetVpnGateway = targetVpnGateway; + return this; + } + + public VpnTunnel build() { + + return new VpnTunnel( + creationTimestamp, + description, + detailedStatus, + id, + ikeVersion, + kind, + localTrafficSelector, + name, + peerIp, + region, + remoteTrafficSelector, + router, + selfLink, + sharedSecret, + sharedSecretHash, + status, + targetVpnGateway); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDescription(this.description); + newBuilder.setDetailedStatus(this.detailedStatus); + newBuilder.setId(this.id); + newBuilder.setIkeVersion(this.ikeVersion); + newBuilder.setKind(this.kind); + newBuilder.addAllLocalTrafficSelector(this.localTrafficSelector); + newBuilder.setName(this.name); + newBuilder.setPeerIp(this.peerIp); + newBuilder.setRegion(this.region); + newBuilder.addAllRemoteTrafficSelector(this.remoteTrafficSelector); + newBuilder.setRouter(this.router); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setSharedSecret(this.sharedSecret); + newBuilder.setSharedSecretHash(this.sharedSecretHash); + newBuilder.setStatus(this.status); + newBuilder.setTargetVpnGateway(this.targetVpnGateway); + return newBuilder; + } + } + + @Override + public String toString() { + return "VpnTunnel{" + + "creationTimestamp=" + + creationTimestamp + + ", " + + "description=" + + description + + ", " + + "detailedStatus=" + + detailedStatus + + ", " + + "id=" + + id + + ", " + + "ikeVersion=" + + ikeVersion + + ", " + + "kind=" + + kind + + ", " + + "localTrafficSelector=" + + localTrafficSelector + + ", " + + "name=" + + name + + ", " + + "peerIp=" + + peerIp + + ", " + + "region=" + + region + + ", " + + "remoteTrafficSelector=" + + remoteTrafficSelector + + ", " + + "router=" + + router + + ", " + + "selfLink=" + + selfLink + + ", " + + "sharedSecret=" + + sharedSecret + + ", " + + "sharedSecretHash=" + + sharedSecretHash + + ", " + + "status=" + + status + + ", " + + "targetVpnGateway=" + + targetVpnGateway + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof VpnTunnel) { + VpnTunnel that = (VpnTunnel) o; + return Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.detailedStatus, that.getDetailedStatus()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.ikeVersion, that.getIkeVersion()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.localTrafficSelector, that.getLocalTrafficSelectorList()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.peerIp, that.getPeerIp()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.remoteTrafficSelector, that.getRemoteTrafficSelectorList()) + && Objects.equals(this.router, that.getRouter()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.sharedSecret, that.getSharedSecret()) + && Objects.equals(this.sharedSecretHash, that.getSharedSecretHash()) + && Objects.equals(this.status, that.getStatus()) + && Objects.equals(this.targetVpnGateway, that.getTargetVpnGateway()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + creationTimestamp, + description, + detailedStatus, + id, + ikeVersion, + kind, + localTrafficSelector, + name, + peerIp, + region, + remoteTrafficSelector, + router, + selfLink, + sharedSecret, + sharedSecretHash, + status, + targetVpnGateway); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelAggregatedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelAggregatedList.java new file mode 100644 index 000000000000..0d492688936a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelAggregatedList.java @@ -0,0 +1,298 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class VpnTunnelAggregatedList implements ApiMessage { + private final String id; + private final Map items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private VpnTunnelAggregatedList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private VpnTunnelAggregatedList( + String id, + Map items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public Map getItemsMap() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(VpnTunnelAggregatedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static VpnTunnelAggregatedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final VpnTunnelAggregatedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new VpnTunnelAggregatedList(); + } + + public static class Builder { + private String id; + private Map items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(VpnTunnelAggregatedList other) { + if (other == VpnTunnelAggregatedList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsMap() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(VpnTunnelAggregatedList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Map getItemsMap() { + return items; + } + + public Builder putAllItems(Map items) { + this.items = items; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public VpnTunnelAggregatedList build() { + + return new VpnTunnelAggregatedList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.putAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "VpnTunnelAggregatedList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof VpnTunnelAggregatedList) { + VpnTunnelAggregatedList that = (VpnTunnelAggregatedList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsMap()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelClient.java new file mode 100644 index 000000000000..27145d27e043 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelClient.java @@ -0,0 +1,928 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.VpnTunnelStub; +import com.google.cloud.compute.v1.stub.VpnTunnelStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+ *   ProjectRegionVpnTunnelName vpnTunnel = ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]");
+ *   Operation response = vpnTunnelClient.deleteVpnTunnel(vpnTunnel);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the vpnTunnelClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of VpnTunnelSettings to create(). + * For example: + * + *

To customize credentials: + * + *

+ * 
+ * VpnTunnelSettings vpnTunnelSettings =
+ *     VpnTunnelSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * VpnTunnelClient vpnTunnelClient =
+ *     VpnTunnelClient.create(vpnTunnelSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * VpnTunnelSettings vpnTunnelSettings =
+ *     VpnTunnelSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * VpnTunnelClient vpnTunnelClient =
+ *     VpnTunnelClient.create(vpnTunnelSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class VpnTunnelClient implements BackgroundResource { + private final VpnTunnelSettings settings; + private final VpnTunnelStub stub; + + /** Constructs an instance of VpnTunnelClient with default settings. */ + public static final VpnTunnelClient create() throws IOException { + return create(VpnTunnelSettings.newBuilder().build()); + } + + /** + * Constructs an instance of VpnTunnelClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final VpnTunnelClient create(VpnTunnelSettings settings) throws IOException { + return new VpnTunnelClient(settings); + } + + /** + * Constructs an instance of VpnTunnelClient, using the given stub for making calls. This is for + * advanced usage - prefer to use VpnTunnelSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final VpnTunnelClient create(VpnTunnelStub stub) { + return new VpnTunnelClient(stub); + } + + /** + * Constructs an instance of VpnTunnelClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected VpnTunnelClient(VpnTunnelSettings settings) throws IOException { + this.settings = settings; + this.stub = ((VpnTunnelStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected VpnTunnelClient(VpnTunnelStub stub) { + this.settings = null; + this.stub = stub; + } + + public final VpnTunnelSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public VpnTunnelStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of VPN tunnels. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (VpnTunnelsScopedList element : vpnTunnelClient.aggregatedListVpnTunnels(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListVpnTunnelsPagedResponse aggregatedListVpnTunnels(ProjectName project) { + AggregatedListVpnTunnelsHttpRequest request = + AggregatedListVpnTunnelsHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return aggregatedListVpnTunnels(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of VPN tunnels. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (VpnTunnelsScopedList element : vpnTunnelClient.aggregatedListVpnTunnels(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListVpnTunnelsPagedResponse aggregatedListVpnTunnels(String project) { + AggregatedListVpnTunnelsHttpRequest request = + AggregatedListVpnTunnelsHttpRequest.newBuilder().setProject(project).build(); + return aggregatedListVpnTunnels(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of VPN tunnels. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListVpnTunnelsHttpRequest request = AggregatedListVpnTunnelsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (VpnTunnelsScopedList element : vpnTunnelClient.aggregatedListVpnTunnels(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final AggregatedListVpnTunnelsPagedResponse aggregatedListVpnTunnels( + AggregatedListVpnTunnelsHttpRequest request) { + return aggregatedListVpnTunnelsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of VPN tunnels. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListVpnTunnelsHttpRequest request = AggregatedListVpnTunnelsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<AggregatedListVpnTunnelsPagedResponse> future = vpnTunnelClient.aggregatedListVpnTunnelsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (VpnTunnelsScopedList element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable< + AggregatedListVpnTunnelsHttpRequest, AggregatedListVpnTunnelsPagedResponse> + aggregatedListVpnTunnelsPagedCallable() { + return stub.aggregatedListVpnTunnelsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an aggregated list of VPN tunnels. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   AggregatedListVpnTunnelsHttpRequest request = AggregatedListVpnTunnelsHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     VpnTunnelAggregatedList response = vpnTunnelClient.aggregatedListVpnTunnelsCallable().call(request);
+   *     for (VpnTunnelsScopedList element : response.getItemsMap()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + aggregatedListVpnTunnelsCallable() { + return stub.aggregatedListVpnTunnelsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified VpnTunnel resource. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionVpnTunnelName vpnTunnel = ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]");
+   *   Operation response = vpnTunnelClient.deleteVpnTunnel(vpnTunnel);
+   * }
+   * 
+ * + * @param vpnTunnel Name of the VpnTunnel resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteVpnTunnel(ProjectRegionVpnTunnelName vpnTunnel) { + + DeleteVpnTunnelHttpRequest request = + DeleteVpnTunnelHttpRequest.newBuilder() + .setVpnTunnel(vpnTunnel == null ? null : vpnTunnel.toString()) + .build(); + return deleteVpnTunnel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified VpnTunnel resource. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionVpnTunnelName vpnTunnel = ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]");
+   *   Operation response = vpnTunnelClient.deleteVpnTunnel(vpnTunnel.toString());
+   * }
+   * 
+ * + * @param vpnTunnel Name of the VpnTunnel resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteVpnTunnel(String vpnTunnel) { + + DeleteVpnTunnelHttpRequest request = + DeleteVpnTunnelHttpRequest.newBuilder().setVpnTunnel(vpnTunnel).build(); + return deleteVpnTunnel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified VpnTunnel resource. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionVpnTunnelName vpnTunnel = ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]");
+   *   DeleteVpnTunnelHttpRequest request = DeleteVpnTunnelHttpRequest.newBuilder()
+   *     .setVpnTunnel(vpnTunnel.toString())
+   *     .build();
+   *   Operation response = vpnTunnelClient.deleteVpnTunnel(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation deleteVpnTunnel(DeleteVpnTunnelHttpRequest request) { + return deleteVpnTunnelCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified VpnTunnel resource. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionVpnTunnelName vpnTunnel = ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]");
+   *   DeleteVpnTunnelHttpRequest request = DeleteVpnTunnelHttpRequest.newBuilder()
+   *     .setVpnTunnel(vpnTunnel.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = vpnTunnelClient.deleteVpnTunnelCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteVpnTunnelCallable() { + return stub.deleteVpnTunnelCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified VpnTunnel resource. Gets a list of available VPN tunnels by making a + * list() request. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionVpnTunnelName vpnTunnel = ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]");
+   *   VpnTunnel response = vpnTunnelClient.getVpnTunnel(vpnTunnel);
+   * }
+   * 
+ * + * @param vpnTunnel Name of the VpnTunnel resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final VpnTunnel getVpnTunnel(ProjectRegionVpnTunnelName vpnTunnel) { + + GetVpnTunnelHttpRequest request = + GetVpnTunnelHttpRequest.newBuilder() + .setVpnTunnel(vpnTunnel == null ? null : vpnTunnel.toString()) + .build(); + return getVpnTunnel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified VpnTunnel resource. Gets a list of available VPN tunnels by making a + * list() request. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionVpnTunnelName vpnTunnel = ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]");
+   *   VpnTunnel response = vpnTunnelClient.getVpnTunnel(vpnTunnel.toString());
+   * }
+   * 
+ * + * @param vpnTunnel Name of the VpnTunnel resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final VpnTunnel getVpnTunnel(String vpnTunnel) { + + GetVpnTunnelHttpRequest request = + GetVpnTunnelHttpRequest.newBuilder().setVpnTunnel(vpnTunnel).build(); + return getVpnTunnel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified VpnTunnel resource. Gets a list of available VPN tunnels by making a + * list() request. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionVpnTunnelName vpnTunnel = ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]");
+   *   GetVpnTunnelHttpRequest request = GetVpnTunnelHttpRequest.newBuilder()
+   *     .setVpnTunnel(vpnTunnel.toString())
+   *     .build();
+   *   VpnTunnel response = vpnTunnelClient.getVpnTunnel(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final VpnTunnel getVpnTunnel(GetVpnTunnelHttpRequest request) { + return getVpnTunnelCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified VpnTunnel resource. Gets a list of available VPN tunnels by making a + * list() request. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionVpnTunnelName vpnTunnel = ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]");
+   *   GetVpnTunnelHttpRequest request = GetVpnTunnelHttpRequest.newBuilder()
+   *     .setVpnTunnel(vpnTunnel.toString())
+   *     .build();
+   *   ApiFuture<VpnTunnel> future = vpnTunnelClient.getVpnTunnelCallable().futureCall(request);
+   *   // Do something
+   *   VpnTunnel response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getVpnTunnelCallable() { + return stub.getVpnTunnelCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a VpnTunnel resource in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   VpnTunnel vpnTunnelResource = VpnTunnel.newBuilder().build();
+   *   Operation response = vpnTunnelClient.insertVpnTunnel(region, vpnTunnelResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param vpnTunnelResource VPN tunnel resource. (== resource_for beta.vpnTunnels ==) (== + * resource_for v1.vpnTunnels ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertVpnTunnel(ProjectRegionName region, VpnTunnel vpnTunnelResource) { + + InsertVpnTunnelHttpRequest request = + InsertVpnTunnelHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .setVpnTunnelResource(vpnTunnelResource) + .build(); + return insertVpnTunnel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a VpnTunnel resource in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   VpnTunnel vpnTunnelResource = VpnTunnel.newBuilder().build();
+   *   Operation response = vpnTunnelClient.insertVpnTunnel(region.toString(), vpnTunnelResource);
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @param vpnTunnelResource VPN tunnel resource. (== resource_for beta.vpnTunnels ==) (== + * resource_for v1.vpnTunnels ==) + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertVpnTunnel(String region, VpnTunnel vpnTunnelResource) { + + InsertVpnTunnelHttpRequest request = + InsertVpnTunnelHttpRequest.newBuilder() + .setRegion(region) + .setVpnTunnelResource(vpnTunnelResource) + .build(); + return insertVpnTunnel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a VpnTunnel resource in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   VpnTunnel vpnTunnelResource = VpnTunnel.newBuilder().build();
+   *   InsertVpnTunnelHttpRequest request = InsertVpnTunnelHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setVpnTunnelResource(vpnTunnelResource)
+   *     .build();
+   *   Operation response = vpnTunnelClient.insertVpnTunnel(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation insertVpnTunnel(InsertVpnTunnelHttpRequest request) { + return insertVpnTunnelCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a VpnTunnel resource in the specified project and region using the data included in the + * request. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   VpnTunnel vpnTunnelResource = VpnTunnel.newBuilder().build();
+   *   InsertVpnTunnelHttpRequest request = InsertVpnTunnelHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .setVpnTunnelResource(vpnTunnelResource)
+   *     .build();
+   *   ApiFuture<Operation> future = vpnTunnelClient.insertVpnTunnelCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable insertVpnTunnelCallable() { + return stub.insertVpnTunnelCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of VpnTunnel resources contained in the specified project and region. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (VpnTunnel element : vpnTunnelClient.listVpnTunnels(region).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListVpnTunnelsPagedResponse listVpnTunnels(ProjectRegionName region) { + ListVpnTunnelsHttpRequest request = + ListVpnTunnelsHttpRequest.newBuilder() + .setRegion(region == null ? null : region.toString()) + .build(); + return listVpnTunnels(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of VpnTunnel resources contained in the specified project and region. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   for (VpnTunnel element : vpnTunnelClient.listVpnTunnels(region.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param region Name of the region for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListVpnTunnelsPagedResponse listVpnTunnels(String region) { + ListVpnTunnelsHttpRequest request = + ListVpnTunnelsHttpRequest.newBuilder().setRegion(region).build(); + return listVpnTunnels(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of VpnTunnel resources contained in the specified project and region. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListVpnTunnelsHttpRequest request = ListVpnTunnelsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   for (VpnTunnel element : vpnTunnelClient.listVpnTunnels(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListVpnTunnelsPagedResponse listVpnTunnels(ListVpnTunnelsHttpRequest request) { + return listVpnTunnelsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of VpnTunnel resources contained in the specified project and region. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListVpnTunnelsHttpRequest request = ListVpnTunnelsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   ApiFuture<ListVpnTunnelsPagedResponse> future = vpnTunnelClient.listVpnTunnelsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (VpnTunnel element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listVpnTunnelsPagedCallable() { + return stub.listVpnTunnelsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of VpnTunnel resources contained in the specified project and region. + * + *

Sample code: + * + *


+   * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+   *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+   *   ListVpnTunnelsHttpRequest request = ListVpnTunnelsHttpRequest.newBuilder()
+   *     .setRegion(region.toString())
+   *     .build();
+   *   while (true) {
+   *     VpnTunnelList response = vpnTunnelClient.listVpnTunnelsCallable().call(request);
+   *     for (VpnTunnel element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listVpnTunnelsCallable() { + return stub.listVpnTunnelsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class AggregatedListVpnTunnelsPagedResponse + extends AbstractPagedListResponse< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, VpnTunnelsScopedList, + AggregatedListVpnTunnelsPage, AggregatedListVpnTunnelsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, VpnTunnelsScopedList> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + AggregatedListVpnTunnelsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public AggregatedListVpnTunnelsPagedResponse apply(AggregatedListVpnTunnelsPage input) { + return new AggregatedListVpnTunnelsPagedResponse(input); + } + }); + } + + private AggregatedListVpnTunnelsPagedResponse(AggregatedListVpnTunnelsPage page) { + super(page, AggregatedListVpnTunnelsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class AggregatedListVpnTunnelsPage + extends AbstractPage< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, VpnTunnelsScopedList, + AggregatedListVpnTunnelsPage> { + + private AggregatedListVpnTunnelsPage( + PageContext< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, VpnTunnelsScopedList> + context, + VpnTunnelAggregatedList response) { + super(context, response); + } + + private static AggregatedListVpnTunnelsPage createEmptyPage() { + return new AggregatedListVpnTunnelsPage(null, null); + } + + @Override + protected AggregatedListVpnTunnelsPage createPage( + PageContext< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, VpnTunnelsScopedList> + context, + VpnTunnelAggregatedList response) { + return new AggregatedListVpnTunnelsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, VpnTunnelsScopedList> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class AggregatedListVpnTunnelsFixedSizeCollection + extends AbstractFixedSizeCollection< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, VpnTunnelsScopedList, + AggregatedListVpnTunnelsPage, AggregatedListVpnTunnelsFixedSizeCollection> { + + private AggregatedListVpnTunnelsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static AggregatedListVpnTunnelsFixedSizeCollection createEmptyCollection() { + return new AggregatedListVpnTunnelsFixedSizeCollection(null, 0); + } + + @Override + protected AggregatedListVpnTunnelsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new AggregatedListVpnTunnelsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListVpnTunnelsPagedResponse + extends AbstractPagedListResponse< + ListVpnTunnelsHttpRequest, VpnTunnelList, VpnTunnel, ListVpnTunnelsPage, + ListVpnTunnelsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListVpnTunnelsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListVpnTunnelsPagedResponse apply(ListVpnTunnelsPage input) { + return new ListVpnTunnelsPagedResponse(input); + } + }); + } + + private ListVpnTunnelsPagedResponse(ListVpnTunnelsPage page) { + super(page, ListVpnTunnelsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListVpnTunnelsPage + extends AbstractPage< + ListVpnTunnelsHttpRequest, VpnTunnelList, VpnTunnel, ListVpnTunnelsPage> { + + private ListVpnTunnelsPage( + PageContext context, + VpnTunnelList response) { + super(context, response); + } + + private static ListVpnTunnelsPage createEmptyPage() { + return new ListVpnTunnelsPage(null, null); + } + + @Override + protected ListVpnTunnelsPage createPage( + PageContext context, + VpnTunnelList response) { + return new ListVpnTunnelsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListVpnTunnelsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListVpnTunnelsHttpRequest, VpnTunnelList, VpnTunnel, ListVpnTunnelsPage, + ListVpnTunnelsFixedSizeCollection> { + + private ListVpnTunnelsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListVpnTunnelsFixedSizeCollection createEmptyCollection() { + return new ListVpnTunnelsFixedSizeCollection(null, 0); + } + + @Override + protected ListVpnTunnelsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListVpnTunnelsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelList.java new file mode 100644 index 000000000000..7205aa4a8647 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class VpnTunnelList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private VpnTunnelList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private VpnTunnelList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(VpnTunnelList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static VpnTunnelList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final VpnTunnelList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new VpnTunnelList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(VpnTunnelList other) { + if (other == VpnTunnelList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(VpnTunnelList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(VpnTunnel items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public VpnTunnelList build() { + + return new VpnTunnelList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "VpnTunnelList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof VpnTunnelList) { + VpnTunnelList that = (VpnTunnelList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelSettings.java new file mode 100644 index 000000000000..57b0f267774a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelSettings.java @@ -0,0 +1,234 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.VpnTunnelClient.AggregatedListVpnTunnelsPagedResponse; +import static com.google.cloud.compute.v1.VpnTunnelClient.ListVpnTunnelsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.VpnTunnelStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link VpnTunnelClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteVpnTunnel to 30 seconds: + * + *

+ * 
+ * VpnTunnelSettings.Builder vpnTunnelSettingsBuilder =
+ *     VpnTunnelSettings.newBuilder();
+ * vpnTunnelSettingsBuilder.deleteVpnTunnelSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * VpnTunnelSettings vpnTunnelSettings = vpnTunnelSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class VpnTunnelSettings extends ClientSettings { + /** Returns the object with the settings used for calls to aggregatedListVpnTunnels. */ + public PagedCallSettings< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, + AggregatedListVpnTunnelsPagedResponse> + aggregatedListVpnTunnelsSettings() { + return ((VpnTunnelStubSettings) getStubSettings()).aggregatedListVpnTunnelsSettings(); + } + + /** Returns the object with the settings used for calls to deleteVpnTunnel. */ + public UnaryCallSettings deleteVpnTunnelSettings() { + return ((VpnTunnelStubSettings) getStubSettings()).deleteVpnTunnelSettings(); + } + + /** Returns the object with the settings used for calls to getVpnTunnel. */ + public UnaryCallSettings getVpnTunnelSettings() { + return ((VpnTunnelStubSettings) getStubSettings()).getVpnTunnelSettings(); + } + + /** Returns the object with the settings used for calls to insertVpnTunnel. */ + public UnaryCallSettings insertVpnTunnelSettings() { + return ((VpnTunnelStubSettings) getStubSettings()).insertVpnTunnelSettings(); + } + + /** Returns the object with the settings used for calls to listVpnTunnels. */ + public PagedCallSettings + listVpnTunnelsSettings() { + return ((VpnTunnelStubSettings) getStubSettings()).listVpnTunnelsSettings(); + } + + public static final VpnTunnelSettings create(VpnTunnelStubSettings stub) throws IOException { + return new VpnTunnelSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return VpnTunnelStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return VpnTunnelStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return VpnTunnelStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return VpnTunnelStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return VpnTunnelStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return VpnTunnelStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return VpnTunnelStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return VpnTunnelStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected VpnTunnelSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for VpnTunnelSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(VpnTunnelStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(VpnTunnelStubSettings.newBuilder()); + } + + protected Builder(VpnTunnelSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(VpnTunnelStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public VpnTunnelStubSettings.Builder getStubSettingsBuilder() { + return ((VpnTunnelStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to aggregatedListVpnTunnels. */ + public PagedCallSettings.Builder< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, + AggregatedListVpnTunnelsPagedResponse> + aggregatedListVpnTunnelsSettings() { + return getStubSettingsBuilder().aggregatedListVpnTunnelsSettings(); + } + + /** Returns the builder for the settings used for calls to deleteVpnTunnel. */ + public UnaryCallSettings.Builder + deleteVpnTunnelSettings() { + return getStubSettingsBuilder().deleteVpnTunnelSettings(); + } + + /** Returns the builder for the settings used for calls to getVpnTunnel. */ + public UnaryCallSettings.Builder getVpnTunnelSettings() { + return getStubSettingsBuilder().getVpnTunnelSettings(); + } + + /** Returns the builder for the settings used for calls to insertVpnTunnel. */ + public UnaryCallSettings.Builder + insertVpnTunnelSettings() { + return getStubSettingsBuilder().insertVpnTunnelSettings(); + } + + /** Returns the builder for the settings used for calls to listVpnTunnels. */ + public PagedCallSettings.Builder< + ListVpnTunnelsHttpRequest, VpnTunnelList, ListVpnTunnelsPagedResponse> + listVpnTunnelsSettings() { + return getStubSettingsBuilder().listVpnTunnelsSettings(); + } + + @Override + public VpnTunnelSettings build() throws IOException { + return new VpnTunnelSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelsScopedList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelsScopedList.java new file mode 100644 index 000000000000..ea1e23fb9162 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/VpnTunnelsScopedList.java @@ -0,0 +1,178 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class VpnTunnelsScopedList implements ApiMessage { + private final List vpnTunnels; + private final Warning warning; + + private VpnTunnelsScopedList() { + this.vpnTunnels = null; + this.warning = null; + } + + private VpnTunnelsScopedList(List vpnTunnels, Warning warning) { + this.vpnTunnels = vpnTunnels; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("vpnTunnels")) { + return vpnTunnels; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getVpnTunnelsList() { + return vpnTunnels; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(VpnTunnelsScopedList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static VpnTunnelsScopedList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final VpnTunnelsScopedList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new VpnTunnelsScopedList(); + } + + public static class Builder { + private List vpnTunnels; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(VpnTunnelsScopedList other) { + if (other == VpnTunnelsScopedList.getDefaultInstance()) return this; + if (other.getVpnTunnelsList() != null) { + this.vpnTunnels = other.vpnTunnels; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(VpnTunnelsScopedList source) { + this.vpnTunnels = source.vpnTunnels; + this.warning = source.warning; + } + + public List getVpnTunnelsList() { + return vpnTunnels; + } + + public Builder addAllVpnTunnels(List vpnTunnels) { + if (this.vpnTunnels == null) { + this.vpnTunnels = new ArrayList<>(vpnTunnels.size()); + } + this.vpnTunnels.addAll(vpnTunnels); + return this; + } + + public Builder addVpnTunnels(VpnTunnel vpnTunnels) { + this.vpnTunnels.add(vpnTunnels); + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public VpnTunnelsScopedList build() { + + return new VpnTunnelsScopedList(vpnTunnels, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllVpnTunnels(this.vpnTunnels); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "VpnTunnelsScopedList{" + "vpnTunnels=" + vpnTunnels + ", " + "warning=" + warning + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof VpnTunnelsScopedList) { + VpnTunnelsScopedList that = (VpnTunnelsScopedList) o; + return Objects.equals(this.vpnTunnels, that.getVpnTunnelsList()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(vpnTunnels, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Warning.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Warning.java new file mode 100644 index 000000000000..b9b8ed6c959d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Warning.java @@ -0,0 +1,204 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Warning implements ApiMessage { + private final String code; + private final List data; + private final String message; + + private Warning() { + this.code = null; + this.data = null; + this.message = null; + } + + private Warning(String code, List data, String message) { + this.code = code; + this.data = data; + this.message = message; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("code")) { + return code; + } + if (fieldName.equals("data")) { + return data; + } + if (fieldName.equals("message")) { + return message; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCode() { + return code; + } + + public List getDataList() { + return data; + } + + public String getMessage() { + return message; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Warning prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Warning getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Warning DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Warning(); + } + + public static class Builder { + private String code; + private List data; + private String message; + + Builder() {} + + public Builder mergeFrom(Warning other) { + if (other == Warning.getDefaultInstance()) return this; + if (other.getCode() != null) { + this.code = other.code; + } + if (other.getDataList() != null) { + this.data = other.data; + } + if (other.getMessage() != null) { + this.message = other.message; + } + return this; + } + + Builder(Warning source) { + this.code = source.code; + this.data = source.data; + this.message = source.message; + } + + public String getCode() { + return code; + } + + public Builder setCode(String code) { + this.code = code; + return this; + } + + public List getDataList() { + return data; + } + + public Builder addAllData(List data) { + if (this.data == null) { + this.data = new ArrayList<>(data.size()); + } + this.data.addAll(data); + return this; + } + + public Builder addData(Data data) { + this.data.add(data); + return this; + } + + public String getMessage() { + return message; + } + + public Builder setMessage(String message) { + this.message = message; + return this; + } + + public Warning build() { + + return new Warning(code, data, message); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCode(this.code); + newBuilder.addAllData(this.data); + newBuilder.setMessage(this.message); + return newBuilder; + } + } + + @Override + public String toString() { + return "Warning{" + "code=" + code + ", " + "data=" + data + ", " + "message=" + message + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Warning) { + Warning that = (Warning) o; + return Objects.equals(this.code, that.getCode()) + && Objects.equals(this.data, that.getDataList()) + && Objects.equals(this.message, that.getMessage()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(code, data, message); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Warnings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Warnings.java new file mode 100644 index 000000000000..ac9609a33607 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Warnings.java @@ -0,0 +1,204 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Warnings implements ApiMessage { + private final String code; + private final List data; + private final String message; + + private Warnings() { + this.code = null; + this.data = null; + this.message = null; + } + + private Warnings(String code, List data, String message) { + this.code = code; + this.data = data; + this.message = message; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("code")) { + return code; + } + if (fieldName.equals("data")) { + return data; + } + if (fieldName.equals("message")) { + return message; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getCode() { + return code; + } + + public List getDataList() { + return data; + } + + public String getMessage() { + return message; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Warnings prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Warnings getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Warnings DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Warnings(); + } + + public static class Builder { + private String code; + private List data; + private String message; + + Builder() {} + + public Builder mergeFrom(Warnings other) { + if (other == Warnings.getDefaultInstance()) return this; + if (other.getCode() != null) { + this.code = other.code; + } + if (other.getDataList() != null) { + this.data = other.data; + } + if (other.getMessage() != null) { + this.message = other.message; + } + return this; + } + + Builder(Warnings source) { + this.code = source.code; + this.data = source.data; + this.message = source.message; + } + + public String getCode() { + return code; + } + + public Builder setCode(String code) { + this.code = code; + return this; + } + + public List getDataList() { + return data; + } + + public Builder addAllData(List data) { + if (this.data == null) { + this.data = new ArrayList<>(data.size()); + } + this.data.addAll(data); + return this; + } + + public Builder addData(Data data) { + this.data.add(data); + return this; + } + + public String getMessage() { + return message; + } + + public Builder setMessage(String message) { + this.message = message; + return this; + } + + public Warnings build() { + + return new Warnings(code, data, message); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setCode(this.code); + newBuilder.addAllData(this.data); + newBuilder.setMessage(this.message); + return newBuilder; + } + } + + @Override + public String toString() { + return "Warnings{" + "code=" + code + ", " + "data=" + data + ", " + "message=" + message + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Warnings) { + Warnings that = (Warnings) o; + return Objects.equals(this.code, that.getCode()) + && Objects.equals(this.data, that.getDataList()) + && Objects.equals(this.message, that.getMessage()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(code, data, message); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/XpnHostList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/XpnHostList.java new file mode 100644 index 000000000000..da89eeaf4e6b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/XpnHostList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class XpnHostList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private XpnHostList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private XpnHostList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(XpnHostList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static XpnHostList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final XpnHostList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new XpnHostList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(XpnHostList other) { + if (other == XpnHostList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(XpnHostList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Project items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public XpnHostList build() { + + return new XpnHostList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "XpnHostList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof XpnHostList) { + XpnHostList that = (XpnHostList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/XpnResourceId.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/XpnResourceId.java new file mode 100644 index 000000000000..810cc2aa1797 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/XpnResourceId.java @@ -0,0 +1,168 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class XpnResourceId implements ApiMessage { + private final String id; + private final String type; + + private XpnResourceId() { + this.id = null; + this.type = null; + } + + private XpnResourceId(String id, String type) { + this.id = id; + this.type = type; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("type")) { + return type; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public String getType() { + return type; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(XpnResourceId prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static XpnResourceId getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final XpnResourceId DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new XpnResourceId(); + } + + public static class Builder { + private String id; + private String type; + + Builder() {} + + public Builder mergeFrom(XpnResourceId other) { + if (other == XpnResourceId.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getType() != null) { + this.type = other.type; + } + return this; + } + + Builder(XpnResourceId source) { + this.id = source.id; + this.type = source.type; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getType() { + return type; + } + + public Builder setType(String type) { + this.type = type; + return this; + } + + public XpnResourceId build() { + + return new XpnResourceId(id, type); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.setType(this.type); + return newBuilder; + } + } + + @Override + public String toString() { + return "XpnResourceId{" + "id=" + id + ", " + "type=" + type + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof XpnResourceId) { + XpnResourceId that = (XpnResourceId) o; + return Objects.equals(this.id, that.getId()) && Objects.equals(this.type, that.getType()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Zone.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Zone.java new file mode 100644 index 000000000000..8406d81a7481 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Zone.java @@ -0,0 +1,446 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class Zone implements ApiMessage { + private final List availableCpuPlatforms; + private final String creationTimestamp; + private final DeprecationStatus deprecated; + private final String description; + private final String id; + private final String kind; + private final String name; + private final String region; + private final String selfLink; + private final String status; + + private Zone() { + this.availableCpuPlatforms = null; + this.creationTimestamp = null; + this.deprecated = null; + this.description = null; + this.id = null; + this.kind = null; + this.name = null; + this.region = null; + this.selfLink = null; + this.status = null; + } + + private Zone( + List availableCpuPlatforms, + String creationTimestamp, + DeprecationStatus deprecated, + String description, + String id, + String kind, + String name, + String region, + String selfLink, + String status) { + this.availableCpuPlatforms = availableCpuPlatforms; + this.creationTimestamp = creationTimestamp; + this.deprecated = deprecated; + this.description = description; + this.id = id; + this.kind = kind; + this.name = name; + this.region = region; + this.selfLink = selfLink; + this.status = status; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("availableCpuPlatforms")) { + return availableCpuPlatforms; + } + if (fieldName.equals("creationTimestamp")) { + return creationTimestamp; + } + if (fieldName.equals("deprecated")) { + return deprecated; + } + if (fieldName.equals("description")) { + return description; + } + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("name")) { + return name; + } + if (fieldName.equals("region")) { + return region; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("status")) { + return status; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getAvailableCpuPlatformsList() { + return availableCpuPlatforms; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public String getDescription() { + return description; + } + + public String getId() { + return id; + } + + public String getKind() { + return kind; + } + + public String getName() { + return name; + } + + public String getRegion() { + return region; + } + + public String getSelfLink() { + return selfLink; + } + + public String getStatus() { + return status; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(Zone prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static Zone getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final Zone DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new Zone(); + } + + public static class Builder { + private List availableCpuPlatforms; + private String creationTimestamp; + private DeprecationStatus deprecated; + private String description; + private String id; + private String kind; + private String name; + private String region; + private String selfLink; + private String status; + + Builder() {} + + public Builder mergeFrom(Zone other) { + if (other == Zone.getDefaultInstance()) return this; + if (other.getAvailableCpuPlatformsList() != null) { + this.availableCpuPlatforms = other.availableCpuPlatforms; + } + if (other.getCreationTimestamp() != null) { + this.creationTimestamp = other.creationTimestamp; + } + if (other.getDeprecated() != null) { + this.deprecated = other.deprecated; + } + if (other.getDescription() != null) { + this.description = other.description; + } + if (other.getId() != null) { + this.id = other.id; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getName() != null) { + this.name = other.name; + } + if (other.getRegion() != null) { + this.region = other.region; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getStatus() != null) { + this.status = other.status; + } + return this; + } + + Builder(Zone source) { + this.availableCpuPlatforms = source.availableCpuPlatforms; + this.creationTimestamp = source.creationTimestamp; + this.deprecated = source.deprecated; + this.description = source.description; + this.id = source.id; + this.kind = source.kind; + this.name = source.name; + this.region = source.region; + this.selfLink = source.selfLink; + this.status = source.status; + } + + public List getAvailableCpuPlatformsList() { + return availableCpuPlatforms; + } + + public Builder addAllAvailableCpuPlatforms(List availableCpuPlatforms) { + if (this.availableCpuPlatforms == null) { + this.availableCpuPlatforms = new ArrayList<>(availableCpuPlatforms.size()); + } + this.availableCpuPlatforms.addAll(availableCpuPlatforms); + return this; + } + + public Builder addAvailableCpuPlatforms(String availableCpuPlatforms) { + this.availableCpuPlatforms.add(availableCpuPlatforms); + return this; + } + + public String getCreationTimestamp() { + return creationTimestamp; + } + + public Builder setCreationTimestamp(String creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + public DeprecationStatus getDeprecated() { + return deprecated; + } + + public Builder setDeprecated(DeprecationStatus deprecated) { + this.deprecated = deprecated; + return this; + } + + public String getDescription() { + return description; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getName() { + return name; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public String getRegion() { + return region; + } + + public Builder setRegion(String region) { + this.region = region; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public String getStatus() { + return status; + } + + public Builder setStatus(String status) { + this.status = status; + return this; + } + + public Zone build() { + + return new Zone( + availableCpuPlatforms, + creationTimestamp, + deprecated, + description, + id, + kind, + name, + region, + selfLink, + status); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllAvailableCpuPlatforms(this.availableCpuPlatforms); + newBuilder.setCreationTimestamp(this.creationTimestamp); + newBuilder.setDeprecated(this.deprecated); + newBuilder.setDescription(this.description); + newBuilder.setId(this.id); + newBuilder.setKind(this.kind); + newBuilder.setName(this.name); + newBuilder.setRegion(this.region); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setStatus(this.status); + return newBuilder; + } + } + + @Override + public String toString() { + return "Zone{" + + "availableCpuPlatforms=" + + availableCpuPlatforms + + ", " + + "creationTimestamp=" + + creationTimestamp + + ", " + + "deprecated=" + + deprecated + + ", " + + "description=" + + description + + ", " + + "id=" + + id + + ", " + + "kind=" + + kind + + ", " + + "name=" + + name + + ", " + + "region=" + + region + + ", " + + "selfLink=" + + selfLink + + ", " + + "status=" + + status + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof Zone) { + Zone that = (Zone) o; + return Objects.equals(this.availableCpuPlatforms, that.getAvailableCpuPlatformsList()) + && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) + && Objects.equals(this.deprecated, that.getDeprecated()) + && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.id, that.getId()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.region, that.getRegion()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.status, that.getStatus()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash( + availableCpuPlatforms, + creationTimestamp, + deprecated, + description, + id, + kind, + name, + region, + selfLink, + status); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneClient.java new file mode 100644 index 000000000000..cb825ba099c3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneClient.java @@ -0,0 +1,480 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.ZoneStub; +import com.google.cloud.compute.v1.stub.ZoneStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (ZoneClient zoneClient = ZoneClient.create()) {
+ *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+ *   Zone response = zoneClient.getZone(zone);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the zoneClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of ZoneSettings to create(). For + * example: + * + *

To customize credentials: + * + *

+ * 
+ * ZoneSettings zoneSettings =
+ *     ZoneSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ZoneClient zoneClient =
+ *     ZoneClient.create(zoneSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * ZoneSettings zoneSettings =
+ *     ZoneSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ZoneClient zoneClient =
+ *     ZoneClient.create(zoneSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ZoneClient implements BackgroundResource { + private final ZoneSettings settings; + private final ZoneStub stub; + + /** Constructs an instance of ZoneClient with default settings. */ + public static final ZoneClient create() throws IOException { + return create(ZoneSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ZoneClient, using the given settings. The channels are created based + * on the settings passed in, or defaults for any settings that are not set. + */ + public static final ZoneClient create(ZoneSettings settings) throws IOException { + return new ZoneClient(settings); + } + + /** + * Constructs an instance of ZoneClient, using the given stub for making calls. This is for + * advanced usage - prefer to use ZoneSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final ZoneClient create(ZoneStub stub) { + return new ZoneClient(stub); + } + + /** + * Constructs an instance of ZoneClient, using the given settings. This is protected so that it is + * easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected ZoneClient(ZoneSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ZoneStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected ZoneClient(ZoneStub stub) { + this.settings = null; + this.stub = stub; + } + + public final ZoneSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ZoneStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Zone resource. Gets a list of available zones by making a list() request. + * + *

Sample code: + * + *


+   * try (ZoneClient zoneClient = ZoneClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Zone response = zoneClient.getZone(zone);
+   * }
+   * 
+ * + * @param zone Name of the zone resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Zone getZone(ProjectZoneName zone) { + + GetZoneHttpRequest request = + GetZoneHttpRequest.newBuilder().setZone(zone == null ? null : zone.toString()).build(); + return getZone(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Zone resource. Gets a list of available zones by making a list() request. + * + *

Sample code: + * + *


+   * try (ZoneClient zoneClient = ZoneClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   Zone response = zoneClient.getZone(zone.toString());
+   * }
+   * 
+ * + * @param zone Name of the zone resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Zone getZone(String zone) { + + GetZoneHttpRequest request = GetZoneHttpRequest.newBuilder().setZone(zone).build(); + return getZone(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Zone resource. Gets a list of available zones by making a list() request. + * + *

Sample code: + * + *


+   * try (ZoneClient zoneClient = ZoneClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   GetZoneHttpRequest request = GetZoneHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   Zone response = zoneClient.getZone(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Zone getZone(GetZoneHttpRequest request) { + return getZoneCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the specified Zone resource. Gets a list of available zones by making a list() request. + * + *

Sample code: + * + *


+   * try (ZoneClient zoneClient = ZoneClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   GetZoneHttpRequest request = GetZoneHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   ApiFuture<Zone> future = zoneClient.getZoneCallable().futureCall(request);
+   *   // Do something
+   *   Zone response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getZoneCallable() { + return stub.getZoneCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Zone resources available to the specified project. + * + *

Sample code: + * + *


+   * try (ZoneClient zoneClient = ZoneClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Zone element : zoneClient.listZones(project).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListZonesPagedResponse listZones(ProjectName project) { + ListZonesHttpRequest request = + ListZonesHttpRequest.newBuilder() + .setProject(project == null ? null : project.toString()) + .build(); + return listZones(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Zone resources available to the specified project. + * + *

Sample code: + * + *


+   * try (ZoneClient zoneClient = ZoneClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   for (Zone element : zoneClient.listZones(project.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListZonesPagedResponse listZones(String project) { + ListZonesHttpRequest request = ListZonesHttpRequest.newBuilder().setProject(project).build(); + return listZones(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Zone resources available to the specified project. + * + *

Sample code: + * + *


+   * try (ZoneClient zoneClient = ZoneClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListZonesHttpRequest request = ListZonesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   for (Zone element : zoneClient.listZones(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListZonesPagedResponse listZones(ListZonesHttpRequest request) { + return listZonesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Zone resources available to the specified project. + * + *

Sample code: + * + *


+   * try (ZoneClient zoneClient = ZoneClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListZonesHttpRequest request = ListZonesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   ApiFuture<ListZonesPagedResponse> future = zoneClient.listZonesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Zone element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listZonesPagedCallable() { + return stub.listZonesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the list of Zone resources available to the specified project. + * + *

Sample code: + * + *


+   * try (ZoneClient zoneClient = ZoneClient.create()) {
+   *   ProjectName project = ProjectName.of("[PROJECT]");
+   *   ListZonesHttpRequest request = ListZonesHttpRequest.newBuilder()
+   *     .setProject(project.toString())
+   *     .build();
+   *   while (true) {
+   *     ZoneList response = zoneClient.listZonesCallable().call(request);
+   *     for (Zone element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable listZonesCallable() { + return stub.listZonesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListZonesPagedResponse + extends AbstractPagedListResponse< + ListZonesHttpRequest, ZoneList, Zone, ListZonesPage, ListZonesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListZonesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListZonesPagedResponse apply(ListZonesPage input) { + return new ListZonesPagedResponse(input); + } + }); + } + + private ListZonesPagedResponse(ListZonesPage page) { + super(page, ListZonesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListZonesPage + extends AbstractPage { + + private ListZonesPage( + PageContext context, ZoneList response) { + super(context, response); + } + + private static ListZonesPage createEmptyPage() { + return new ListZonesPage(null, null); + } + + @Override + protected ListZonesPage createPage( + PageContext context, ZoneList response) { + return new ListZonesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListZonesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListZonesHttpRequest, ZoneList, Zone, ListZonesPage, ListZonesFixedSizeCollection> { + + private ListZonesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListZonesFixedSizeCollection createEmptyCollection() { + return new ListZonesFixedSizeCollection(null, 0); + } + + @Override + protected ListZonesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListZonesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneList.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneList.java new file mode 100644 index 000000000000..a4085a18b4bb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneList.java @@ -0,0 +1,306 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ZoneList implements ApiMessage { + private final String id; + private final List items; + private final String kind; + private final String nextPageToken; + private final String selfLink; + private final Warning warning; + + private ZoneList() { + this.id = null; + this.items = null; + this.kind = null; + this.nextPageToken = null; + this.selfLink = null; + this.warning = null; + } + + private ZoneList( + String id, + List items, + String kind, + String nextPageToken, + String selfLink, + Warning warning) { + this.id = id; + this.items = items; + this.kind = kind; + this.nextPageToken = nextPageToken; + this.selfLink = selfLink; + this.warning = warning; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("id")) { + return id; + } + if (fieldName.equals("items")) { + return items; + } + if (fieldName.equals("kind")) { + return kind; + } + if (fieldName.equals("nextPageToken")) { + return nextPageToken; + } + if (fieldName.equals("selfLink")) { + return selfLink; + } + if (fieldName.equals("warning")) { + return warning; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getId() { + return id; + } + + public List getItemsList() { + return items; + } + + public String getKind() { + return kind; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public String getSelfLink() { + return selfLink; + } + + public Warning getWarning() { + return warning; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ZoneList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ZoneList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ZoneList DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ZoneList(); + } + + public static class Builder { + private String id; + private List items; + private String kind; + private String nextPageToken; + private String selfLink; + private Warning warning; + + Builder() {} + + public Builder mergeFrom(ZoneList other) { + if (other == ZoneList.getDefaultInstance()) return this; + if (other.getId() != null) { + this.id = other.id; + } + if (other.getItemsList() != null) { + this.items = other.items; + } + if (other.getKind() != null) { + this.kind = other.kind; + } + if (other.getNextPageToken() != null) { + this.nextPageToken = other.nextPageToken; + } + if (other.getSelfLink() != null) { + this.selfLink = other.selfLink; + } + if (other.getWarning() != null) { + this.warning = other.warning; + } + return this; + } + + Builder(ZoneList source) { + this.id = source.id; + this.items = source.items; + this.kind = source.kind; + this.nextPageToken = source.nextPageToken; + this.selfLink = source.selfLink; + this.warning = source.warning; + } + + public String getId() { + return id; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public List getItemsList() { + return items; + } + + public Builder addAllItems(List items) { + if (this.items == null) { + this.items = new ArrayList<>(items.size()); + } + this.items.addAll(items); + return this; + } + + public Builder addItems(Zone items) { + this.items.add(items); + return this; + } + + public String getKind() { + return kind; + } + + public Builder setKind(String kind) { + this.kind = kind; + return this; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public Builder setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + public String getSelfLink() { + return selfLink; + } + + public Builder setSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + public Warning getWarning() { + return warning; + } + + public Builder setWarning(Warning warning) { + this.warning = warning; + return this; + } + + public ZoneList build() { + + return new ZoneList(id, items, kind, nextPageToken, selfLink, warning); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setId(this.id); + newBuilder.addAllItems(this.items); + newBuilder.setKind(this.kind); + newBuilder.setNextPageToken(this.nextPageToken); + newBuilder.setSelfLink(this.selfLink); + newBuilder.setWarning(this.warning); + return newBuilder; + } + } + + @Override + public String toString() { + return "ZoneList{" + + "id=" + + id + + ", " + + "items=" + + items + + ", " + + "kind=" + + kind + + ", " + + "nextPageToken=" + + nextPageToken + + ", " + + "selfLink=" + + selfLink + + ", " + + "warning=" + + warning + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ZoneList) { + ZoneList that = (ZoneList) o; + return Objects.equals(this.id, that.getId()) + && Objects.equals(this.items, that.getItemsList()) + && Objects.equals(this.kind, that.getKind()) + && Objects.equals(this.nextPageToken, that.getNextPageToken()) + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.warning, that.getWarning()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(id, items, kind, nextPageToken, selfLink, warning); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneOperationClient.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneOperationClient.java new file mode 100644 index 000000000000..91ccbcf69ff0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneOperationClient.java @@ -0,0 +1,591 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.ZoneOperationStub; +import com.google.cloud.compute.v1.stub.ZoneOperationStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+ *   ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
+ *   zoneOperationClient.deleteZoneOperation(operation);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the zoneOperationClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of ZoneOperationSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * ZoneOperationSettings zoneOperationSettings =
+ *     ZoneOperationSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ZoneOperationClient zoneOperationClient =
+ *     ZoneOperationClient.create(zoneOperationSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * ZoneOperationSettings zoneOperationSettings =
+ *     ZoneOperationSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ZoneOperationClient zoneOperationClient =
+ *     ZoneOperationClient.create(zoneOperationSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ZoneOperationClient implements BackgroundResource { + private final ZoneOperationSettings settings; + private final ZoneOperationStub stub; + + /** Constructs an instance of ZoneOperationClient with default settings. */ + public static final ZoneOperationClient create() throws IOException { + return create(ZoneOperationSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ZoneOperationClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final ZoneOperationClient create(ZoneOperationSettings settings) + throws IOException { + return new ZoneOperationClient(settings); + } + + /** + * Constructs an instance of ZoneOperationClient, using the given stub for making calls. This is + * for advanced usage - prefer to use ZoneOperationSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final ZoneOperationClient create(ZoneOperationStub stub) { + return new ZoneOperationClient(stub); + } + + /** + * Constructs an instance of ZoneOperationClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected ZoneOperationClient(ZoneOperationSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ZoneOperationStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected ZoneOperationClient(ZoneOperationStub stub) { + this.settings = null; + this.stub = stub; + } + + public final ZoneOperationSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ZoneOperationStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified zone-specific Operations resource. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
+   *   zoneOperationClient.deleteZoneOperation(operation);
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final void deleteZoneOperation(ProjectZoneOperationName operation) { + + DeleteZoneOperationHttpRequest request = + DeleteZoneOperationHttpRequest.newBuilder() + .setOperation(operation == null ? null : operation.toString()) + .build(); + deleteZoneOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified zone-specific Operations resource. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
+   *   zoneOperationClient.deleteZoneOperation(operation.toString());
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final void deleteZoneOperation(String operation) { + + DeleteZoneOperationHttpRequest request = + DeleteZoneOperationHttpRequest.newBuilder().setOperation(operation).build(); + deleteZoneOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified zone-specific Operations resource. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
+   *   DeleteZoneOperationHttpRequest request = DeleteZoneOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   zoneOperationClient.deleteZoneOperation(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final void deleteZoneOperation(DeleteZoneOperationHttpRequest request) { + deleteZoneOperationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified zone-specific Operations resource. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
+   *   DeleteZoneOperationHttpRequest request = DeleteZoneOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   ApiFuture<Void> future = zoneOperationClient.deleteZoneOperationCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable deleteZoneOperationCallable() { + return stub.deleteZoneOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified zone-specific Operations resource. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
+   *   Operation response = zoneOperationClient.getZoneOperation(operation);
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation getZoneOperation(ProjectZoneOperationName operation) { + + GetZoneOperationHttpRequest request = + GetZoneOperationHttpRequest.newBuilder() + .setOperation(operation == null ? null : operation.toString()) + .build(); + return getZoneOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified zone-specific Operations resource. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
+   *   Operation response = zoneOperationClient.getZoneOperation(operation.toString());
+   * }
+   * 
+ * + * @param operation Name of the Operations resource to return. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation getZoneOperation(String operation) { + + GetZoneOperationHttpRequest request = + GetZoneOperationHttpRequest.newBuilder().setOperation(operation).build(); + return getZoneOperation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified zone-specific Operations resource. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
+   *   GetZoneOperationHttpRequest request = GetZoneOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   Operation response = zoneOperationClient.getZoneOperation(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final Operation getZoneOperation(GetZoneOperationHttpRequest request) { + return getZoneOperationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the specified zone-specific Operations resource. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
+   *   GetZoneOperationHttpRequest request = GetZoneOperationHttpRequest.newBuilder()
+   *     .setOperation(operation.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = zoneOperationClient.getZoneOperationCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable getZoneOperationCallable() { + return stub.getZoneOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified zone. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (Operation element : zoneOperationClient.listZoneOperations(zone).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone Name of the zone for request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListZoneOperationsPagedResponse listZoneOperations(ProjectZoneName zone) { + ListZoneOperationsHttpRequest request = + ListZoneOperationsHttpRequest.newBuilder() + .setZone(zone == null ? null : zone.toString()) + .build(); + return listZoneOperations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified zone. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   for (Operation element : zoneOperationClient.listZoneOperations(zone.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param zone Name of the zone for request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListZoneOperationsPagedResponse listZoneOperations(String zone) { + ListZoneOperationsHttpRequest request = + ListZoneOperationsHttpRequest.newBuilder().setZone(zone).build(); + return listZoneOperations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified zone. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListZoneOperationsHttpRequest request = ListZoneOperationsHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   for (Operation element : zoneOperationClient.listZoneOperations(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi + public final ListZoneOperationsPagedResponse listZoneOperations( + ListZoneOperationsHttpRequest request) { + return listZoneOperationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified zone. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListZoneOperationsHttpRequest request = ListZoneOperationsHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   ApiFuture<ListZoneOperationsPagedResponse> future = zoneOperationClient.listZoneOperationsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Operation element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listZoneOperationsPagedCallable() { + return stub.listZoneOperationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves a list of Operation resources contained within the specified zone. + * + *

Sample code: + * + *


+   * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+   *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+   *   ListZoneOperationsHttpRequest request = ListZoneOperationsHttpRequest.newBuilder()
+   *     .setZone(zone.toString())
+   *     .build();
+   *   while (true) {
+   *     OperationList response = zoneOperationClient.listZoneOperationsCallable().call(request);
+   *     for (Operation element : response.getItemsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + @BetaApi + public final UnaryCallable + listZoneOperationsCallable() { + return stub.listZoneOperationsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListZoneOperationsPagedResponse + extends AbstractPagedListResponse< + ListZoneOperationsHttpRequest, OperationList, Operation, ListZoneOperationsPage, + ListZoneOperationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListZoneOperationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListZoneOperationsPagedResponse apply(ListZoneOperationsPage input) { + return new ListZoneOperationsPagedResponse(input); + } + }); + } + + private ListZoneOperationsPagedResponse(ListZoneOperationsPage page) { + super(page, ListZoneOperationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListZoneOperationsPage + extends AbstractPage< + ListZoneOperationsHttpRequest, OperationList, Operation, ListZoneOperationsPage> { + + private ListZoneOperationsPage( + PageContext context, + OperationList response) { + super(context, response); + } + + private static ListZoneOperationsPage createEmptyPage() { + return new ListZoneOperationsPage(null, null); + } + + @Override + protected ListZoneOperationsPage createPage( + PageContext context, + OperationList response) { + return new ListZoneOperationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListZoneOperationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListZoneOperationsHttpRequest, OperationList, Operation, ListZoneOperationsPage, + ListZoneOperationsFixedSizeCollection> { + + private ListZoneOperationsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListZoneOperationsFixedSizeCollection createEmptyCollection() { + return new ListZoneOperationsFixedSizeCollection(null, 0); + } + + @Override + protected ListZoneOperationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListZoneOperationsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneOperationSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneOperationSettings.java new file mode 100644 index 000000000000..51a063156462 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneOperationSettings.java @@ -0,0 +1,209 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.ZoneOperationClient.ListZoneOperationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.ZoneOperationStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link ZoneOperationClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteZoneOperation to 30 seconds: + * + *

+ * 
+ * ZoneOperationSettings.Builder zoneOperationSettingsBuilder =
+ *     ZoneOperationSettings.newBuilder();
+ * zoneOperationSettingsBuilder.deleteZoneOperationSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * ZoneOperationSettings zoneOperationSettings = zoneOperationSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ZoneOperationSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteZoneOperation. */ + public UnaryCallSettings deleteZoneOperationSettings() { + return ((ZoneOperationStubSettings) getStubSettings()).deleteZoneOperationSettings(); + } + + /** Returns the object with the settings used for calls to getZoneOperation. */ + public UnaryCallSettings getZoneOperationSettings() { + return ((ZoneOperationStubSettings) getStubSettings()).getZoneOperationSettings(); + } + + /** Returns the object with the settings used for calls to listZoneOperations. */ + public PagedCallSettings< + ListZoneOperationsHttpRequest, OperationList, ListZoneOperationsPagedResponse> + listZoneOperationsSettings() { + return ((ZoneOperationStubSettings) getStubSettings()).listZoneOperationsSettings(); + } + + public static final ZoneOperationSettings create(ZoneOperationStubSettings stub) + throws IOException { + return new ZoneOperationSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ZoneOperationStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ZoneOperationStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return ZoneOperationStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ZoneOperationStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ZoneOperationStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ZoneOperationStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ZoneOperationStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ZoneOperationStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ZoneOperationSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ZoneOperationSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(ZoneOperationStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(ZoneOperationStubSettings.newBuilder()); + } + + protected Builder(ZoneOperationSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ZoneOperationStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public ZoneOperationStubSettings.Builder getStubSettingsBuilder() { + return ((ZoneOperationStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to deleteZoneOperation. */ + public UnaryCallSettings.Builder + deleteZoneOperationSettings() { + return getStubSettingsBuilder().deleteZoneOperationSettings(); + } + + /** Returns the builder for the settings used for calls to getZoneOperation. */ + public UnaryCallSettings.Builder + getZoneOperationSettings() { + return getStubSettingsBuilder().getZoneOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listZoneOperations. */ + public PagedCallSettings.Builder< + ListZoneOperationsHttpRequest, OperationList, ListZoneOperationsPagedResponse> + listZoneOperationsSettings() { + return getStubSettingsBuilder().listZoneOperationsSettings(); + } + + @Override + public ZoneOperationSettings build() throws IOException { + return new ZoneOperationSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneSetLabelsRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneSetLabelsRequest.java new file mode 100644 index 000000000000..e2a6f547e87b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneSetLabelsRequest.java @@ -0,0 +1,176 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class ZoneSetLabelsRequest implements ApiMessage { + private final String labelFingerprint; + private final Map labels; + + private ZoneSetLabelsRequest() { + this.labelFingerprint = null; + this.labels = null; + } + + private ZoneSetLabelsRequest(String labelFingerprint, Map labels) { + this.labelFingerprint = labelFingerprint; + this.labels = labels; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("labelFingerprint")) { + return labelFingerprint; + } + if (fieldName.equals("labels")) { + return labels; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Map getLabelsMap() { + return labels; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(ZoneSetLabelsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static ZoneSetLabelsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final ZoneSetLabelsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new ZoneSetLabelsRequest(); + } + + public static class Builder { + private String labelFingerprint; + private Map labels; + + Builder() {} + + public Builder mergeFrom(ZoneSetLabelsRequest other) { + if (other == ZoneSetLabelsRequest.getDefaultInstance()) return this; + if (other.getLabelFingerprint() != null) { + this.labelFingerprint = other.labelFingerprint; + } + if (other.getLabelsMap() != null) { + this.labels = other.labels; + } + return this; + } + + Builder(ZoneSetLabelsRequest source) { + this.labelFingerprint = source.labelFingerprint; + this.labels = source.labels; + } + + public String getLabelFingerprint() { + return labelFingerprint; + } + + public Builder setLabelFingerprint(String labelFingerprint) { + this.labelFingerprint = labelFingerprint; + return this; + } + + public Map getLabelsMap() { + return labels; + } + + public Builder putAllLabels(Map labels) { + this.labels = labels; + return this; + } + + public ZoneSetLabelsRequest build() { + + return new ZoneSetLabelsRequest(labelFingerprint, labels); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setLabelFingerprint(this.labelFingerprint); + newBuilder.putAllLabels(this.labels); + return newBuilder; + } + } + + @Override + public String toString() { + return "ZoneSetLabelsRequest{" + + "labelFingerprint=" + + labelFingerprint + + ", " + + "labels=" + + labels + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ZoneSetLabelsRequest) { + ZoneSetLabelsRequest that = (ZoneSetLabelsRequest) o; + return Objects.equals(this.labelFingerprint, that.getLabelFingerprint()) + && Objects.equals(this.labels, that.getLabelsMap()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(labelFingerprint, labels); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneSettings.java new file mode 100644 index 000000000000..6cf62c470e32 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ZoneSettings.java @@ -0,0 +1,194 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.ZoneClient.ListZonesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.stub.ZoneStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link ZoneClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getZone to 30 seconds: + * + *

+ * 
+ * ZoneSettings.Builder zoneSettingsBuilder =
+ *     ZoneSettings.newBuilder();
+ * zoneSettingsBuilder.getZoneSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * ZoneSettings zoneSettings = zoneSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ZoneSettings extends ClientSettings { + /** Returns the object with the settings used for calls to getZone. */ + public UnaryCallSettings getZoneSettings() { + return ((ZoneStubSettings) getStubSettings()).getZoneSettings(); + } + + /** Returns the object with the settings used for calls to listZones. */ + public PagedCallSettings + listZonesSettings() { + return ((ZoneStubSettings) getStubSettings()).listZonesSettings(); + } + + public static final ZoneSettings create(ZoneStubSettings stub) throws IOException { + return new ZoneSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ZoneStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ZoneStubSettings.getDefaultEndpoint(); + } + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return ZoneStubSettings.getDefaultServicePort(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ZoneStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ZoneStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ZoneStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ZoneStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ZoneStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ZoneSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ZoneSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(ZoneStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(ZoneStubSettings.newBuilder()); + } + + protected Builder(ZoneSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ZoneStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public ZoneStubSettings.Builder getStubSettingsBuilder() { + return ((ZoneStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to getZone. */ + public UnaryCallSettings.Builder getZoneSettings() { + return getStubSettingsBuilder().getZoneSettings(); + } + + /** Returns the builder for the settings used for calls to listZones. */ + public PagedCallSettings.Builder + listZonesSettings() { + return getStubSettingsBuilder().listZonesSettings(); + } + + @Override + public ZoneSettings build() throws IOException { + return new ZoneSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/package-info.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/package-info.java new file mode 100644 index 000000000000..cedd68dfe55b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/package-info.java @@ -0,0 +1,843 @@ +/* + * Copyright 2018 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 + * + * https://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. + */ + +/** + * A client to Compute Engine API. + * + *

The interfaces provided are listed below, along with usage samples. + * + *

===================== AcceleratorTypeClient ===================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for AcceleratorTypeClient: + * + *

+ * 
+ * try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
+ *   ProjectZoneAcceleratorTypeName acceleratorType = ProjectZoneAcceleratorTypeName.of("[PROJECT]", "[ZONE]", "[ACCELERATOR_TYPE]");
+ *   AcceleratorType response = acceleratorTypeClient.getAcceleratorType(acceleratorType);
+ * }
+ * 
+ * 
+ * + * ============= AddressClient ============= + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for AddressClient: + * + *

+ * 
+ * try (AddressClient addressClient = AddressClient.create()) {
+ *   ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
+ *   Operation response = addressClient.deleteAddress(address);
+ * }
+ * 
+ * 
+ * + * ================ AutoscalerClient ================ + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for AutoscalerClient: + * + *

+ * 
+ * try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
+ *   ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
+ *   Operation response = autoscalerClient.deleteAutoscaler(autoscaler);
+ * }
+ * 
+ * 
+ * + * =================== BackendBucketClient =================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for BackendBucketClient: + * + *

+ * 
+ * try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
+ *   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
+ *   Operation response = backendBucketClient.deleteBackendBucket(backendBucket);
+ * }
+ * 
+ * 
+ * + * ==================== BackendServiceClient ==================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for BackendServiceClient: + * + *

+ * 
+ * try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
+ *   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
+ *   Operation response = backendServiceClient.deleteBackendService(backendService);
+ * }
+ * 
+ * 
+ * + * ============== DiskTypeClient ============== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for DiskTypeClient: + * + *

+ * 
+ * try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
+ *   ProjectZoneDiskTypeName diskType = ProjectZoneDiskTypeName.of("[PROJECT]", "[ZONE]", "[DISK_TYPE]");
+ *   DiskType response = diskTypeClient.getDiskType(diskType);
+ * }
+ * 
+ * 
+ * + * ========== DiskClient ========== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for DiskClient: + * + *

+ * 
+ * try (DiskClient diskClient = DiskClient.create()) {
+ *   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
+ *   Boolean guestFlush = false;
+ *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+ *   Operation response = diskClient.createSnapshotDisk(disk, guestFlush, snapshotResource);
+ * }
+ * 
+ * 
+ * + * ============== FirewallClient ============== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for FirewallClient: + * + *

+ * 
+ * try (FirewallClient firewallClient = FirewallClient.create()) {
+ *   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
+ *   Operation response = firewallClient.deleteFirewall(firewall);
+ * }
+ * 
+ * 
+ * + * ==================== ForwardingRuleClient ==================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for ForwardingRuleClient: + * + *

+ * 
+ * try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
+ *   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
+ *   Operation response = forwardingRuleClient.deleteForwardingRule(forwardingRule);
+ * }
+ * 
+ * 
+ * + * =================== GlobalAddressClient =================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for GlobalAddressClient: + * + *

+ * 
+ * try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
+ *   ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
+ *   Operation response = globalAddressClient.deleteGlobalAddress(address);
+ * }
+ * 
+ * 
+ * + * ========================== GlobalForwardingRuleClient ========================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for GlobalForwardingRuleClient: + * + *

+ * 
+ * try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
+ *   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
+ *   Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(forwardingRule);
+ * }
+ * 
+ * 
+ * + * ===================== GlobalOperationClient ===================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for GlobalOperationClient: + * + *

+ * 
+ * try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
+ *   ProjectGlobalOperationName operation = ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]");
+ *   globalOperationClient.deleteGlobalOperation(operation);
+ * }
+ * 
+ * 
+ * + * ================= HealthCheckClient ================= + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for HealthCheckClient: + * + *

+ * 
+ * try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
+ *   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
+ *   Operation response = healthCheckClient.deleteHealthCheck(healthCheck);
+ * }
+ * 
+ * 
+ * + * ===================== HttpHealthCheckClient ===================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for HttpHealthCheckClient: + * + *

+ * 
+ * try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
+ *   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
+ *   Operation response = httpHealthCheckClient.deleteHttpHealthCheck(httpHealthCheck);
+ * }
+ * 
+ * 
+ * + * ====================== HttpsHealthCheckClient ====================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for HttpsHealthCheckClient: + * + *

+ * 
+ * try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
+ *   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
+ *   Operation response = httpsHealthCheckClient.deleteHttpsHealthCheck(httpsHealthCheck);
+ * }
+ * 
+ * 
+ * + * =========== ImageClient =========== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for ImageClient: + * + *

+ * 
+ * try (ImageClient imageClient = ImageClient.create()) {
+ *   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
+ *   Operation response = imageClient.deleteImage(image);
+ * }
+ * 
+ * 
+ * + * ========================== InstanceGroupManagerClient ========================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for InstanceGroupManagerClient: + * + *

+ * 
+ * try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
+ *   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
+ *   InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+ *   Operation response = instanceGroupManagerClient.abandonInstancesInstanceGroupManager(instanceGroupManager, instanceGroupManagersAbandonInstancesRequestResource);
+ * }
+ * 
+ * 
+ * + * =================== InstanceGroupClient =================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for InstanceGroupClient: + * + *

+ * 
+ * try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
+ *   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
+ *   InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource = InstanceGroupsAddInstancesRequest.newBuilder().build();
+ *   Operation response = instanceGroupClient.addInstancesInstanceGroup(instanceGroup, instanceGroupsAddInstancesRequestResource);
+ * }
+ * 
+ * 
+ * + * ====================== InstanceTemplateClient ====================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for InstanceTemplateClient: + * + *

+ * 
+ * try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
+ *   ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
+ *   Operation response = instanceTemplateClient.deleteInstanceTemplate(instanceTemplate);
+ * }
+ * 
+ * 
+ * + * ============== InstanceClient ============== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for InstanceClient: + * + *

+ * 
+ * try (InstanceClient instanceClient = InstanceClient.create()) {
+ *   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
+ *   String networkInterface = "";
+ *   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
+ *   Operation response = instanceClient.addAccessConfigInstance(instance, networkInterface, accessConfigResource);
+ * }
+ * 
+ * 
+ * + * ============================ InterconnectAttachmentClient ============================ + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for InterconnectAttachmentClient: + * + *

+ * 
+ * try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
+ *   ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
+ *   Operation response = interconnectAttachmentClient.deleteInterconnectAttachment(interconnectAttachment);
+ * }
+ * 
+ * 
+ * + * ========================== InterconnectLocationClient ========================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for InterconnectLocationClient: + * + *

+ * 
+ * try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
+ *   ProjectGlobalInterconnectLocationName interconnectLocation = ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]");
+ *   InterconnectLocation response = interconnectLocationClient.getInterconnectLocation(interconnectLocation);
+ * }
+ * 
+ * 
+ * + * ================== InterconnectClient ================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for InterconnectClient: + * + *

+ * 
+ * try (InterconnectClient interconnectClient = InterconnectClient.create()) {
+ *   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
+ *   Operation response = interconnectClient.deleteInterconnect(interconnect);
+ * }
+ * 
+ * 
+ * + * ================= LicenseCodeClient ================= + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for LicenseCodeClient: + * + *

+ * 
+ * try (LicenseCodeClient licenseCodeClient = LicenseCodeClient.create()) {
+ *   ProjectGlobalLicenseCodeName licenseCode = ProjectGlobalLicenseCodeName.of("[PROJECT]", "[LICENSE_CODE]");
+ *   LicenseCode response = licenseCodeClient.getLicenseCode(licenseCode);
+ * }
+ * 
+ * 
+ * + * ============= LicenseClient ============= + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for LicenseClient: + * + *

+ * 
+ * try (LicenseClient licenseClient = LicenseClient.create()) {
+ *   ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]");
+ *   Operation response = licenseClient.deleteLicense(license);
+ * }
+ * 
+ * 
+ * + * ================= MachineTypeClient ================= + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for MachineTypeClient: + * + *

+ * 
+ * try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
+ *   ProjectZoneMachineTypeName machineType = ProjectZoneMachineTypeName.of("[PROJECT]", "[ZONE]", "[MACHINE_TYPE]");
+ *   MachineType response = machineTypeClient.getMachineType(machineType);
+ * }
+ * 
+ * 
+ * + * ============= NetworkClient ============= + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for NetworkClient: + * + *

+ * 
+ * try (NetworkClient networkClient = NetworkClient.create()) {
+ *   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
+ *   NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
+ *   Operation response = networkClient.addPeeringNetwork(network, networksAddPeeringRequestResource);
+ * }
+ * 
+ * 
+ * + * ============= ProjectClient ============= + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for ProjectClient: + * + *

+ * 
+ * try (ProjectClient projectClient = ProjectClient.create()) {
+ *   ProjectName project = ProjectName.of("[PROJECT]");
+ *   Operation response = projectClient.disableXpnHostProject(project);
+ * }
+ * 
+ * 
+ * + * ====================== RegionAutoscalerClient ====================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for RegionAutoscalerClient: + * + *

+ * 
+ * try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
+ *   ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
+ *   Operation response = regionAutoscalerClient.deleteRegionAutoscaler(autoscaler);
+ * }
+ * 
+ * 
+ * + * ========================== RegionBackendServiceClient ========================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for RegionBackendServiceClient: + * + *

+ * 
+ * try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
+ *   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
+ *   Operation response = regionBackendServiceClient.deleteRegionBackendService(backendService);
+ * }
+ * 
+ * 
+ * + * ====================== RegionCommitmentClient ====================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for RegionCommitmentClient: + * + *

+ * 
+ * try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
+ *   ProjectRegionCommitmentName commitment = ProjectRegionCommitmentName.of("[PROJECT]", "[REGION]", "[COMMITMENT]");
+ *   Commitment response = regionCommitmentClient.getRegionCommitment(commitment);
+ * }
+ * 
+ * 
+ * + * ==================== RegionDiskTypeClient ==================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for RegionDiskTypeClient: + * + *

+ * 
+ * try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
+ *   ProjectRegionDiskTypeName diskType = ProjectRegionDiskTypeName.of("[PROJECT]", "[REGION]", "[DISK_TYPE]");
+ *   DiskType response = regionDiskTypeClient.getRegionDiskType(diskType);
+ * }
+ * 
+ * 
+ * + * ================ RegionDiskClient ================ + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for RegionDiskClient: + * + *

+ * 
+ * try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
+ *   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
+ *   Snapshot snapshotResource = Snapshot.newBuilder().build();
+ *   Operation response = regionDiskClient.createSnapshotRegionDisk(disk, snapshotResource);
+ * }
+ * 
+ * 
+ * + * ================================ RegionInstanceGroupManagerClient + * ================================ + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for RegionInstanceGroupManagerClient: + * + *

+ * 
+ * try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
+ *   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
+ *   RegionInstanceGroupManagersAbandonInstancesRequest regionInstanceGroupManagersAbandonInstancesRequestResource = RegionInstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
+ *   Operation response = regionInstanceGroupManagerClient.abandonInstancesRegionInstanceGroupManager(instanceGroupManager, regionInstanceGroupManagersAbandonInstancesRequestResource);
+ * }
+ * 
+ * 
+ * + * ========================= RegionInstanceGroupClient ========================= + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for RegionInstanceGroupClient: + * + *

+ * 
+ * try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
+ *   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
+ *   InstanceGroup response = regionInstanceGroupClient.getRegionInstanceGroup(instanceGroup);
+ * }
+ * 
+ * 
+ * + * ===================== RegionOperationClient ===================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for RegionOperationClient: + * + *

+ * 
+ * try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
+ *   ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
+ *   regionOperationClient.deleteRegionOperation(operation);
+ * }
+ * 
+ * 
+ * + * ============ RegionClient ============ + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for RegionClient: + * + *

+ * 
+ * try (RegionClient regionClient = RegionClient.create()) {
+ *   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
+ *   Region response = regionClient.getRegion(region);
+ * }
+ * 
+ * 
+ * + * ============ RouterClient ============ + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for RouterClient: + * + *

+ * 
+ * try (RouterClient routerClient = RouterClient.create()) {
+ *   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
+ *   Operation response = routerClient.deleteRouter(router);
+ * }
+ * 
+ * 
+ * + * =========== RouteClient =========== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for RouteClient: + * + *

+ * 
+ * try (RouteClient routeClient = RouteClient.create()) {
+ *   ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]");
+ *   Operation response = routeClient.deleteRoute(route);
+ * }
+ * 
+ * 
+ * + * ============== SnapshotClient ============== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for SnapshotClient: + * + *

+ * 
+ * try (SnapshotClient snapshotClient = SnapshotClient.create()) {
+ *   ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+ *   Operation response = snapshotClient.deleteSnapshot(snapshot);
+ * }
+ * 
+ * 
+ * + * ==================== SslCertificateClient ==================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for SslCertificateClient: + * + *

+ * 
+ * try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
+ *   ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
+ *   Operation response = sslCertificateClient.deleteSslCertificate(sslCertificate);
+ * }
+ * 
+ * 
+ * + * =============== SslPolicyClient =============== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for SslPolicyClient: + * + *

+ * 
+ * try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
+ *   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
+ *   Operation response = sslPolicyClient.deleteSslPolicy(sslPolicy);
+ * }
+ * 
+ * 
+ * + * ================ SubnetworkClient ================ + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for SubnetworkClient: + * + *

+ * 
+ * try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
+ *   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
+ *   Operation response = subnetworkClient.deleteSubnetwork(subnetwork);
+ * }
+ * 
+ * 
+ * + * ===================== TargetHttpProxyClient ===================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for TargetHttpProxyClient: + * + *

+ * 
+ * try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
+ *   ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
+ *   Operation response = targetHttpProxyClient.deleteTargetHttpProxy(targetHttpProxy);
+ * }
+ * 
+ * 
+ * + * ====================== TargetHttpsProxyClient ====================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for TargetHttpsProxyClient: + * + *

+ * 
+ * try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
+ *   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
+ *   Operation response = targetHttpsProxyClient.deleteTargetHttpsProxy(targetHttpsProxy);
+ * }
+ * 
+ * 
+ * + * ==================== TargetInstanceClient ==================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for TargetInstanceClient: + * + *

+ * 
+ * try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
+ *   ProjectZoneTargetInstanceName targetInstance = ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]");
+ *   Operation response = targetInstanceClient.deleteTargetInstance(targetInstance);
+ * }
+ * 
+ * 
+ * + * ================ TargetPoolClient ================ + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for TargetPoolClient: + * + *

+ * 
+ * try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
+ *   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
+ *   TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
+ *   Operation response = targetPoolClient.addHealthCheckTargetPool(targetPool, targetPoolsAddHealthCheckRequestResource);
+ * }
+ * 
+ * 
+ * + * ==================== TargetSslProxyClient ==================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for TargetSslProxyClient: + * + *

+ * 
+ * try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
+ *   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
+ *   Operation response = targetSslProxyClient.deleteTargetSslProxy(targetSslProxy);
+ * }
+ * 
+ * 
+ * + * ==================== TargetTcpProxyClient ==================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for TargetTcpProxyClient: + * + *

+ * 
+ * try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
+ *   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
+ *   Operation response = targetTcpProxyClient.deleteTargetTcpProxy(targetTcpProxy);
+ * }
+ * 
+ * 
+ * + * ====================== TargetVpnGatewayClient ====================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for TargetVpnGatewayClient: + * + *

+ * 
+ * try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
+ *   ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
+ *   Operation response = targetVpnGatewayClient.deleteTargetVpnGateway(targetVpnGateway);
+ * }
+ * 
+ * 
+ * + * ============ UrlMapClient ============ + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for UrlMapClient: + * + *

+ * 
+ * try (UrlMapClient urlMapClient = UrlMapClient.create()) {
+ *   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
+ *   Operation response = urlMapClient.deleteUrlMap(urlMap);
+ * }
+ * 
+ * 
+ * + * =============== VpnTunnelClient =============== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for VpnTunnelClient: + * + *

+ * 
+ * try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
+ *   ProjectRegionVpnTunnelName vpnTunnel = ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]");
+ *   Operation response = vpnTunnelClient.deleteVpnTunnel(vpnTunnel);
+ * }
+ * 
+ * 
+ * + * =================== ZoneOperationClient =================== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for ZoneOperationClient: + * + *

+ * 
+ * try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
+ *   ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
+ *   zoneOperationClient.deleteZoneOperation(operation);
+ * }
+ * 
+ * 
+ * + * ========== ZoneClient ========== + * + *

Service Description: Creates and runs virtual machines on Google Cloud Platform. + * + *

Sample for ZoneClient: + * + *

+ * 
+ * try (ZoneClient zoneClient = ZoneClient.create()) {
+ *   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
+ *   Zone response = zoneClient.getZone(zone);
+ * }
+ * 
+ * 
+ */ +package com.google.cloud.compute.v1; diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AcceleratorTypeStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AcceleratorTypeStub.java new file mode 100644 index 000000000000..3fec3f9376cb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AcceleratorTypeStub.java @@ -0,0 +1,77 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.AcceleratorTypeClient.AggregatedListAcceleratorTypesPagedResponse; +import static com.google.cloud.compute.v1.AcceleratorTypeClient.ListAcceleratorTypesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AcceleratorType; +import com.google.cloud.compute.v1.AcceleratorTypeAggregatedList; +import com.google.cloud.compute.v1.AcceleratorTypeList; +import com.google.cloud.compute.v1.AggregatedListAcceleratorTypesHttpRequest; +import com.google.cloud.compute.v1.GetAcceleratorTypeHttpRequest; +import com.google.cloud.compute.v1.ListAcceleratorTypesHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class AcceleratorTypeStub implements BackgroundResource { + + @BetaApi + public UnaryCallable< + AggregatedListAcceleratorTypesHttpRequest, AggregatedListAcceleratorTypesPagedResponse> + aggregatedListAcceleratorTypesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListAcceleratorTypesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListAcceleratorTypesCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListAcceleratorTypesCallable()"); + } + + @BetaApi + public UnaryCallable + getAcceleratorTypeCallable() { + throw new UnsupportedOperationException("Not implemented: getAcceleratorTypeCallable()"); + } + + @BetaApi + public UnaryCallable + listAcceleratorTypesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listAcceleratorTypesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listAcceleratorTypesCallable() { + throw new UnsupportedOperationException("Not implemented: listAcceleratorTypesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AcceleratorTypeStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AcceleratorTypeStubSettings.java new file mode 100644 index 000000000000..d29f00a0a695 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AcceleratorTypeStubSettings.java @@ -0,0 +1,506 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.AcceleratorTypeClient.AggregatedListAcceleratorTypesPagedResponse; +import static com.google.cloud.compute.v1.AcceleratorTypeClient.ListAcceleratorTypesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AcceleratorType; +import com.google.cloud.compute.v1.AcceleratorTypeAggregatedList; +import com.google.cloud.compute.v1.AcceleratorTypeList; +import com.google.cloud.compute.v1.AcceleratorTypesScopedList; +import com.google.cloud.compute.v1.AggregatedListAcceleratorTypesHttpRequest; +import com.google.cloud.compute.v1.GetAcceleratorTypeHttpRequest; +import com.google.cloud.compute.v1.ListAcceleratorTypesHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link AcceleratorTypeStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getAcceleratorType to 30 seconds: + * + *

+ * 
+ * AcceleratorTypeStubSettings.Builder acceleratorTypeSettingsBuilder =
+ *     AcceleratorTypeStubSettings.newBuilder();
+ * acceleratorTypeSettingsBuilder.getAcceleratorTypeSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * AcceleratorTypeStubSettings acceleratorTypeSettings = acceleratorTypeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AcceleratorTypeStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AggregatedListAcceleratorTypesPagedResponse> + aggregatedListAcceleratorTypesSettings; + private final UnaryCallSettings + getAcceleratorTypeSettings; + private final PagedCallSettings< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, ListAcceleratorTypesPagedResponse> + listAcceleratorTypesSettings; + + /** Returns the object with the settings used for calls to aggregatedListAcceleratorTypes. */ + public PagedCallSettings< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AggregatedListAcceleratorTypesPagedResponse> + aggregatedListAcceleratorTypesSettings() { + return aggregatedListAcceleratorTypesSettings; + } + + /** Returns the object with the settings used for calls to getAcceleratorType. */ + public UnaryCallSettings + getAcceleratorTypeSettings() { + return getAcceleratorTypeSettings; + } + + /** Returns the object with the settings used for calls to listAcceleratorTypes. */ + public PagedCallSettings< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, ListAcceleratorTypesPagedResponse> + listAcceleratorTypesSettings() { + return listAcceleratorTypesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AcceleratorTypeStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonAcceleratorTypeStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(AcceleratorTypeStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected AcceleratorTypeStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListAcceleratorTypesSettings = + settingsBuilder.aggregatedListAcceleratorTypesSettings().build(); + getAcceleratorTypeSettings = settingsBuilder.getAcceleratorTypeSettings().build(); + listAcceleratorTypesSettings = settingsBuilder.listAcceleratorTypesSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AcceleratorTypesScopedList> + AGGREGATED_LIST_ACCELERATOR_TYPES_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AcceleratorTypesScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListAcceleratorTypesHttpRequest injectToken( + AggregatedListAcceleratorTypesHttpRequest payload, String token) { + return AggregatedListAcceleratorTypesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListAcceleratorTypesHttpRequest injectPageSize( + AggregatedListAcceleratorTypesHttpRequest payload, int pageSize) { + return AggregatedListAcceleratorTypesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListAcceleratorTypesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(AcceleratorTypeAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + AcceleratorTypeAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, AcceleratorType> + LIST_ACCELERATOR_TYPES_PAGE_STR_DESC = + new PagedListDescriptor< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, AcceleratorType>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListAcceleratorTypesHttpRequest injectToken( + ListAcceleratorTypesHttpRequest payload, String token) { + return ListAcceleratorTypesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListAcceleratorTypesHttpRequest injectPageSize( + ListAcceleratorTypesHttpRequest payload, int pageSize) { + return ListAcceleratorTypesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListAcceleratorTypesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(AcceleratorTypeList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(AcceleratorTypeList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AggregatedListAcceleratorTypesPagedResponse> + AGGREGATED_LIST_ACCELERATOR_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AggregatedListAcceleratorTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList> + callable, + AggregatedListAcceleratorTypesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AcceleratorTypesScopedList> + pageContext = + PageContext.create( + callable, + AGGREGATED_LIST_ACCELERATOR_TYPES_PAGE_STR_DESC, + request, + context); + return AggregatedListAcceleratorTypesPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, ListAcceleratorTypesPagedResponse> + LIST_ACCELERATOR_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, + ListAcceleratorTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListAcceleratorTypesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_ACCELERATOR_TYPES_PAGE_STR_DESC, request, context); + return ListAcceleratorTypesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for AcceleratorTypeStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AggregatedListAcceleratorTypesPagedResponse> + aggregatedListAcceleratorTypesSettings; + private final UnaryCallSettings.Builder + getAcceleratorTypeSettings; + private final PagedCallSettings.Builder< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, ListAcceleratorTypesPagedResponse> + listAcceleratorTypesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListAcceleratorTypesSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_ACCELERATOR_TYPES_PAGE_STR_FACT); + + getAcceleratorTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listAcceleratorTypesSettings = + PagedCallSettings.newBuilder(LIST_ACCELERATOR_TYPES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListAcceleratorTypesSettings, + getAcceleratorTypeSettings, + listAcceleratorTypesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListAcceleratorTypesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getAcceleratorTypeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listAcceleratorTypesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(AcceleratorTypeStubSettings settings) { + super(settings); + + aggregatedListAcceleratorTypesSettings = + settings.aggregatedListAcceleratorTypesSettings.toBuilder(); + getAcceleratorTypeSettings = settings.getAcceleratorTypeSettings.toBuilder(); + listAcceleratorTypesSettings = settings.listAcceleratorTypesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListAcceleratorTypesSettings, + getAcceleratorTypeSettings, + listAcceleratorTypesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListAcceleratorTypes. */ + public PagedCallSettings.Builder< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList, + AggregatedListAcceleratorTypesPagedResponse> + aggregatedListAcceleratorTypesSettings() { + return aggregatedListAcceleratorTypesSettings; + } + + /** Returns the builder for the settings used for calls to getAcceleratorType. */ + public UnaryCallSettings.Builder + getAcceleratorTypeSettings() { + return getAcceleratorTypeSettings; + } + + /** Returns the builder for the settings used for calls to listAcceleratorTypes. */ + public PagedCallSettings.Builder< + ListAcceleratorTypesHttpRequest, AcceleratorTypeList, ListAcceleratorTypesPagedResponse> + listAcceleratorTypesSettings() { + return listAcceleratorTypesSettings; + } + + @Override + public AcceleratorTypeStubSettings build() throws IOException { + return new AcceleratorTypeStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AddressStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AddressStub.java new file mode 100644 index 000000000000..3142103f7467 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AddressStub.java @@ -0,0 +1,86 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.AddressClient.AggregatedListAddressesPagedResponse; +import static com.google.cloud.compute.v1.AddressClient.ListAddressesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.Address; +import com.google.cloud.compute.v1.AddressAggregatedList; +import com.google.cloud.compute.v1.AddressList; +import com.google.cloud.compute.v1.AggregatedListAddressesHttpRequest; +import com.google.cloud.compute.v1.DeleteAddressHttpRequest; +import com.google.cloud.compute.v1.GetAddressHttpRequest; +import com.google.cloud.compute.v1.InsertAddressHttpRequest; +import com.google.cloud.compute.v1.ListAddressesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class AddressStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + aggregatedListAddressesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListAddressesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListAddressesCallable() { + throw new UnsupportedOperationException("Not implemented: aggregatedListAddressesCallable()"); + } + + @BetaApi + public UnaryCallable deleteAddressCallable() { + throw new UnsupportedOperationException("Not implemented: deleteAddressCallable()"); + } + + @BetaApi + public UnaryCallable getAddressCallable() { + throw new UnsupportedOperationException("Not implemented: getAddressCallable()"); + } + + @BetaApi + public UnaryCallable insertAddressCallable() { + throw new UnsupportedOperationException("Not implemented: insertAddressCallable()"); + } + + @BetaApi + public UnaryCallable + listAddressesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listAddressesPagedCallable()"); + } + + @BetaApi + public UnaryCallable listAddressesCallable() { + throw new UnsupportedOperationException("Not implemented: listAddressesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AddressStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AddressStubSettings.java new file mode 100644 index 000000000000..e733e46cbb4f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AddressStubSettings.java @@ -0,0 +1,529 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.AddressClient.AggregatedListAddressesPagedResponse; +import static com.google.cloud.compute.v1.AddressClient.ListAddressesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.Address; +import com.google.cloud.compute.v1.AddressAggregatedList; +import com.google.cloud.compute.v1.AddressList; +import com.google.cloud.compute.v1.AddressesScopedList; +import com.google.cloud.compute.v1.AggregatedListAddressesHttpRequest; +import com.google.cloud.compute.v1.DeleteAddressHttpRequest; +import com.google.cloud.compute.v1.GetAddressHttpRequest; +import com.google.cloud.compute.v1.InsertAddressHttpRequest; +import com.google.cloud.compute.v1.ListAddressesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link AddressStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteAddress to 30 seconds: + * + *

+ * 
+ * AddressStubSettings.Builder addressSettingsBuilder =
+ *     AddressStubSettings.newBuilder();
+ * addressSettingsBuilder.deleteAddressSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * AddressStubSettings addressSettings = addressSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AddressStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListAddressesHttpRequest, AddressAggregatedList, + AggregatedListAddressesPagedResponse> + aggregatedListAddressesSettings; + private final UnaryCallSettings deleteAddressSettings; + private final UnaryCallSettings getAddressSettings; + private final UnaryCallSettings insertAddressSettings; + private final PagedCallSettings + listAddressesSettings; + + /** Returns the object with the settings used for calls to aggregatedListAddresses. */ + public PagedCallSettings< + AggregatedListAddressesHttpRequest, AddressAggregatedList, + AggregatedListAddressesPagedResponse> + aggregatedListAddressesSettings() { + return aggregatedListAddressesSettings; + } + + /** Returns the object with the settings used for calls to deleteAddress. */ + public UnaryCallSettings deleteAddressSettings() { + return deleteAddressSettings; + } + + /** Returns the object with the settings used for calls to getAddress. */ + public UnaryCallSettings getAddressSettings() { + return getAddressSettings; + } + + /** Returns the object with the settings used for calls to insertAddress. */ + public UnaryCallSettings insertAddressSettings() { + return insertAddressSettings; + } + + /** Returns the object with the settings used for calls to listAddresses. */ + public PagedCallSettings + listAddressesSettings() { + return listAddressesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AddressStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonAddressStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(AddressStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected AddressStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListAddressesSettings = settingsBuilder.aggregatedListAddressesSettings().build(); + deleteAddressSettings = settingsBuilder.deleteAddressSettings().build(); + getAddressSettings = settingsBuilder.getAddressSettings().build(); + insertAddressSettings = settingsBuilder.insertAddressSettings().build(); + listAddressesSettings = settingsBuilder.listAddressesSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListAddressesHttpRequest, AddressAggregatedList, AddressesScopedList> + AGGREGATED_LIST_ADDRESSES_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListAddressesHttpRequest, AddressAggregatedList, AddressesScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListAddressesHttpRequest injectToken( + AggregatedListAddressesHttpRequest payload, String token) { + return AggregatedListAddressesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListAddressesHttpRequest injectPageSize( + AggregatedListAddressesHttpRequest payload, int pageSize) { + return AggregatedListAddressesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListAddressesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(AddressAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(AddressAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor + LIST_ADDRESSES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListAddressesHttpRequest injectToken( + ListAddressesHttpRequest payload, String token) { + return ListAddressesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListAddressesHttpRequest injectPageSize( + ListAddressesHttpRequest payload, int pageSize) { + return ListAddressesHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListAddressesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(AddressList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable
extractResources(AddressList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListAddressesHttpRequest, AddressAggregatedList, + AggregatedListAddressesPagedResponse> + AGGREGATED_LIST_ADDRESSES_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListAddressesHttpRequest, AddressAggregatedList, + AggregatedListAddressesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + AggregatedListAddressesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListAddressesHttpRequest, AddressAggregatedList, + AddressesScopedList> + pageContext = + PageContext.create( + callable, AGGREGATED_LIST_ADDRESSES_PAGE_STR_DESC, request, context); + return AggregatedListAddressesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListAddressesHttpRequest, AddressList, ListAddressesPagedResponse> + LIST_ADDRESSES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListAddressesHttpRequest, AddressList, ListAddressesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListAddressesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_ADDRESSES_PAGE_STR_DESC, request, context); + return ListAddressesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for AddressStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListAddressesHttpRequest, AddressAggregatedList, + AggregatedListAddressesPagedResponse> + aggregatedListAddressesSettings; + private final UnaryCallSettings.Builder + deleteAddressSettings; + private final UnaryCallSettings.Builder getAddressSettings; + private final UnaryCallSettings.Builder + insertAddressSettings; + private final PagedCallSettings.Builder< + ListAddressesHttpRequest, AddressList, ListAddressesPagedResponse> + listAddressesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListAddressesSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_ADDRESSES_PAGE_STR_FACT); + + deleteAddressSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getAddressSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertAddressSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listAddressesSettings = PagedCallSettings.newBuilder(LIST_ADDRESSES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListAddressesSettings, + deleteAddressSettings, + getAddressSettings, + insertAddressSettings, + listAddressesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListAddressesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteAddressSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getAddressSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertAddressSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listAddressesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(AddressStubSettings settings) { + super(settings); + + aggregatedListAddressesSettings = settings.aggregatedListAddressesSettings.toBuilder(); + deleteAddressSettings = settings.deleteAddressSettings.toBuilder(); + getAddressSettings = settings.getAddressSettings.toBuilder(); + insertAddressSettings = settings.insertAddressSettings.toBuilder(); + listAddressesSettings = settings.listAddressesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListAddressesSettings, + deleteAddressSettings, + getAddressSettings, + insertAddressSettings, + listAddressesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListAddresses. */ + public PagedCallSettings.Builder< + AggregatedListAddressesHttpRequest, AddressAggregatedList, + AggregatedListAddressesPagedResponse> + aggregatedListAddressesSettings() { + return aggregatedListAddressesSettings; + } + + /** Returns the builder for the settings used for calls to deleteAddress. */ + public UnaryCallSettings.Builder deleteAddressSettings() { + return deleteAddressSettings; + } + + /** Returns the builder for the settings used for calls to getAddress. */ + public UnaryCallSettings.Builder getAddressSettings() { + return getAddressSettings; + } + + /** Returns the builder for the settings used for calls to insertAddress. */ + public UnaryCallSettings.Builder insertAddressSettings() { + return insertAddressSettings; + } + + /** Returns the builder for the settings used for calls to listAddresses. */ + public PagedCallSettings.Builder< + ListAddressesHttpRequest, AddressList, ListAddressesPagedResponse> + listAddressesSettings() { + return listAddressesSettings; + } + + @Override + public AddressStubSettings build() throws IOException { + return new AddressStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AutoscalerStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AutoscalerStub.java new file mode 100644 index 000000000000..7b2c3317a099 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AutoscalerStub.java @@ -0,0 +1,98 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.AutoscalerClient.AggregatedListAutoscalersPagedResponse; +import static com.google.cloud.compute.v1.AutoscalerClient.ListAutoscalersPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListAutoscalersHttpRequest; +import com.google.cloud.compute.v1.Autoscaler; +import com.google.cloud.compute.v1.AutoscalerAggregatedList; +import com.google.cloud.compute.v1.AutoscalerList; +import com.google.cloud.compute.v1.DeleteAutoscalerHttpRequest; +import com.google.cloud.compute.v1.GetAutoscalerHttpRequest; +import com.google.cloud.compute.v1.InsertAutoscalerHttpRequest; +import com.google.cloud.compute.v1.ListAutoscalersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchAutoscalerHttpRequest; +import com.google.cloud.compute.v1.UpdateAutoscalerHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class AutoscalerStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + aggregatedListAutoscalersPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListAutoscalersPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListAutoscalersCallable() { + throw new UnsupportedOperationException("Not implemented: aggregatedListAutoscalersCallable()"); + } + + @BetaApi + public UnaryCallable deleteAutoscalerCallable() { + throw new UnsupportedOperationException("Not implemented: deleteAutoscalerCallable()"); + } + + @BetaApi + public UnaryCallable getAutoscalerCallable() { + throw new UnsupportedOperationException("Not implemented: getAutoscalerCallable()"); + } + + @BetaApi + public UnaryCallable insertAutoscalerCallable() { + throw new UnsupportedOperationException("Not implemented: insertAutoscalerCallable()"); + } + + @BetaApi + public UnaryCallable + listAutoscalersPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listAutoscalersPagedCallable()"); + } + + @BetaApi + public UnaryCallable listAutoscalersCallable() { + throw new UnsupportedOperationException("Not implemented: listAutoscalersCallable()"); + } + + @BetaApi + public UnaryCallable patchAutoscalerCallable() { + throw new UnsupportedOperationException("Not implemented: patchAutoscalerCallable()"); + } + + @BetaApi + public UnaryCallable updateAutoscalerCallable() { + throw new UnsupportedOperationException("Not implemented: updateAutoscalerCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AutoscalerStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AutoscalerStubSettings.java new file mode 100644 index 000000000000..4b0798f46bb4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/AutoscalerStubSettings.java @@ -0,0 +1,590 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.AutoscalerClient.AggregatedListAutoscalersPagedResponse; +import static com.google.cloud.compute.v1.AutoscalerClient.ListAutoscalersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListAutoscalersHttpRequest; +import com.google.cloud.compute.v1.Autoscaler; +import com.google.cloud.compute.v1.AutoscalerAggregatedList; +import com.google.cloud.compute.v1.AutoscalerList; +import com.google.cloud.compute.v1.AutoscalersScopedList; +import com.google.cloud.compute.v1.DeleteAutoscalerHttpRequest; +import com.google.cloud.compute.v1.GetAutoscalerHttpRequest; +import com.google.cloud.compute.v1.InsertAutoscalerHttpRequest; +import com.google.cloud.compute.v1.ListAutoscalersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchAutoscalerHttpRequest; +import com.google.cloud.compute.v1.UpdateAutoscalerHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link AutoscalerStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteAutoscaler to 30 seconds: + * + *

+ * 
+ * AutoscalerStubSettings.Builder autoscalerSettingsBuilder =
+ *     AutoscalerStubSettings.newBuilder();
+ * autoscalerSettingsBuilder.deleteAutoscalerSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * AutoscalerStubSettings autoscalerSettings = autoscalerSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AutoscalerStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AggregatedListAutoscalersPagedResponse> + aggregatedListAutoscalersSettings; + private final UnaryCallSettings deleteAutoscalerSettings; + private final UnaryCallSettings getAutoscalerSettings; + private final UnaryCallSettings insertAutoscalerSettings; + private final PagedCallSettings< + ListAutoscalersHttpRequest, AutoscalerList, ListAutoscalersPagedResponse> + listAutoscalersSettings; + private final UnaryCallSettings patchAutoscalerSettings; + private final UnaryCallSettings updateAutoscalerSettings; + + /** Returns the object with the settings used for calls to aggregatedListAutoscalers. */ + public PagedCallSettings< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AggregatedListAutoscalersPagedResponse> + aggregatedListAutoscalersSettings() { + return aggregatedListAutoscalersSettings; + } + + /** Returns the object with the settings used for calls to deleteAutoscaler. */ + public UnaryCallSettings deleteAutoscalerSettings() { + return deleteAutoscalerSettings; + } + + /** Returns the object with the settings used for calls to getAutoscaler. */ + public UnaryCallSettings getAutoscalerSettings() { + return getAutoscalerSettings; + } + + /** Returns the object with the settings used for calls to insertAutoscaler. */ + public UnaryCallSettings insertAutoscalerSettings() { + return insertAutoscalerSettings; + } + + /** Returns the object with the settings used for calls to listAutoscalers. */ + public PagedCallSettings + listAutoscalersSettings() { + return listAutoscalersSettings; + } + + /** Returns the object with the settings used for calls to patchAutoscaler. */ + public UnaryCallSettings patchAutoscalerSettings() { + return patchAutoscalerSettings; + } + + /** Returns the object with the settings used for calls to updateAutoscaler. */ + public UnaryCallSettings updateAutoscalerSettings() { + return updateAutoscalerSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AutoscalerStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonAutoscalerStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(AutoscalerStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected AutoscalerStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListAutoscalersSettings = settingsBuilder.aggregatedListAutoscalersSettings().build(); + deleteAutoscalerSettings = settingsBuilder.deleteAutoscalerSettings().build(); + getAutoscalerSettings = settingsBuilder.getAutoscalerSettings().build(); + insertAutoscalerSettings = settingsBuilder.insertAutoscalerSettings().build(); + listAutoscalersSettings = settingsBuilder.listAutoscalersSettings().build(); + patchAutoscalerSettings = settingsBuilder.patchAutoscalerSettings().build(); + updateAutoscalerSettings = settingsBuilder.updateAutoscalerSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, AutoscalersScopedList> + AGGREGATED_LIST_AUTOSCALERS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AutoscalersScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListAutoscalersHttpRequest injectToken( + AggregatedListAutoscalersHttpRequest payload, String token) { + return AggregatedListAutoscalersHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListAutoscalersHttpRequest injectPageSize( + AggregatedListAutoscalersHttpRequest payload, int pageSize) { + return AggregatedListAutoscalersHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListAutoscalersHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(AutoscalerAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + AutoscalerAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor + LIST_AUTOSCALERS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListAutoscalersHttpRequest injectToken( + ListAutoscalersHttpRequest payload, String token) { + return ListAutoscalersHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListAutoscalersHttpRequest injectPageSize( + ListAutoscalersHttpRequest payload, int pageSize) { + return ListAutoscalersHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListAutoscalersHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(AutoscalerList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(AutoscalerList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AggregatedListAutoscalersPagedResponse> + AGGREGATED_LIST_AUTOSCALERS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AggregatedListAutoscalersPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + AggregatedListAutoscalersHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AutoscalersScopedList> + pageContext = + PageContext.create( + callable, AGGREGATED_LIST_AUTOSCALERS_PAGE_STR_DESC, request, context); + return AggregatedListAutoscalersPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListAutoscalersHttpRequest, AutoscalerList, ListAutoscalersPagedResponse> + LIST_AUTOSCALERS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListAutoscalersHttpRequest, AutoscalerList, ListAutoscalersPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListAutoscalersHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_AUTOSCALERS_PAGE_STR_DESC, request, context); + return ListAutoscalersPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for AutoscalerStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AggregatedListAutoscalersPagedResponse> + aggregatedListAutoscalersSettings; + private final UnaryCallSettings.Builder + deleteAutoscalerSettings; + private final UnaryCallSettings.Builder + getAutoscalerSettings; + private final UnaryCallSettings.Builder + insertAutoscalerSettings; + private final PagedCallSettings.Builder< + ListAutoscalersHttpRequest, AutoscalerList, ListAutoscalersPagedResponse> + listAutoscalersSettings; + private final UnaryCallSettings.Builder + patchAutoscalerSettings; + private final UnaryCallSettings.Builder + updateAutoscalerSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListAutoscalersSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_AUTOSCALERS_PAGE_STR_FACT); + + deleteAutoscalerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getAutoscalerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertAutoscalerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listAutoscalersSettings = PagedCallSettings.newBuilder(LIST_AUTOSCALERS_PAGE_STR_FACT); + + patchAutoscalerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateAutoscalerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListAutoscalersSettings, + deleteAutoscalerSettings, + getAutoscalerSettings, + insertAutoscalerSettings, + listAutoscalersSettings, + patchAutoscalerSettings, + updateAutoscalerSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListAutoscalersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteAutoscalerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getAutoscalerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertAutoscalerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listAutoscalersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchAutoscalerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateAutoscalerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(AutoscalerStubSettings settings) { + super(settings); + + aggregatedListAutoscalersSettings = settings.aggregatedListAutoscalersSettings.toBuilder(); + deleteAutoscalerSettings = settings.deleteAutoscalerSettings.toBuilder(); + getAutoscalerSettings = settings.getAutoscalerSettings.toBuilder(); + insertAutoscalerSettings = settings.insertAutoscalerSettings.toBuilder(); + listAutoscalersSettings = settings.listAutoscalersSettings.toBuilder(); + patchAutoscalerSettings = settings.patchAutoscalerSettings.toBuilder(); + updateAutoscalerSettings = settings.updateAutoscalerSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListAutoscalersSettings, + deleteAutoscalerSettings, + getAutoscalerSettings, + insertAutoscalerSettings, + listAutoscalersSettings, + patchAutoscalerSettings, + updateAutoscalerSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListAutoscalers. */ + public PagedCallSettings.Builder< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList, + AggregatedListAutoscalersPagedResponse> + aggregatedListAutoscalersSettings() { + return aggregatedListAutoscalersSettings; + } + + /** Returns the builder for the settings used for calls to deleteAutoscaler. */ + public UnaryCallSettings.Builder + deleteAutoscalerSettings() { + return deleteAutoscalerSettings; + } + + /** Returns the builder for the settings used for calls to getAutoscaler. */ + public UnaryCallSettings.Builder getAutoscalerSettings() { + return getAutoscalerSettings; + } + + /** Returns the builder for the settings used for calls to insertAutoscaler. */ + public UnaryCallSettings.Builder + insertAutoscalerSettings() { + return insertAutoscalerSettings; + } + + /** Returns the builder for the settings used for calls to listAutoscalers. */ + public PagedCallSettings.Builder< + ListAutoscalersHttpRequest, AutoscalerList, ListAutoscalersPagedResponse> + listAutoscalersSettings() { + return listAutoscalersSettings; + } + + /** Returns the builder for the settings used for calls to patchAutoscaler. */ + public UnaryCallSettings.Builder + patchAutoscalerSettings() { + return patchAutoscalerSettings; + } + + /** Returns the builder for the settings used for calls to updateAutoscaler. */ + public UnaryCallSettings.Builder + updateAutoscalerSettings() { + return updateAutoscalerSettings; + } + + @Override + public AutoscalerStubSettings build() throws IOException { + return new AutoscalerStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendBucketStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendBucketStub.java new file mode 100644 index 000000000000..589bc03b6725 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendBucketStub.java @@ -0,0 +1,83 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.BackendBucketClient.ListBackendBucketsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.BackendBucket; +import com.google.cloud.compute.v1.BackendBucketList; +import com.google.cloud.compute.v1.DeleteBackendBucketHttpRequest; +import com.google.cloud.compute.v1.GetBackendBucketHttpRequest; +import com.google.cloud.compute.v1.InsertBackendBucketHttpRequest; +import com.google.cloud.compute.v1.ListBackendBucketsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchBackendBucketHttpRequest; +import com.google.cloud.compute.v1.UpdateBackendBucketHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class BackendBucketStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteBackendBucketCallable() { + throw new UnsupportedOperationException("Not implemented: deleteBackendBucketCallable()"); + } + + @BetaApi + public UnaryCallable getBackendBucketCallable() { + throw new UnsupportedOperationException("Not implemented: getBackendBucketCallable()"); + } + + @BetaApi + public UnaryCallable insertBackendBucketCallable() { + throw new UnsupportedOperationException("Not implemented: insertBackendBucketCallable()"); + } + + @BetaApi + public UnaryCallable + listBackendBucketsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listBackendBucketsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listBackendBucketsCallable() { + throw new UnsupportedOperationException("Not implemented: listBackendBucketsCallable()"); + } + + @BetaApi + public UnaryCallable patchBackendBucketCallable() { + throw new UnsupportedOperationException("Not implemented: patchBackendBucketCallable()"); + } + + @BetaApi + public UnaryCallable updateBackendBucketCallable() { + throw new UnsupportedOperationException("Not implemented: updateBackendBucketCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendBucketStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendBucketStubSettings.java new file mode 100644 index 000000000000..7933614ffc9c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendBucketStubSettings.java @@ -0,0 +1,497 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.BackendBucketClient.ListBackendBucketsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.BackendBucket; +import com.google.cloud.compute.v1.BackendBucketList; +import com.google.cloud.compute.v1.DeleteBackendBucketHttpRequest; +import com.google.cloud.compute.v1.GetBackendBucketHttpRequest; +import com.google.cloud.compute.v1.InsertBackendBucketHttpRequest; +import com.google.cloud.compute.v1.ListBackendBucketsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchBackendBucketHttpRequest; +import com.google.cloud.compute.v1.UpdateBackendBucketHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link BackendBucketStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteBackendBucket to 30 seconds: + * + *

+ * 
+ * BackendBucketStubSettings.Builder backendBucketSettingsBuilder =
+ *     BackendBucketStubSettings.newBuilder();
+ * backendBucketSettingsBuilder.deleteBackendBucketSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * BackendBucketStubSettings backendBucketSettings = backendBucketSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BackendBucketStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteBackendBucketSettings; + private final UnaryCallSettings + getBackendBucketSettings; + private final UnaryCallSettings + insertBackendBucketSettings; + private final PagedCallSettings< + ListBackendBucketsHttpRequest, BackendBucketList, ListBackendBucketsPagedResponse> + listBackendBucketsSettings; + private final UnaryCallSettings + patchBackendBucketSettings; + private final UnaryCallSettings + updateBackendBucketSettings; + + /** Returns the object with the settings used for calls to deleteBackendBucket. */ + public UnaryCallSettings + deleteBackendBucketSettings() { + return deleteBackendBucketSettings; + } + + /** Returns the object with the settings used for calls to getBackendBucket. */ + public UnaryCallSettings getBackendBucketSettings() { + return getBackendBucketSettings; + } + + /** Returns the object with the settings used for calls to insertBackendBucket. */ + public UnaryCallSettings + insertBackendBucketSettings() { + return insertBackendBucketSettings; + } + + /** Returns the object with the settings used for calls to listBackendBuckets. */ + public PagedCallSettings< + ListBackendBucketsHttpRequest, BackendBucketList, ListBackendBucketsPagedResponse> + listBackendBucketsSettings() { + return listBackendBucketsSettings; + } + + /** Returns the object with the settings used for calls to patchBackendBucket. */ + public UnaryCallSettings patchBackendBucketSettings() { + return patchBackendBucketSettings; + } + + /** Returns the object with the settings used for calls to updateBackendBucket. */ + public UnaryCallSettings + updateBackendBucketSettings() { + return updateBackendBucketSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public BackendBucketStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonBackendBucketStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(BackendBucketStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected BackendBucketStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteBackendBucketSettings = settingsBuilder.deleteBackendBucketSettings().build(); + getBackendBucketSettings = settingsBuilder.getBackendBucketSettings().build(); + insertBackendBucketSettings = settingsBuilder.insertBackendBucketSettings().build(); + listBackendBucketsSettings = settingsBuilder.listBackendBucketsSettings().build(); + patchBackendBucketSettings = settingsBuilder.patchBackendBucketSettings().build(); + updateBackendBucketSettings = settingsBuilder.updateBackendBucketSettings().build(); + } + + private static final PagedListDescriptor< + ListBackendBucketsHttpRequest, BackendBucketList, BackendBucket> + LIST_BACKEND_BUCKETS_PAGE_STR_DESC = + new PagedListDescriptor< + ListBackendBucketsHttpRequest, BackendBucketList, BackendBucket>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListBackendBucketsHttpRequest injectToken( + ListBackendBucketsHttpRequest payload, String token) { + return ListBackendBucketsHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListBackendBucketsHttpRequest injectPageSize( + ListBackendBucketsHttpRequest payload, int pageSize) { + return ListBackendBucketsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListBackendBucketsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(BackendBucketList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(BackendBucketList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListBackendBucketsHttpRequest, BackendBucketList, ListBackendBucketsPagedResponse> + LIST_BACKEND_BUCKETS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListBackendBucketsHttpRequest, BackendBucketList, ListBackendBucketsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListBackendBucketsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_BACKEND_BUCKETS_PAGE_STR_DESC, request, context); + return ListBackendBucketsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for BackendBucketStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteBackendBucketSettings; + private final UnaryCallSettings.Builder + getBackendBucketSettings; + private final UnaryCallSettings.Builder + insertBackendBucketSettings; + private final PagedCallSettings.Builder< + ListBackendBucketsHttpRequest, BackendBucketList, ListBackendBucketsPagedResponse> + listBackendBucketsSettings; + private final UnaryCallSettings.Builder + patchBackendBucketSettings; + private final UnaryCallSettings.Builder + updateBackendBucketSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteBackendBucketSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getBackendBucketSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertBackendBucketSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listBackendBucketsSettings = PagedCallSettings.newBuilder(LIST_BACKEND_BUCKETS_PAGE_STR_FACT); + + patchBackendBucketSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateBackendBucketSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteBackendBucketSettings, + getBackendBucketSettings, + insertBackendBucketSettings, + listBackendBucketsSettings, + patchBackendBucketSettings, + updateBackendBucketSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteBackendBucketSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getBackendBucketSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertBackendBucketSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listBackendBucketsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchBackendBucketSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateBackendBucketSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(BackendBucketStubSettings settings) { + super(settings); + + deleteBackendBucketSettings = settings.deleteBackendBucketSettings.toBuilder(); + getBackendBucketSettings = settings.getBackendBucketSettings.toBuilder(); + insertBackendBucketSettings = settings.insertBackendBucketSettings.toBuilder(); + listBackendBucketsSettings = settings.listBackendBucketsSettings.toBuilder(); + patchBackendBucketSettings = settings.patchBackendBucketSettings.toBuilder(); + updateBackendBucketSettings = settings.updateBackendBucketSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteBackendBucketSettings, + getBackendBucketSettings, + insertBackendBucketSettings, + listBackendBucketsSettings, + patchBackendBucketSettings, + updateBackendBucketSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteBackendBucket. */ + public UnaryCallSettings.Builder + deleteBackendBucketSettings() { + return deleteBackendBucketSettings; + } + + /** Returns the builder for the settings used for calls to getBackendBucket. */ + public UnaryCallSettings.Builder + getBackendBucketSettings() { + return getBackendBucketSettings; + } + + /** Returns the builder for the settings used for calls to insertBackendBucket. */ + public UnaryCallSettings.Builder + insertBackendBucketSettings() { + return insertBackendBucketSettings; + } + + /** Returns the builder for the settings used for calls to listBackendBuckets. */ + public PagedCallSettings.Builder< + ListBackendBucketsHttpRequest, BackendBucketList, ListBackendBucketsPagedResponse> + listBackendBucketsSettings() { + return listBackendBucketsSettings; + } + + /** Returns the builder for the settings used for calls to patchBackendBucket. */ + public UnaryCallSettings.Builder + patchBackendBucketSettings() { + return patchBackendBucketSettings; + } + + /** Returns the builder for the settings used for calls to updateBackendBucket. */ + public UnaryCallSettings.Builder + updateBackendBucketSettings() { + return updateBackendBucketSettings; + } + + @Override + public BackendBucketStubSettings build() throws IOException { + return new BackendBucketStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendServiceStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendServiceStub.java new file mode 100644 index 000000000000..fd60cc3a4a8d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendServiceStub.java @@ -0,0 +1,109 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.BackendServiceClient.AggregatedListBackendServicesPagedResponse; +import static com.google.cloud.compute.v1.BackendServiceClient.ListBackendServicesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListBackendServicesHttpRequest; +import com.google.cloud.compute.v1.BackendService; +import com.google.cloud.compute.v1.BackendServiceAggregatedList; +import com.google.cloud.compute.v1.BackendServiceGroupHealth; +import com.google.cloud.compute.v1.BackendServiceList; +import com.google.cloud.compute.v1.DeleteBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetHealthBackendServiceHttpRequest; +import com.google.cloud.compute.v1.InsertBackendServiceHttpRequest; +import com.google.cloud.compute.v1.ListBackendServicesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchBackendServiceHttpRequest; +import com.google.cloud.compute.v1.UpdateBackendServiceHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class BackendServiceStub implements BackgroundResource { + + @BetaApi + public UnaryCallable< + AggregatedListBackendServicesHttpRequest, AggregatedListBackendServicesPagedResponse> + aggregatedListBackendServicesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListBackendServicesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListBackendServicesCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListBackendServicesCallable()"); + } + + @BetaApi + public UnaryCallable deleteBackendServiceCallable() { + throw new UnsupportedOperationException("Not implemented: deleteBackendServiceCallable()"); + } + + @BetaApi + public UnaryCallable getBackendServiceCallable() { + throw new UnsupportedOperationException("Not implemented: getBackendServiceCallable()"); + } + + @BetaApi + public UnaryCallable + getHealthBackendServiceCallable() { + throw new UnsupportedOperationException("Not implemented: getHealthBackendServiceCallable()"); + } + + @BetaApi + public UnaryCallable insertBackendServiceCallable() { + throw new UnsupportedOperationException("Not implemented: insertBackendServiceCallable()"); + } + + @BetaApi + public UnaryCallable + listBackendServicesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listBackendServicesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listBackendServicesCallable() { + throw new UnsupportedOperationException("Not implemented: listBackendServicesCallable()"); + } + + @BetaApi + public UnaryCallable patchBackendServiceCallable() { + throw new UnsupportedOperationException("Not implemented: patchBackendServiceCallable()"); + } + + @BetaApi + public UnaryCallable updateBackendServiceCallable() { + throw new UnsupportedOperationException("Not implemented: updateBackendServiceCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendServiceStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendServiceStubSettings.java new file mode 100644 index 000000000000..e479c4723140 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/BackendServiceStubSettings.java @@ -0,0 +1,647 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.BackendServiceClient.AggregatedListBackendServicesPagedResponse; +import static com.google.cloud.compute.v1.BackendServiceClient.ListBackendServicesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListBackendServicesHttpRequest; +import com.google.cloud.compute.v1.BackendService; +import com.google.cloud.compute.v1.BackendServiceAggregatedList; +import com.google.cloud.compute.v1.BackendServiceGroupHealth; +import com.google.cloud.compute.v1.BackendServiceList; +import com.google.cloud.compute.v1.BackendServicesScopedList; +import com.google.cloud.compute.v1.DeleteBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetHealthBackendServiceHttpRequest; +import com.google.cloud.compute.v1.InsertBackendServiceHttpRequest; +import com.google.cloud.compute.v1.ListBackendServicesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchBackendServiceHttpRequest; +import com.google.cloud.compute.v1.UpdateBackendServiceHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link BackendServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteBackendService to 30 seconds: + * + *

+ * 
+ * BackendServiceStubSettings.Builder backendServiceSettingsBuilder =
+ *     BackendServiceStubSettings.newBuilder();
+ * backendServiceSettingsBuilder.deleteBackendServiceSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * BackendServiceStubSettings backendServiceSettings = backendServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BackendServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + AggregatedListBackendServicesPagedResponse> + aggregatedListBackendServicesSettings; + private final UnaryCallSettings + deleteBackendServiceSettings; + private final UnaryCallSettings + getBackendServiceSettings; + private final UnaryCallSettings + getHealthBackendServiceSettings; + private final UnaryCallSettings + insertBackendServiceSettings; + private final PagedCallSettings< + ListBackendServicesHttpRequest, BackendServiceList, ListBackendServicesPagedResponse> + listBackendServicesSettings; + private final UnaryCallSettings + patchBackendServiceSettings; + private final UnaryCallSettings + updateBackendServiceSettings; + + /** Returns the object with the settings used for calls to aggregatedListBackendServices. */ + public PagedCallSettings< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + AggregatedListBackendServicesPagedResponse> + aggregatedListBackendServicesSettings() { + return aggregatedListBackendServicesSettings; + } + + /** Returns the object with the settings used for calls to deleteBackendService. */ + public UnaryCallSettings + deleteBackendServiceSettings() { + return deleteBackendServiceSettings; + } + + /** Returns the object with the settings used for calls to getBackendService. */ + public UnaryCallSettings + getBackendServiceSettings() { + return getBackendServiceSettings; + } + + /** Returns the object with the settings used for calls to getHealthBackendService. */ + public UnaryCallSettings + getHealthBackendServiceSettings() { + return getHealthBackendServiceSettings; + } + + /** Returns the object with the settings used for calls to insertBackendService. */ + public UnaryCallSettings + insertBackendServiceSettings() { + return insertBackendServiceSettings; + } + + /** Returns the object with the settings used for calls to listBackendServices. */ + public PagedCallSettings< + ListBackendServicesHttpRequest, BackendServiceList, ListBackendServicesPagedResponse> + listBackendServicesSettings() { + return listBackendServicesSettings; + } + + /** Returns the object with the settings used for calls to patchBackendService. */ + public UnaryCallSettings + patchBackendServiceSettings() { + return patchBackendServiceSettings; + } + + /** Returns the object with the settings used for calls to updateBackendService. */ + public UnaryCallSettings + updateBackendServiceSettings() { + return updateBackendServiceSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public BackendServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonBackendServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(BackendServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected BackendServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListBackendServicesSettings = + settingsBuilder.aggregatedListBackendServicesSettings().build(); + deleteBackendServiceSettings = settingsBuilder.deleteBackendServiceSettings().build(); + getBackendServiceSettings = settingsBuilder.getBackendServiceSettings().build(); + getHealthBackendServiceSettings = settingsBuilder.getHealthBackendServiceSettings().build(); + insertBackendServiceSettings = settingsBuilder.insertBackendServiceSettings().build(); + listBackendServicesSettings = settingsBuilder.listBackendServicesSettings().build(); + patchBackendServiceSettings = settingsBuilder.patchBackendServiceSettings().build(); + updateBackendServiceSettings = settingsBuilder.updateBackendServiceSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + BackendServicesScopedList> + AGGREGATED_LIST_BACKEND_SERVICES_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + BackendServicesScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListBackendServicesHttpRequest injectToken( + AggregatedListBackendServicesHttpRequest payload, String token) { + return AggregatedListBackendServicesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListBackendServicesHttpRequest injectPageSize( + AggregatedListBackendServicesHttpRequest payload, int pageSize) { + return AggregatedListBackendServicesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListBackendServicesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(BackendServiceAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + BackendServiceAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor< + ListBackendServicesHttpRequest, BackendServiceList, BackendService> + LIST_BACKEND_SERVICES_PAGE_STR_DESC = + new PagedListDescriptor< + ListBackendServicesHttpRequest, BackendServiceList, BackendService>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListBackendServicesHttpRequest injectToken( + ListBackendServicesHttpRequest payload, String token) { + return ListBackendServicesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListBackendServicesHttpRequest injectPageSize( + ListBackendServicesHttpRequest payload, int pageSize) { + return ListBackendServicesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListBackendServicesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(BackendServiceList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(BackendServiceList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + AggregatedListBackendServicesPagedResponse> + AGGREGATED_LIST_BACKEND_SERVICES_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + AggregatedListBackendServicesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList> + callable, + AggregatedListBackendServicesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + BackendServicesScopedList> + pageContext = + PageContext.create( + callable, + AGGREGATED_LIST_BACKEND_SERVICES_PAGE_STR_DESC, + request, + context); + return AggregatedListBackendServicesPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListBackendServicesHttpRequest, BackendServiceList, ListBackendServicesPagedResponse> + LIST_BACKEND_SERVICES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListBackendServicesHttpRequest, BackendServiceList, + ListBackendServicesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListBackendServicesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_BACKEND_SERVICES_PAGE_STR_DESC, request, context); + return ListBackendServicesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for BackendServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + AggregatedListBackendServicesPagedResponse> + aggregatedListBackendServicesSettings; + private final UnaryCallSettings.Builder + deleteBackendServiceSettings; + private final UnaryCallSettings.Builder + getBackendServiceSettings; + private final UnaryCallSettings.Builder< + GetHealthBackendServiceHttpRequest, BackendServiceGroupHealth> + getHealthBackendServiceSettings; + private final UnaryCallSettings.Builder + insertBackendServiceSettings; + private final PagedCallSettings.Builder< + ListBackendServicesHttpRequest, BackendServiceList, ListBackendServicesPagedResponse> + listBackendServicesSettings; + private final UnaryCallSettings.Builder + patchBackendServiceSettings; + private final UnaryCallSettings.Builder + updateBackendServiceSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListBackendServicesSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_BACKEND_SERVICES_PAGE_STR_FACT); + + deleteBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getHealthBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listBackendServicesSettings = + PagedCallSettings.newBuilder(LIST_BACKEND_SERVICES_PAGE_STR_FACT); + + patchBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListBackendServicesSettings, + deleteBackendServiceSettings, + getBackendServiceSettings, + getHealthBackendServiceSettings, + insertBackendServiceSettings, + listBackendServicesSettings, + patchBackendServiceSettings, + updateBackendServiceSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListBackendServicesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getHealthBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listBackendServicesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(BackendServiceStubSettings settings) { + super(settings); + + aggregatedListBackendServicesSettings = + settings.aggregatedListBackendServicesSettings.toBuilder(); + deleteBackendServiceSettings = settings.deleteBackendServiceSettings.toBuilder(); + getBackendServiceSettings = settings.getBackendServiceSettings.toBuilder(); + getHealthBackendServiceSettings = settings.getHealthBackendServiceSettings.toBuilder(); + insertBackendServiceSettings = settings.insertBackendServiceSettings.toBuilder(); + listBackendServicesSettings = settings.listBackendServicesSettings.toBuilder(); + patchBackendServiceSettings = settings.patchBackendServiceSettings.toBuilder(); + updateBackendServiceSettings = settings.updateBackendServiceSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListBackendServicesSettings, + deleteBackendServiceSettings, + getBackendServiceSettings, + getHealthBackendServiceSettings, + insertBackendServiceSettings, + listBackendServicesSettings, + patchBackendServiceSettings, + updateBackendServiceSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListBackendServices. */ + public PagedCallSettings.Builder< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList, + AggregatedListBackendServicesPagedResponse> + aggregatedListBackendServicesSettings() { + return aggregatedListBackendServicesSettings; + } + + /** Returns the builder for the settings used for calls to deleteBackendService. */ + public UnaryCallSettings.Builder + deleteBackendServiceSettings() { + return deleteBackendServiceSettings; + } + + /** Returns the builder for the settings used for calls to getBackendService. */ + public UnaryCallSettings.Builder + getBackendServiceSettings() { + return getBackendServiceSettings; + } + + /** Returns the builder for the settings used for calls to getHealthBackendService. */ + public UnaryCallSettings.Builder + getHealthBackendServiceSettings() { + return getHealthBackendServiceSettings; + } + + /** Returns the builder for the settings used for calls to insertBackendService. */ + public UnaryCallSettings.Builder + insertBackendServiceSettings() { + return insertBackendServiceSettings; + } + + /** Returns the builder for the settings used for calls to listBackendServices. */ + public PagedCallSettings.Builder< + ListBackendServicesHttpRequest, BackendServiceList, ListBackendServicesPagedResponse> + listBackendServicesSettings() { + return listBackendServicesSettings; + } + + /** Returns the builder for the settings used for calls to patchBackendService. */ + public UnaryCallSettings.Builder + patchBackendServiceSettings() { + return patchBackendServiceSettings; + } + + /** Returns the builder for the settings used for calls to updateBackendService. */ + public UnaryCallSettings.Builder + updateBackendServiceSettings() { + return updateBackendServiceSettings; + } + + @Override + public BackendServiceStubSettings build() throws IOException { + return new BackendServiceStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskStub.java new file mode 100644 index 000000000000..77912923a901 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskStub.java @@ -0,0 +1,102 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.DiskClient.AggregatedListDisksPagedResponse; +import static com.google.cloud.compute.v1.DiskClient.ListDisksPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListDisksHttpRequest; +import com.google.cloud.compute.v1.CreateSnapshotDiskHttpRequest; +import com.google.cloud.compute.v1.DeleteDiskHttpRequest; +import com.google.cloud.compute.v1.Disk; +import com.google.cloud.compute.v1.DiskAggregatedList; +import com.google.cloud.compute.v1.DiskList; +import com.google.cloud.compute.v1.GetDiskHttpRequest; +import com.google.cloud.compute.v1.InsertDiskHttpRequest; +import com.google.cloud.compute.v1.ListDisksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ResizeDiskHttpRequest; +import com.google.cloud.compute.v1.SetLabelsDiskHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class DiskStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + aggregatedListDisksPagedCallable() { + throw new UnsupportedOperationException("Not implemented: aggregatedListDisksPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListDisksCallable() { + throw new UnsupportedOperationException("Not implemented: aggregatedListDisksCallable()"); + } + + @BetaApi + public UnaryCallable createSnapshotDiskCallable() { + throw new UnsupportedOperationException("Not implemented: createSnapshotDiskCallable()"); + } + + @BetaApi + public UnaryCallable deleteDiskCallable() { + throw new UnsupportedOperationException("Not implemented: deleteDiskCallable()"); + } + + @BetaApi + public UnaryCallable getDiskCallable() { + throw new UnsupportedOperationException("Not implemented: getDiskCallable()"); + } + + @BetaApi + public UnaryCallable insertDiskCallable() { + throw new UnsupportedOperationException("Not implemented: insertDiskCallable()"); + } + + @BetaApi + public UnaryCallable listDisksPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listDisksPagedCallable()"); + } + + @BetaApi + public UnaryCallable listDisksCallable() { + throw new UnsupportedOperationException("Not implemented: listDisksCallable()"); + } + + @BetaApi + public UnaryCallable resizeDiskCallable() { + throw new UnsupportedOperationException("Not implemented: resizeDiskCallable()"); + } + + @BetaApi + public UnaryCallable setLabelsDiskCallable() { + throw new UnsupportedOperationException("Not implemented: setLabelsDiskCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskStubSettings.java new file mode 100644 index 000000000000..fb9537e6e517 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskStubSettings.java @@ -0,0 +1,589 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.DiskClient.AggregatedListDisksPagedResponse; +import static com.google.cloud.compute.v1.DiskClient.ListDisksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListDisksHttpRequest; +import com.google.cloud.compute.v1.CreateSnapshotDiskHttpRequest; +import com.google.cloud.compute.v1.DeleteDiskHttpRequest; +import com.google.cloud.compute.v1.Disk; +import com.google.cloud.compute.v1.DiskAggregatedList; +import com.google.cloud.compute.v1.DiskList; +import com.google.cloud.compute.v1.DisksScopedList; +import com.google.cloud.compute.v1.GetDiskHttpRequest; +import com.google.cloud.compute.v1.InsertDiskHttpRequest; +import com.google.cloud.compute.v1.ListDisksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ResizeDiskHttpRequest; +import com.google.cloud.compute.v1.SetLabelsDiskHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link DiskStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of createSnapshotDisk to 30 seconds: + * + *

+ * 
+ * DiskStubSettings.Builder diskSettingsBuilder =
+ *     DiskStubSettings.newBuilder();
+ * diskSettingsBuilder.createSnapshotDiskSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * DiskStubSettings diskSettings = diskSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DiskStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListDisksHttpRequest, DiskAggregatedList, AggregatedListDisksPagedResponse> + aggregatedListDisksSettings; + private final UnaryCallSettings + createSnapshotDiskSettings; + private final UnaryCallSettings deleteDiskSettings; + private final UnaryCallSettings getDiskSettings; + private final UnaryCallSettings insertDiskSettings; + private final PagedCallSettings + listDisksSettings; + private final UnaryCallSettings resizeDiskSettings; + private final UnaryCallSettings setLabelsDiskSettings; + + /** Returns the object with the settings used for calls to aggregatedListDisks. */ + public PagedCallSettings< + AggregatedListDisksHttpRequest, DiskAggregatedList, AggregatedListDisksPagedResponse> + aggregatedListDisksSettings() { + return aggregatedListDisksSettings; + } + + /** Returns the object with the settings used for calls to createSnapshotDisk. */ + public UnaryCallSettings createSnapshotDiskSettings() { + return createSnapshotDiskSettings; + } + + /** Returns the object with the settings used for calls to deleteDisk. */ + public UnaryCallSettings deleteDiskSettings() { + return deleteDiskSettings; + } + + /** Returns the object with the settings used for calls to getDisk. */ + public UnaryCallSettings getDiskSettings() { + return getDiskSettings; + } + + /** Returns the object with the settings used for calls to insertDisk. */ + public UnaryCallSettings insertDiskSettings() { + return insertDiskSettings; + } + + /** Returns the object with the settings used for calls to listDisks. */ + public PagedCallSettings + listDisksSettings() { + return listDisksSettings; + } + + /** Returns the object with the settings used for calls to resizeDisk. */ + public UnaryCallSettings resizeDiskSettings() { + return resizeDiskSettings; + } + + /** Returns the object with the settings used for calls to setLabelsDisk. */ + public UnaryCallSettings setLabelsDiskSettings() { + return setLabelsDiskSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public DiskStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDiskStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(DiskStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected DiskStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListDisksSettings = settingsBuilder.aggregatedListDisksSettings().build(); + createSnapshotDiskSettings = settingsBuilder.createSnapshotDiskSettings().build(); + deleteDiskSettings = settingsBuilder.deleteDiskSettings().build(); + getDiskSettings = settingsBuilder.getDiskSettings().build(); + insertDiskSettings = settingsBuilder.insertDiskSettings().build(); + listDisksSettings = settingsBuilder.listDisksSettings().build(); + resizeDiskSettings = settingsBuilder.resizeDiskSettings().build(); + setLabelsDiskSettings = settingsBuilder.setLabelsDiskSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListDisksHttpRequest, DiskAggregatedList, DisksScopedList> + AGGREGATED_LIST_DISKS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListDisksHttpRequest, DiskAggregatedList, DisksScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListDisksHttpRequest injectToken( + AggregatedListDisksHttpRequest payload, String token) { + return AggregatedListDisksHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public AggregatedListDisksHttpRequest injectPageSize( + AggregatedListDisksHttpRequest payload, int pageSize) { + return AggregatedListDisksHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListDisksHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(DiskAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(DiskAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor + LIST_DISKS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListDisksHttpRequest injectToken(ListDisksHttpRequest payload, String token) { + return ListDisksHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListDisksHttpRequest injectPageSize(ListDisksHttpRequest payload, int pageSize) { + return ListDisksHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListDisksHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(DiskList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(DiskList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListDisksHttpRequest, DiskAggregatedList, AggregatedListDisksPagedResponse> + AGGREGATED_LIST_DISKS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListDisksHttpRequest, DiskAggregatedList, + AggregatedListDisksPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + AggregatedListDisksHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, AGGREGATED_LIST_DISKS_PAGE_STR_DESC, request, context); + return AggregatedListDisksPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListDisksHttpRequest, DiskList, ListDisksPagedResponse> + LIST_DISKS_PAGE_STR_FACT = + new PagedListResponseFactory() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListDisksHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_DISKS_PAGE_STR_DESC, request, context); + return ListDisksPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for DiskStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListDisksHttpRequest, DiskAggregatedList, AggregatedListDisksPagedResponse> + aggregatedListDisksSettings; + private final UnaryCallSettings.Builder + createSnapshotDiskSettings; + private final UnaryCallSettings.Builder deleteDiskSettings; + private final UnaryCallSettings.Builder getDiskSettings; + private final UnaryCallSettings.Builder insertDiskSettings; + private final PagedCallSettings.Builder + listDisksSettings; + private final UnaryCallSettings.Builder resizeDiskSettings; + private final UnaryCallSettings.Builder + setLabelsDiskSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListDisksSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_DISKS_PAGE_STR_FACT); + + createSnapshotDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listDisksSettings = PagedCallSettings.newBuilder(LIST_DISKS_PAGE_STR_FACT); + + resizeDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setLabelsDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListDisksSettings, + createSnapshotDiskSettings, + deleteDiskSettings, + getDiskSettings, + insertDiskSettings, + listDisksSettings, + resizeDiskSettings, + setLabelsDiskSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListDisksSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createSnapshotDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listDisksSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .resizeDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setLabelsDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(DiskStubSettings settings) { + super(settings); + + aggregatedListDisksSettings = settings.aggregatedListDisksSettings.toBuilder(); + createSnapshotDiskSettings = settings.createSnapshotDiskSettings.toBuilder(); + deleteDiskSettings = settings.deleteDiskSettings.toBuilder(); + getDiskSettings = settings.getDiskSettings.toBuilder(); + insertDiskSettings = settings.insertDiskSettings.toBuilder(); + listDisksSettings = settings.listDisksSettings.toBuilder(); + resizeDiskSettings = settings.resizeDiskSettings.toBuilder(); + setLabelsDiskSettings = settings.setLabelsDiskSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListDisksSettings, + createSnapshotDiskSettings, + deleteDiskSettings, + getDiskSettings, + insertDiskSettings, + listDisksSettings, + resizeDiskSettings, + setLabelsDiskSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListDisks. */ + public PagedCallSettings.Builder< + AggregatedListDisksHttpRequest, DiskAggregatedList, AggregatedListDisksPagedResponse> + aggregatedListDisksSettings() { + return aggregatedListDisksSettings; + } + + /** Returns the builder for the settings used for calls to createSnapshotDisk. */ + public UnaryCallSettings.Builder + createSnapshotDiskSettings() { + return createSnapshotDiskSettings; + } + + /** Returns the builder for the settings used for calls to deleteDisk. */ + public UnaryCallSettings.Builder deleteDiskSettings() { + return deleteDiskSettings; + } + + /** Returns the builder for the settings used for calls to getDisk. */ + public UnaryCallSettings.Builder getDiskSettings() { + return getDiskSettings; + } + + /** Returns the builder for the settings used for calls to insertDisk. */ + public UnaryCallSettings.Builder insertDiskSettings() { + return insertDiskSettings; + } + + /** Returns the builder for the settings used for calls to listDisks. */ + public PagedCallSettings.Builder + listDisksSettings() { + return listDisksSettings; + } + + /** Returns the builder for the settings used for calls to resizeDisk. */ + public UnaryCallSettings.Builder resizeDiskSettings() { + return resizeDiskSettings; + } + + /** Returns the builder for the settings used for calls to setLabelsDisk. */ + public UnaryCallSettings.Builder setLabelsDiskSettings() { + return setLabelsDiskSettings; + } + + @Override + public DiskStubSettings build() throws IOException { + return new DiskStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskTypeStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskTypeStub.java new file mode 100644 index 000000000000..fa2cee066b32 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskTypeStub.java @@ -0,0 +1,73 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.DiskTypeClient.AggregatedListDiskTypesPagedResponse; +import static com.google.cloud.compute.v1.DiskTypeClient.ListDiskTypesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListDiskTypesHttpRequest; +import com.google.cloud.compute.v1.DiskType; +import com.google.cloud.compute.v1.DiskTypeAggregatedList; +import com.google.cloud.compute.v1.DiskTypeList; +import com.google.cloud.compute.v1.GetDiskTypeHttpRequest; +import com.google.cloud.compute.v1.ListDiskTypesHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class DiskTypeStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + aggregatedListDiskTypesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListDiskTypesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListDiskTypesCallable() { + throw new UnsupportedOperationException("Not implemented: aggregatedListDiskTypesCallable()"); + } + + @BetaApi + public UnaryCallable getDiskTypeCallable() { + throw new UnsupportedOperationException("Not implemented: getDiskTypeCallable()"); + } + + @BetaApi + public UnaryCallable + listDiskTypesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listDiskTypesPagedCallable()"); + } + + @BetaApi + public UnaryCallable listDiskTypesCallable() { + throw new UnsupportedOperationException("Not implemented: listDiskTypesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskTypeStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskTypeStubSettings.java new file mode 100644 index 000000000000..8cd7818f1c6e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/DiskTypeStubSettings.java @@ -0,0 +1,475 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.DiskTypeClient.AggregatedListDiskTypesPagedResponse; +import static com.google.cloud.compute.v1.DiskTypeClient.ListDiskTypesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListDiskTypesHttpRequest; +import com.google.cloud.compute.v1.DiskType; +import com.google.cloud.compute.v1.DiskTypeAggregatedList; +import com.google.cloud.compute.v1.DiskTypeList; +import com.google.cloud.compute.v1.DiskTypesScopedList; +import com.google.cloud.compute.v1.GetDiskTypeHttpRequest; +import com.google.cloud.compute.v1.ListDiskTypesHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link DiskTypeStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getDiskType to 30 seconds: + * + *

+ * 
+ * DiskTypeStubSettings.Builder diskTypeSettingsBuilder =
+ *     DiskTypeStubSettings.newBuilder();
+ * diskTypeSettingsBuilder.getDiskTypeSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * DiskTypeStubSettings diskTypeSettings = diskTypeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DiskTypeStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, + AggregatedListDiskTypesPagedResponse> + aggregatedListDiskTypesSettings; + private final UnaryCallSettings getDiskTypeSettings; + private final PagedCallSettings< + ListDiskTypesHttpRequest, DiskTypeList, ListDiskTypesPagedResponse> + listDiskTypesSettings; + + /** Returns the object with the settings used for calls to aggregatedListDiskTypes. */ + public PagedCallSettings< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, + AggregatedListDiskTypesPagedResponse> + aggregatedListDiskTypesSettings() { + return aggregatedListDiskTypesSettings; + } + + /** Returns the object with the settings used for calls to getDiskType. */ + public UnaryCallSettings getDiskTypeSettings() { + return getDiskTypeSettings; + } + + /** Returns the object with the settings used for calls to listDiskTypes. */ + public PagedCallSettings + listDiskTypesSettings() { + return listDiskTypesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public DiskTypeStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDiskTypeStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(DiskTypeStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected DiskTypeStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListDiskTypesSettings = settingsBuilder.aggregatedListDiskTypesSettings().build(); + getDiskTypeSettings = settingsBuilder.getDiskTypeSettings().build(); + listDiskTypesSettings = settingsBuilder.listDiskTypesSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, DiskTypesScopedList> + AGGREGATED_LIST_DISK_TYPES_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, DiskTypesScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListDiskTypesHttpRequest injectToken( + AggregatedListDiskTypesHttpRequest payload, String token) { + return AggregatedListDiskTypesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListDiskTypesHttpRequest injectPageSize( + AggregatedListDiskTypesHttpRequest payload, int pageSize) { + return AggregatedListDiskTypesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListDiskTypesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(DiskTypeAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(DiskTypeAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor + LIST_DISK_TYPES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListDiskTypesHttpRequest injectToken( + ListDiskTypesHttpRequest payload, String token) { + return ListDiskTypesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListDiskTypesHttpRequest injectPageSize( + ListDiskTypesHttpRequest payload, int pageSize) { + return ListDiskTypesHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListDiskTypesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(DiskTypeList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(DiskTypeList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, + AggregatedListDiskTypesPagedResponse> + AGGREGATED_LIST_DISK_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, + AggregatedListDiskTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + AggregatedListDiskTypesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, + DiskTypesScopedList> + pageContext = + PageContext.create( + callable, AGGREGATED_LIST_DISK_TYPES_PAGE_STR_DESC, request, context); + return AggregatedListDiskTypesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListDiskTypesHttpRequest, DiskTypeList, ListDiskTypesPagedResponse> + LIST_DISK_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListDiskTypesHttpRequest, DiskTypeList, ListDiskTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListDiskTypesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_DISK_TYPES_PAGE_STR_DESC, request, context); + return ListDiskTypesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for DiskTypeStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, + AggregatedListDiskTypesPagedResponse> + aggregatedListDiskTypesSettings; + private final UnaryCallSettings.Builder getDiskTypeSettings; + private final PagedCallSettings.Builder< + ListDiskTypesHttpRequest, DiskTypeList, ListDiskTypesPagedResponse> + listDiskTypesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListDiskTypesSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_DISK_TYPES_PAGE_STR_FACT); + + getDiskTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listDiskTypesSettings = PagedCallSettings.newBuilder(LIST_DISK_TYPES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListDiskTypesSettings, getDiskTypeSettings, listDiskTypesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListDiskTypesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getDiskTypeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listDiskTypesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(DiskTypeStubSettings settings) { + super(settings); + + aggregatedListDiskTypesSettings = settings.aggregatedListDiskTypesSettings.toBuilder(); + getDiskTypeSettings = settings.getDiskTypeSettings.toBuilder(); + listDiskTypesSettings = settings.listDiskTypesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListDiskTypesSettings, getDiskTypeSettings, listDiskTypesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListDiskTypes. */ + public PagedCallSettings.Builder< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList, + AggregatedListDiskTypesPagedResponse> + aggregatedListDiskTypesSettings() { + return aggregatedListDiskTypesSettings; + } + + /** Returns the builder for the settings used for calls to getDiskType. */ + public UnaryCallSettings.Builder getDiskTypeSettings() { + return getDiskTypeSettings; + } + + /** Returns the builder for the settings used for calls to listDiskTypes. */ + public PagedCallSettings.Builder< + ListDiskTypesHttpRequest, DiskTypeList, ListDiskTypesPagedResponse> + listDiskTypesSettings() { + return listDiskTypesSettings; + } + + @Override + public DiskTypeStubSettings build() throws IOException { + return new DiskTypeStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/FirewallStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/FirewallStub.java new file mode 100644 index 000000000000..2341273aea62 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/FirewallStub.java @@ -0,0 +1,82 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.FirewallClient.ListFirewallsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteFirewallHttpRequest; +import com.google.cloud.compute.v1.Firewall; +import com.google.cloud.compute.v1.FirewallList; +import com.google.cloud.compute.v1.GetFirewallHttpRequest; +import com.google.cloud.compute.v1.InsertFirewallHttpRequest; +import com.google.cloud.compute.v1.ListFirewallsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchFirewallHttpRequest; +import com.google.cloud.compute.v1.UpdateFirewallHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class FirewallStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteFirewallCallable() { + throw new UnsupportedOperationException("Not implemented: deleteFirewallCallable()"); + } + + @BetaApi + public UnaryCallable getFirewallCallable() { + throw new UnsupportedOperationException("Not implemented: getFirewallCallable()"); + } + + @BetaApi + public UnaryCallable insertFirewallCallable() { + throw new UnsupportedOperationException("Not implemented: insertFirewallCallable()"); + } + + @BetaApi + public UnaryCallable + listFirewallsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listFirewallsPagedCallable()"); + } + + @BetaApi + public UnaryCallable listFirewallsCallable() { + throw new UnsupportedOperationException("Not implemented: listFirewallsCallable()"); + } + + @BetaApi + public UnaryCallable patchFirewallCallable() { + throw new UnsupportedOperationException("Not implemented: patchFirewallCallable()"); + } + + @BetaApi + public UnaryCallable updateFirewallCallable() { + throw new UnsupportedOperationException("Not implemented: updateFirewallCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/FirewallStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/FirewallStubSettings.java new file mode 100644 index 000000000000..9e7af23a14f8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/FirewallStubSettings.java @@ -0,0 +1,478 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.FirewallClient.ListFirewallsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteFirewallHttpRequest; +import com.google.cloud.compute.v1.Firewall; +import com.google.cloud.compute.v1.FirewallList; +import com.google.cloud.compute.v1.GetFirewallHttpRequest; +import com.google.cloud.compute.v1.InsertFirewallHttpRequest; +import com.google.cloud.compute.v1.ListFirewallsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchFirewallHttpRequest; +import com.google.cloud.compute.v1.UpdateFirewallHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link FirewallStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteFirewall to 30 seconds: + * + *

+ * 
+ * FirewallStubSettings.Builder firewallSettingsBuilder =
+ *     FirewallStubSettings.newBuilder();
+ * firewallSettingsBuilder.deleteFirewallSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * FirewallStubSettings firewallSettings = firewallSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class FirewallStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings deleteFirewallSettings; + private final UnaryCallSettings getFirewallSettings; + private final UnaryCallSettings insertFirewallSettings; + private final PagedCallSettings< + ListFirewallsHttpRequest, FirewallList, ListFirewallsPagedResponse> + listFirewallsSettings; + private final UnaryCallSettings patchFirewallSettings; + private final UnaryCallSettings updateFirewallSettings; + + /** Returns the object with the settings used for calls to deleteFirewall. */ + public UnaryCallSettings deleteFirewallSettings() { + return deleteFirewallSettings; + } + + /** Returns the object with the settings used for calls to getFirewall. */ + public UnaryCallSettings getFirewallSettings() { + return getFirewallSettings; + } + + /** Returns the object with the settings used for calls to insertFirewall. */ + public UnaryCallSettings insertFirewallSettings() { + return insertFirewallSettings; + } + + /** Returns the object with the settings used for calls to listFirewalls. */ + public PagedCallSettings + listFirewallsSettings() { + return listFirewallsSettings; + } + + /** Returns the object with the settings used for calls to patchFirewall. */ + public UnaryCallSettings patchFirewallSettings() { + return patchFirewallSettings; + } + + /** Returns the object with the settings used for calls to updateFirewall. */ + public UnaryCallSettings updateFirewallSettings() { + return updateFirewallSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public FirewallStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonFirewallStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(FirewallStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected FirewallStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteFirewallSettings = settingsBuilder.deleteFirewallSettings().build(); + getFirewallSettings = settingsBuilder.getFirewallSettings().build(); + insertFirewallSettings = settingsBuilder.insertFirewallSettings().build(); + listFirewallsSettings = settingsBuilder.listFirewallsSettings().build(); + patchFirewallSettings = settingsBuilder.patchFirewallSettings().build(); + updateFirewallSettings = settingsBuilder.updateFirewallSettings().build(); + } + + private static final PagedListDescriptor + LIST_FIREWALLS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListFirewallsHttpRequest injectToken( + ListFirewallsHttpRequest payload, String token) { + return ListFirewallsHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListFirewallsHttpRequest injectPageSize( + ListFirewallsHttpRequest payload, int pageSize) { + return ListFirewallsHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListFirewallsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(FirewallList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(FirewallList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListFirewallsHttpRequest, FirewallList, ListFirewallsPagedResponse> + LIST_FIREWALLS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListFirewallsHttpRequest, FirewallList, ListFirewallsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListFirewallsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_FIREWALLS_PAGE_STR_DESC, request, context); + return ListFirewallsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for FirewallStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteFirewallSettings; + private final UnaryCallSettings.Builder getFirewallSettings; + private final UnaryCallSettings.Builder + insertFirewallSettings; + private final PagedCallSettings.Builder< + ListFirewallsHttpRequest, FirewallList, ListFirewallsPagedResponse> + listFirewallsSettings; + private final UnaryCallSettings.Builder + patchFirewallSettings; + private final UnaryCallSettings.Builder + updateFirewallSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteFirewallSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getFirewallSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertFirewallSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listFirewallsSettings = PagedCallSettings.newBuilder(LIST_FIREWALLS_PAGE_STR_FACT); + + patchFirewallSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateFirewallSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteFirewallSettings, + getFirewallSettings, + insertFirewallSettings, + listFirewallsSettings, + patchFirewallSettings, + updateFirewallSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteFirewallSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getFirewallSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertFirewallSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listFirewallsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchFirewallSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateFirewallSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(FirewallStubSettings settings) { + super(settings); + + deleteFirewallSettings = settings.deleteFirewallSettings.toBuilder(); + getFirewallSettings = settings.getFirewallSettings.toBuilder(); + insertFirewallSettings = settings.insertFirewallSettings.toBuilder(); + listFirewallsSettings = settings.listFirewallsSettings.toBuilder(); + patchFirewallSettings = settings.patchFirewallSettings.toBuilder(); + updateFirewallSettings = settings.updateFirewallSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteFirewallSettings, + getFirewallSettings, + insertFirewallSettings, + listFirewallsSettings, + patchFirewallSettings, + updateFirewallSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteFirewall. */ + public UnaryCallSettings.Builder + deleteFirewallSettings() { + return deleteFirewallSettings; + } + + /** Returns the builder for the settings used for calls to getFirewall. */ + public UnaryCallSettings.Builder getFirewallSettings() { + return getFirewallSettings; + } + + /** Returns the builder for the settings used for calls to insertFirewall. */ + public UnaryCallSettings.Builder + insertFirewallSettings() { + return insertFirewallSettings; + } + + /** Returns the builder for the settings used for calls to listFirewalls. */ + public PagedCallSettings.Builder< + ListFirewallsHttpRequest, FirewallList, ListFirewallsPagedResponse> + listFirewallsSettings() { + return listFirewallsSettings; + } + + /** Returns the builder for the settings used for calls to patchFirewall. */ + public UnaryCallSettings.Builder patchFirewallSettings() { + return patchFirewallSettings; + } + + /** Returns the builder for the settings used for calls to updateFirewall. */ + public UnaryCallSettings.Builder + updateFirewallSettings() { + return updateFirewallSettings; + } + + @Override + public FirewallStubSettings build() throws IOException { + return new FirewallStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ForwardingRuleStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ForwardingRuleStub.java new file mode 100644 index 000000000000..d1d56ff4fc38 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ForwardingRuleStub.java @@ -0,0 +1,96 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ForwardingRuleClient.AggregatedListForwardingRulesPagedResponse; +import static com.google.cloud.compute.v1.ForwardingRuleClient.ListForwardingRulesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListForwardingRulesHttpRequest; +import com.google.cloud.compute.v1.DeleteForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ForwardingRule; +import com.google.cloud.compute.v1.ForwardingRuleAggregatedList; +import com.google.cloud.compute.v1.ForwardingRuleList; +import com.google.cloud.compute.v1.GetForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.InsertForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ListForwardingRulesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetTargetForwardingRuleHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class ForwardingRuleStub implements BackgroundResource { + + @BetaApi + public UnaryCallable< + AggregatedListForwardingRulesHttpRequest, AggregatedListForwardingRulesPagedResponse> + aggregatedListForwardingRulesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListForwardingRulesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListForwardingRulesCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListForwardingRulesCallable()"); + } + + @BetaApi + public UnaryCallable deleteForwardingRuleCallable() { + throw new UnsupportedOperationException("Not implemented: deleteForwardingRuleCallable()"); + } + + @BetaApi + public UnaryCallable getForwardingRuleCallable() { + throw new UnsupportedOperationException("Not implemented: getForwardingRuleCallable()"); + } + + @BetaApi + public UnaryCallable insertForwardingRuleCallable() { + throw new UnsupportedOperationException("Not implemented: insertForwardingRuleCallable()"); + } + + @BetaApi + public UnaryCallable + listForwardingRulesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listForwardingRulesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listForwardingRulesCallable() { + throw new UnsupportedOperationException("Not implemented: listForwardingRulesCallable()"); + } + + @BetaApi + public UnaryCallable + setTargetForwardingRuleCallable() { + throw new UnsupportedOperationException("Not implemented: setTargetForwardingRuleCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ForwardingRuleStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ForwardingRuleStubSettings.java new file mode 100644 index 000000000000..81707a48cd42 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ForwardingRuleStubSettings.java @@ -0,0 +1,589 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ForwardingRuleClient.AggregatedListForwardingRulesPagedResponse; +import static com.google.cloud.compute.v1.ForwardingRuleClient.ListForwardingRulesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListForwardingRulesHttpRequest; +import com.google.cloud.compute.v1.DeleteForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ForwardingRule; +import com.google.cloud.compute.v1.ForwardingRuleAggregatedList; +import com.google.cloud.compute.v1.ForwardingRuleList; +import com.google.cloud.compute.v1.ForwardingRulesScopedList; +import com.google.cloud.compute.v1.GetForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.InsertForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ListForwardingRulesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetTargetForwardingRuleHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link ForwardingRuleStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteForwardingRule to 30 seconds: + * + *

+ * 
+ * ForwardingRuleStubSettings.Builder forwardingRuleSettingsBuilder =
+ *     ForwardingRuleStubSettings.newBuilder();
+ * forwardingRuleSettingsBuilder.deleteForwardingRuleSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * ForwardingRuleStubSettings forwardingRuleSettings = forwardingRuleSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ForwardingRuleStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + AggregatedListForwardingRulesPagedResponse> + aggregatedListForwardingRulesSettings; + private final UnaryCallSettings + deleteForwardingRuleSettings; + private final UnaryCallSettings + getForwardingRuleSettings; + private final UnaryCallSettings + insertForwardingRuleSettings; + private final PagedCallSettings< + ListForwardingRulesHttpRequest, ForwardingRuleList, ListForwardingRulesPagedResponse> + listForwardingRulesSettings; + private final UnaryCallSettings + setTargetForwardingRuleSettings; + + /** Returns the object with the settings used for calls to aggregatedListForwardingRules. */ + public PagedCallSettings< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + AggregatedListForwardingRulesPagedResponse> + aggregatedListForwardingRulesSettings() { + return aggregatedListForwardingRulesSettings; + } + + /** Returns the object with the settings used for calls to deleteForwardingRule. */ + public UnaryCallSettings + deleteForwardingRuleSettings() { + return deleteForwardingRuleSettings; + } + + /** Returns the object with the settings used for calls to getForwardingRule. */ + public UnaryCallSettings + getForwardingRuleSettings() { + return getForwardingRuleSettings; + } + + /** Returns the object with the settings used for calls to insertForwardingRule. */ + public UnaryCallSettings + insertForwardingRuleSettings() { + return insertForwardingRuleSettings; + } + + /** Returns the object with the settings used for calls to listForwardingRules. */ + public PagedCallSettings< + ListForwardingRulesHttpRequest, ForwardingRuleList, ListForwardingRulesPagedResponse> + listForwardingRulesSettings() { + return listForwardingRulesSettings; + } + + /** Returns the object with the settings used for calls to setTargetForwardingRule. */ + public UnaryCallSettings + setTargetForwardingRuleSettings() { + return setTargetForwardingRuleSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ForwardingRuleStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonForwardingRuleStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ForwardingRuleStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ForwardingRuleStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListForwardingRulesSettings = + settingsBuilder.aggregatedListForwardingRulesSettings().build(); + deleteForwardingRuleSettings = settingsBuilder.deleteForwardingRuleSettings().build(); + getForwardingRuleSettings = settingsBuilder.getForwardingRuleSettings().build(); + insertForwardingRuleSettings = settingsBuilder.insertForwardingRuleSettings().build(); + listForwardingRulesSettings = settingsBuilder.listForwardingRulesSettings().build(); + setTargetForwardingRuleSettings = settingsBuilder.setTargetForwardingRuleSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + ForwardingRulesScopedList> + AGGREGATED_LIST_FORWARDING_RULES_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + ForwardingRulesScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListForwardingRulesHttpRequest injectToken( + AggregatedListForwardingRulesHttpRequest payload, String token) { + return AggregatedListForwardingRulesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListForwardingRulesHttpRequest injectPageSize( + AggregatedListForwardingRulesHttpRequest payload, int pageSize) { + return AggregatedListForwardingRulesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListForwardingRulesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(ForwardingRuleAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ForwardingRuleAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor< + ListForwardingRulesHttpRequest, ForwardingRuleList, ForwardingRule> + LIST_FORWARDING_RULES_PAGE_STR_DESC = + new PagedListDescriptor< + ListForwardingRulesHttpRequest, ForwardingRuleList, ForwardingRule>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListForwardingRulesHttpRequest injectToken( + ListForwardingRulesHttpRequest payload, String token) { + return ListForwardingRulesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListForwardingRulesHttpRequest injectPageSize( + ListForwardingRulesHttpRequest payload, int pageSize) { + return ListForwardingRulesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListForwardingRulesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(ForwardingRuleList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ForwardingRuleList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + AggregatedListForwardingRulesPagedResponse> + AGGREGATED_LIST_FORWARDING_RULES_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + AggregatedListForwardingRulesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList> + callable, + AggregatedListForwardingRulesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + ForwardingRulesScopedList> + pageContext = + PageContext.create( + callable, + AGGREGATED_LIST_FORWARDING_RULES_PAGE_STR_DESC, + request, + context); + return AggregatedListForwardingRulesPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListForwardingRulesHttpRequest, ForwardingRuleList, ListForwardingRulesPagedResponse> + LIST_FORWARDING_RULES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListForwardingRulesHttpRequest, ForwardingRuleList, + ListForwardingRulesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListForwardingRulesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_FORWARDING_RULES_PAGE_STR_DESC, request, context); + return ListForwardingRulesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for ForwardingRuleStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + AggregatedListForwardingRulesPagedResponse> + aggregatedListForwardingRulesSettings; + private final UnaryCallSettings.Builder + deleteForwardingRuleSettings; + private final UnaryCallSettings.Builder + getForwardingRuleSettings; + private final UnaryCallSettings.Builder + insertForwardingRuleSettings; + private final PagedCallSettings.Builder< + ListForwardingRulesHttpRequest, ForwardingRuleList, ListForwardingRulesPagedResponse> + listForwardingRulesSettings; + private final UnaryCallSettings.Builder + setTargetForwardingRuleSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListForwardingRulesSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_FORWARDING_RULES_PAGE_STR_FACT); + + deleteForwardingRuleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getForwardingRuleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertForwardingRuleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listForwardingRulesSettings = + PagedCallSettings.newBuilder(LIST_FORWARDING_RULES_PAGE_STR_FACT); + + setTargetForwardingRuleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListForwardingRulesSettings, + deleteForwardingRuleSettings, + getForwardingRuleSettings, + insertForwardingRuleSettings, + listForwardingRulesSettings, + setTargetForwardingRuleSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListForwardingRulesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteForwardingRuleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getForwardingRuleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertForwardingRuleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listForwardingRulesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setTargetForwardingRuleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(ForwardingRuleStubSettings settings) { + super(settings); + + aggregatedListForwardingRulesSettings = + settings.aggregatedListForwardingRulesSettings.toBuilder(); + deleteForwardingRuleSettings = settings.deleteForwardingRuleSettings.toBuilder(); + getForwardingRuleSettings = settings.getForwardingRuleSettings.toBuilder(); + insertForwardingRuleSettings = settings.insertForwardingRuleSettings.toBuilder(); + listForwardingRulesSettings = settings.listForwardingRulesSettings.toBuilder(); + setTargetForwardingRuleSettings = settings.setTargetForwardingRuleSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListForwardingRulesSettings, + deleteForwardingRuleSettings, + getForwardingRuleSettings, + insertForwardingRuleSettings, + listForwardingRulesSettings, + setTargetForwardingRuleSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListForwardingRules. */ + public PagedCallSettings.Builder< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList, + AggregatedListForwardingRulesPagedResponse> + aggregatedListForwardingRulesSettings() { + return aggregatedListForwardingRulesSettings; + } + + /** Returns the builder for the settings used for calls to deleteForwardingRule. */ + public UnaryCallSettings.Builder + deleteForwardingRuleSettings() { + return deleteForwardingRuleSettings; + } + + /** Returns the builder for the settings used for calls to getForwardingRule. */ + public UnaryCallSettings.Builder + getForwardingRuleSettings() { + return getForwardingRuleSettings; + } + + /** Returns the builder for the settings used for calls to insertForwardingRule. */ + public UnaryCallSettings.Builder + insertForwardingRuleSettings() { + return insertForwardingRuleSettings; + } + + /** Returns the builder for the settings used for calls to listForwardingRules. */ + public PagedCallSettings.Builder< + ListForwardingRulesHttpRequest, ForwardingRuleList, ListForwardingRulesPagedResponse> + listForwardingRulesSettings() { + return listForwardingRulesSettings; + } + + /** Returns the builder for the settings used for calls to setTargetForwardingRule. */ + public UnaryCallSettings.Builder + setTargetForwardingRuleSettings() { + return setTargetForwardingRuleSettings; + } + + @Override + public ForwardingRuleStubSettings build() throws IOException { + return new ForwardingRuleStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalAddressStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalAddressStub.java new file mode 100644 index 000000000000..4e6fe7008536 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalAddressStub.java @@ -0,0 +1,70 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.GlobalAddressClient.ListGlobalAddressesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.Address; +import com.google.cloud.compute.v1.AddressList; +import com.google.cloud.compute.v1.DeleteGlobalAddressHttpRequest; +import com.google.cloud.compute.v1.GetGlobalAddressHttpRequest; +import com.google.cloud.compute.v1.InsertGlobalAddressHttpRequest; +import com.google.cloud.compute.v1.ListGlobalAddressesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class GlobalAddressStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteGlobalAddressCallable() { + throw new UnsupportedOperationException("Not implemented: deleteGlobalAddressCallable()"); + } + + @BetaApi + public UnaryCallable getGlobalAddressCallable() { + throw new UnsupportedOperationException("Not implemented: getGlobalAddressCallable()"); + } + + @BetaApi + public UnaryCallable insertGlobalAddressCallable() { + throw new UnsupportedOperationException("Not implemented: insertGlobalAddressCallable()"); + } + + @BetaApi + public UnaryCallable + listGlobalAddressesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listGlobalAddressesPagedCallable()"); + } + + @BetaApi + public UnaryCallable listGlobalAddressesCallable() { + throw new UnsupportedOperationException("Not implemented: listGlobalAddressesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalAddressStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalAddressStubSettings.java new file mode 100644 index 000000000000..409943639634 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalAddressStubSettings.java @@ -0,0 +1,439 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.GlobalAddressClient.ListGlobalAddressesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.Address; +import com.google.cloud.compute.v1.AddressList; +import com.google.cloud.compute.v1.DeleteGlobalAddressHttpRequest; +import com.google.cloud.compute.v1.GetGlobalAddressHttpRequest; +import com.google.cloud.compute.v1.InsertGlobalAddressHttpRequest; +import com.google.cloud.compute.v1.ListGlobalAddressesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link GlobalAddressStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteGlobalAddress to 30 seconds: + * + *

+ * 
+ * GlobalAddressStubSettings.Builder globalAddressSettingsBuilder =
+ *     GlobalAddressStubSettings.newBuilder();
+ * globalAddressSettingsBuilder.deleteGlobalAddressSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * GlobalAddressStubSettings globalAddressSettings = globalAddressSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class GlobalAddressStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteGlobalAddressSettings; + private final UnaryCallSettings getGlobalAddressSettings; + private final UnaryCallSettings + insertGlobalAddressSettings; + private final PagedCallSettings< + ListGlobalAddressesHttpRequest, AddressList, ListGlobalAddressesPagedResponse> + listGlobalAddressesSettings; + + /** Returns the object with the settings used for calls to deleteGlobalAddress. */ + public UnaryCallSettings + deleteGlobalAddressSettings() { + return deleteGlobalAddressSettings; + } + + /** Returns the object with the settings used for calls to getGlobalAddress. */ + public UnaryCallSettings getGlobalAddressSettings() { + return getGlobalAddressSettings; + } + + /** Returns the object with the settings used for calls to insertGlobalAddress. */ + public UnaryCallSettings + insertGlobalAddressSettings() { + return insertGlobalAddressSettings; + } + + /** Returns the object with the settings used for calls to listGlobalAddresses. */ + public PagedCallSettings< + ListGlobalAddressesHttpRequest, AddressList, ListGlobalAddressesPagedResponse> + listGlobalAddressesSettings() { + return listGlobalAddressesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public GlobalAddressStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonGlobalAddressStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(GlobalAddressStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected GlobalAddressStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteGlobalAddressSettings = settingsBuilder.deleteGlobalAddressSettings().build(); + getGlobalAddressSettings = settingsBuilder.getGlobalAddressSettings().build(); + insertGlobalAddressSettings = settingsBuilder.insertGlobalAddressSettings().build(); + listGlobalAddressesSettings = settingsBuilder.listGlobalAddressesSettings().build(); + } + + private static final PagedListDescriptor + LIST_GLOBAL_ADDRESSES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListGlobalAddressesHttpRequest injectToken( + ListGlobalAddressesHttpRequest payload, String token) { + return ListGlobalAddressesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListGlobalAddressesHttpRequest injectPageSize( + ListGlobalAddressesHttpRequest payload, int pageSize) { + return ListGlobalAddressesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListGlobalAddressesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(AddressList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable
extractResources(AddressList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListGlobalAddressesHttpRequest, AddressList, ListGlobalAddressesPagedResponse> + LIST_GLOBAL_ADDRESSES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListGlobalAddressesHttpRequest, AddressList, ListGlobalAddressesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListGlobalAddressesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create( + callable, LIST_GLOBAL_ADDRESSES_PAGE_STR_DESC, request, context); + return ListGlobalAddressesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for GlobalAddressStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteGlobalAddressSettings; + private final UnaryCallSettings.Builder + getGlobalAddressSettings; + private final UnaryCallSettings.Builder + insertGlobalAddressSettings; + private final PagedCallSettings.Builder< + ListGlobalAddressesHttpRequest, AddressList, ListGlobalAddressesPagedResponse> + listGlobalAddressesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteGlobalAddressSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getGlobalAddressSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertGlobalAddressSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listGlobalAddressesSettings = + PagedCallSettings.newBuilder(LIST_GLOBAL_ADDRESSES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteGlobalAddressSettings, + getGlobalAddressSettings, + insertGlobalAddressSettings, + listGlobalAddressesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteGlobalAddressSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getGlobalAddressSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertGlobalAddressSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listGlobalAddressesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(GlobalAddressStubSettings settings) { + super(settings); + + deleteGlobalAddressSettings = settings.deleteGlobalAddressSettings.toBuilder(); + getGlobalAddressSettings = settings.getGlobalAddressSettings.toBuilder(); + insertGlobalAddressSettings = settings.insertGlobalAddressSettings.toBuilder(); + listGlobalAddressesSettings = settings.listGlobalAddressesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteGlobalAddressSettings, + getGlobalAddressSettings, + insertGlobalAddressSettings, + listGlobalAddressesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteGlobalAddress. */ + public UnaryCallSettings.Builder + deleteGlobalAddressSettings() { + return deleteGlobalAddressSettings; + } + + /** Returns the builder for the settings used for calls to getGlobalAddress. */ + public UnaryCallSettings.Builder + getGlobalAddressSettings() { + return getGlobalAddressSettings; + } + + /** Returns the builder for the settings used for calls to insertGlobalAddress. */ + public UnaryCallSettings.Builder + insertGlobalAddressSettings() { + return insertGlobalAddressSettings; + } + + /** Returns the builder for the settings used for calls to listGlobalAddresses. */ + public PagedCallSettings.Builder< + ListGlobalAddressesHttpRequest, AddressList, ListGlobalAddressesPagedResponse> + listGlobalAddressesSettings() { + return listGlobalAddressesSettings; + } + + @Override + public GlobalAddressStubSettings build() throws IOException { + return new GlobalAddressStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalForwardingRuleStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalForwardingRuleStub.java new file mode 100644 index 000000000000..226fdbdf0d63 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalForwardingRuleStub.java @@ -0,0 +1,85 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteGlobalForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ForwardingRule; +import com.google.cloud.compute.v1.ForwardingRuleList; +import com.google.cloud.compute.v1.GetGlobalForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.InsertGlobalForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ListGlobalForwardingRulesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetTargetGlobalForwardingRuleHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class GlobalForwardingRuleStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + deleteGlobalForwardingRuleCallable() { + throw new UnsupportedOperationException( + "Not implemented: deleteGlobalForwardingRuleCallable()"); + } + + @BetaApi + public UnaryCallable + getGlobalForwardingRuleCallable() { + throw new UnsupportedOperationException("Not implemented: getGlobalForwardingRuleCallable()"); + } + + @BetaApi + public UnaryCallable + insertGlobalForwardingRuleCallable() { + throw new UnsupportedOperationException( + "Not implemented: insertGlobalForwardingRuleCallable()"); + } + + @BetaApi + public UnaryCallable + listGlobalForwardingRulesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listGlobalForwardingRulesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listGlobalForwardingRulesCallable() { + throw new UnsupportedOperationException("Not implemented: listGlobalForwardingRulesCallable()"); + } + + @BetaApi + public UnaryCallable + setTargetGlobalForwardingRuleCallable() { + throw new UnsupportedOperationException( + "Not implemented: setTargetGlobalForwardingRuleCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalForwardingRuleStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalForwardingRuleStubSettings.java new file mode 100644 index 000000000000..019b57dfeb79 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalForwardingRuleStubSettings.java @@ -0,0 +1,487 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteGlobalForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ForwardingRule; +import com.google.cloud.compute.v1.ForwardingRuleList; +import com.google.cloud.compute.v1.GetGlobalForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.InsertGlobalForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ListGlobalForwardingRulesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetTargetGlobalForwardingRuleHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link GlobalForwardingRuleStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteGlobalForwardingRule to 30 seconds: + * + *

+ * 
+ * GlobalForwardingRuleStubSettings.Builder globalForwardingRuleSettingsBuilder =
+ *     GlobalForwardingRuleStubSettings.newBuilder();
+ * globalForwardingRuleSettingsBuilder.deleteGlobalForwardingRuleSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * GlobalForwardingRuleStubSettings globalForwardingRuleSettings = globalForwardingRuleSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class GlobalForwardingRuleStubSettings + extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteGlobalForwardingRuleSettings; + private final UnaryCallSettings + getGlobalForwardingRuleSettings; + private final UnaryCallSettings + insertGlobalForwardingRuleSettings; + private final PagedCallSettings< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, + ListGlobalForwardingRulesPagedResponse> + listGlobalForwardingRulesSettings; + private final UnaryCallSettings + setTargetGlobalForwardingRuleSettings; + + /** Returns the object with the settings used for calls to deleteGlobalForwardingRule. */ + public UnaryCallSettings + deleteGlobalForwardingRuleSettings() { + return deleteGlobalForwardingRuleSettings; + } + + /** Returns the object with the settings used for calls to getGlobalForwardingRule. */ + public UnaryCallSettings + getGlobalForwardingRuleSettings() { + return getGlobalForwardingRuleSettings; + } + + /** Returns the object with the settings used for calls to insertGlobalForwardingRule. */ + public UnaryCallSettings + insertGlobalForwardingRuleSettings() { + return insertGlobalForwardingRuleSettings; + } + + /** Returns the object with the settings used for calls to listGlobalForwardingRules. */ + public PagedCallSettings< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, + ListGlobalForwardingRulesPagedResponse> + listGlobalForwardingRulesSettings() { + return listGlobalForwardingRulesSettings; + } + + /** Returns the object with the settings used for calls to setTargetGlobalForwardingRule. */ + public UnaryCallSettings + setTargetGlobalForwardingRuleSettings() { + return setTargetGlobalForwardingRuleSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public GlobalForwardingRuleStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonGlobalForwardingRuleStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(GlobalForwardingRuleStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected GlobalForwardingRuleStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteGlobalForwardingRuleSettings = + settingsBuilder.deleteGlobalForwardingRuleSettings().build(); + getGlobalForwardingRuleSettings = settingsBuilder.getGlobalForwardingRuleSettings().build(); + insertGlobalForwardingRuleSettings = + settingsBuilder.insertGlobalForwardingRuleSettings().build(); + listGlobalForwardingRulesSettings = settingsBuilder.listGlobalForwardingRulesSettings().build(); + setTargetGlobalForwardingRuleSettings = + settingsBuilder.setTargetGlobalForwardingRuleSettings().build(); + } + + private static final PagedListDescriptor< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, ForwardingRule> + LIST_GLOBAL_FORWARDING_RULES_PAGE_STR_DESC = + new PagedListDescriptor< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, ForwardingRule>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListGlobalForwardingRulesHttpRequest injectToken( + ListGlobalForwardingRulesHttpRequest payload, String token) { + return ListGlobalForwardingRulesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListGlobalForwardingRulesHttpRequest injectPageSize( + ListGlobalForwardingRulesHttpRequest payload, int pageSize) { + return ListGlobalForwardingRulesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListGlobalForwardingRulesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(ForwardingRuleList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ForwardingRuleList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, + ListGlobalForwardingRulesPagedResponse> + LIST_GLOBAL_FORWARDING_RULES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, + ListGlobalForwardingRulesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListGlobalForwardingRulesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_GLOBAL_FORWARDING_RULES_PAGE_STR_DESC, request, context); + return ListGlobalForwardingRulesPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + /** Builder for GlobalForwardingRuleStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteGlobalForwardingRuleSettings; + private final UnaryCallSettings.Builder + getGlobalForwardingRuleSettings; + private final UnaryCallSettings.Builder + insertGlobalForwardingRuleSettings; + private final PagedCallSettings.Builder< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, + ListGlobalForwardingRulesPagedResponse> + listGlobalForwardingRulesSettings; + private final UnaryCallSettings.Builder + setTargetGlobalForwardingRuleSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteGlobalForwardingRuleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getGlobalForwardingRuleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertGlobalForwardingRuleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listGlobalForwardingRulesSettings = + PagedCallSettings.newBuilder(LIST_GLOBAL_FORWARDING_RULES_PAGE_STR_FACT); + + setTargetGlobalForwardingRuleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteGlobalForwardingRuleSettings, + getGlobalForwardingRuleSettings, + insertGlobalForwardingRuleSettings, + listGlobalForwardingRulesSettings, + setTargetGlobalForwardingRuleSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteGlobalForwardingRuleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getGlobalForwardingRuleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertGlobalForwardingRuleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listGlobalForwardingRulesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setTargetGlobalForwardingRuleSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(GlobalForwardingRuleStubSettings settings) { + super(settings); + + deleteGlobalForwardingRuleSettings = settings.deleteGlobalForwardingRuleSettings.toBuilder(); + getGlobalForwardingRuleSettings = settings.getGlobalForwardingRuleSettings.toBuilder(); + insertGlobalForwardingRuleSettings = settings.insertGlobalForwardingRuleSettings.toBuilder(); + listGlobalForwardingRulesSettings = settings.listGlobalForwardingRulesSettings.toBuilder(); + setTargetGlobalForwardingRuleSettings = + settings.setTargetGlobalForwardingRuleSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteGlobalForwardingRuleSettings, + getGlobalForwardingRuleSettings, + insertGlobalForwardingRuleSettings, + listGlobalForwardingRulesSettings, + setTargetGlobalForwardingRuleSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteGlobalForwardingRule. */ + public UnaryCallSettings.Builder + deleteGlobalForwardingRuleSettings() { + return deleteGlobalForwardingRuleSettings; + } + + /** Returns the builder for the settings used for calls to getGlobalForwardingRule. */ + public UnaryCallSettings.Builder + getGlobalForwardingRuleSettings() { + return getGlobalForwardingRuleSettings; + } + + /** Returns the builder for the settings used for calls to insertGlobalForwardingRule. */ + public UnaryCallSettings.Builder + insertGlobalForwardingRuleSettings() { + return insertGlobalForwardingRuleSettings; + } + + /** Returns the builder for the settings used for calls to listGlobalForwardingRules. */ + public PagedCallSettings.Builder< + ListGlobalForwardingRulesHttpRequest, ForwardingRuleList, + ListGlobalForwardingRulesPagedResponse> + listGlobalForwardingRulesSettings() { + return listGlobalForwardingRulesSettings; + } + + /** Returns the builder for the settings used for calls to setTargetGlobalForwardingRule. */ + public UnaryCallSettings.Builder + setTargetGlobalForwardingRuleSettings() { + return setTargetGlobalForwardingRuleSettings; + } + + @Override + public GlobalForwardingRuleStubSettings build() throws IOException { + return new GlobalForwardingRuleStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalOperationStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalOperationStub.java new file mode 100644 index 000000000000..e3951231c74f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalOperationStub.java @@ -0,0 +1,82 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.GlobalOperationClient.AggregatedListGlobalOperationsPagedResponse; +import static com.google.cloud.compute.v1.GlobalOperationClient.ListGlobalOperationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListGlobalOperationsHttpRequest; +import com.google.cloud.compute.v1.DeleteGlobalOperationHttpRequest; +import com.google.cloud.compute.v1.GetGlobalOperationHttpRequest; +import com.google.cloud.compute.v1.ListGlobalOperationsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.OperationAggregatedList; +import com.google.cloud.compute.v1.OperationList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class GlobalOperationStub implements BackgroundResource { + + @BetaApi + public UnaryCallable< + AggregatedListGlobalOperationsHttpRequest, AggregatedListGlobalOperationsPagedResponse> + aggregatedListGlobalOperationsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListGlobalOperationsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListGlobalOperationsCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListGlobalOperationsCallable()"); + } + + @BetaApi + public UnaryCallable deleteGlobalOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteGlobalOperationCallable()"); + } + + @BetaApi + public UnaryCallable getGlobalOperationCallable() { + throw new UnsupportedOperationException("Not implemented: getGlobalOperationCallable()"); + } + + @BetaApi + public UnaryCallable + listGlobalOperationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listGlobalOperationsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listGlobalOperationsCallable() { + throw new UnsupportedOperationException("Not implemented: listGlobalOperationsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalOperationStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalOperationStubSettings.java new file mode 100644 index 000000000000..8dfeea1ad6b0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/GlobalOperationStubSettings.java @@ -0,0 +1,527 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.GlobalOperationClient.AggregatedListGlobalOperationsPagedResponse; +import static com.google.cloud.compute.v1.GlobalOperationClient.ListGlobalOperationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListGlobalOperationsHttpRequest; +import com.google.cloud.compute.v1.DeleteGlobalOperationHttpRequest; +import com.google.cloud.compute.v1.GetGlobalOperationHttpRequest; +import com.google.cloud.compute.v1.ListGlobalOperationsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.OperationAggregatedList; +import com.google.cloud.compute.v1.OperationList; +import com.google.cloud.compute.v1.OperationsScopedList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link GlobalOperationStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteGlobalOperation to 30 seconds: + * + *

+ * 
+ * GlobalOperationStubSettings.Builder globalOperationSettingsBuilder =
+ *     GlobalOperationStubSettings.newBuilder();
+ * globalOperationSettingsBuilder.deleteGlobalOperationSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * GlobalOperationStubSettings globalOperationSettings = globalOperationSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class GlobalOperationStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + AggregatedListGlobalOperationsPagedResponse> + aggregatedListGlobalOperationsSettings; + private final UnaryCallSettings + deleteGlobalOperationSettings; + private final UnaryCallSettings + getGlobalOperationSettings; + private final PagedCallSettings< + ListGlobalOperationsHttpRequest, OperationList, ListGlobalOperationsPagedResponse> + listGlobalOperationsSettings; + + /** Returns the object with the settings used for calls to aggregatedListGlobalOperations. */ + public PagedCallSettings< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + AggregatedListGlobalOperationsPagedResponse> + aggregatedListGlobalOperationsSettings() { + return aggregatedListGlobalOperationsSettings; + } + + /** Returns the object with the settings used for calls to deleteGlobalOperation. */ + public UnaryCallSettings deleteGlobalOperationSettings() { + return deleteGlobalOperationSettings; + } + + /** Returns the object with the settings used for calls to getGlobalOperation. */ + public UnaryCallSettings getGlobalOperationSettings() { + return getGlobalOperationSettings; + } + + /** Returns the object with the settings used for calls to listGlobalOperations. */ + public PagedCallSettings< + ListGlobalOperationsHttpRequest, OperationList, ListGlobalOperationsPagedResponse> + listGlobalOperationsSettings() { + return listGlobalOperationsSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public GlobalOperationStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonGlobalOperationStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(GlobalOperationStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected GlobalOperationStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListGlobalOperationsSettings = + settingsBuilder.aggregatedListGlobalOperationsSettings().build(); + deleteGlobalOperationSettings = settingsBuilder.deleteGlobalOperationSettings().build(); + getGlobalOperationSettings = settingsBuilder.getGlobalOperationSettings().build(); + listGlobalOperationsSettings = settingsBuilder.listGlobalOperationsSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, OperationsScopedList> + AGGREGATED_LIST_GLOBAL_OPERATIONS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + OperationsScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListGlobalOperationsHttpRequest injectToken( + AggregatedListGlobalOperationsHttpRequest payload, String token) { + return AggregatedListGlobalOperationsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListGlobalOperationsHttpRequest injectPageSize( + AggregatedListGlobalOperationsHttpRequest payload, int pageSize) { + return AggregatedListGlobalOperationsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListGlobalOperationsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(OperationAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + OperationAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor< + ListGlobalOperationsHttpRequest, OperationList, Operation> + LIST_GLOBAL_OPERATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListGlobalOperationsHttpRequest injectToken( + ListGlobalOperationsHttpRequest payload, String token) { + return ListGlobalOperationsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListGlobalOperationsHttpRequest injectPageSize( + ListGlobalOperationsHttpRequest payload, int pageSize) { + return ListGlobalOperationsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListGlobalOperationsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(OperationList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(OperationList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + AggregatedListGlobalOperationsPagedResponse> + AGGREGATED_LIST_GLOBAL_OPERATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + AggregatedListGlobalOperationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + AggregatedListGlobalOperationsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + OperationsScopedList> + pageContext = + PageContext.create( + callable, + AGGREGATED_LIST_GLOBAL_OPERATIONS_PAGE_STR_DESC, + request, + context); + return AggregatedListGlobalOperationsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListGlobalOperationsHttpRequest, OperationList, ListGlobalOperationsPagedResponse> + LIST_GLOBAL_OPERATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListGlobalOperationsHttpRequest, OperationList, ListGlobalOperationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListGlobalOperationsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create( + callable, LIST_GLOBAL_OPERATIONS_PAGE_STR_DESC, request, context); + return ListGlobalOperationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for GlobalOperationStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + AggregatedListGlobalOperationsPagedResponse> + aggregatedListGlobalOperationsSettings; + private final UnaryCallSettings.Builder + deleteGlobalOperationSettings; + private final UnaryCallSettings.Builder + getGlobalOperationSettings; + private final PagedCallSettings.Builder< + ListGlobalOperationsHttpRequest, OperationList, ListGlobalOperationsPagedResponse> + listGlobalOperationsSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListGlobalOperationsSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_GLOBAL_OPERATIONS_PAGE_STR_FACT); + + deleteGlobalOperationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getGlobalOperationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listGlobalOperationsSettings = + PagedCallSettings.newBuilder(LIST_GLOBAL_OPERATIONS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListGlobalOperationsSettings, + deleteGlobalOperationSettings, + getGlobalOperationSettings, + listGlobalOperationsSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListGlobalOperationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteGlobalOperationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getGlobalOperationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listGlobalOperationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(GlobalOperationStubSettings settings) { + super(settings); + + aggregatedListGlobalOperationsSettings = + settings.aggregatedListGlobalOperationsSettings.toBuilder(); + deleteGlobalOperationSettings = settings.deleteGlobalOperationSettings.toBuilder(); + getGlobalOperationSettings = settings.getGlobalOperationSettings.toBuilder(); + listGlobalOperationsSettings = settings.listGlobalOperationsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListGlobalOperationsSettings, + deleteGlobalOperationSettings, + getGlobalOperationSettings, + listGlobalOperationsSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListGlobalOperations. */ + public PagedCallSettings.Builder< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList, + AggregatedListGlobalOperationsPagedResponse> + aggregatedListGlobalOperationsSettings() { + return aggregatedListGlobalOperationsSettings; + } + + /** Returns the builder for the settings used for calls to deleteGlobalOperation. */ + public UnaryCallSettings.Builder + deleteGlobalOperationSettings() { + return deleteGlobalOperationSettings; + } + + /** Returns the builder for the settings used for calls to getGlobalOperation. */ + public UnaryCallSettings.Builder + getGlobalOperationSettings() { + return getGlobalOperationSettings; + } + + /** Returns the builder for the settings used for calls to listGlobalOperations. */ + public PagedCallSettings.Builder< + ListGlobalOperationsHttpRequest, OperationList, ListGlobalOperationsPagedResponse> + listGlobalOperationsSettings() { + return listGlobalOperationsSettings; + } + + @Override + public GlobalOperationStubSettings build() throws IOException { + return new GlobalOperationStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HealthCheckStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HealthCheckStub.java new file mode 100644 index 000000000000..3e7064534dc1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HealthCheckStub.java @@ -0,0 +1,82 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.HealthCheckClient.ListHealthChecksPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteHealthCheckHttpRequest; +import com.google.cloud.compute.v1.GetHealthCheckHttpRequest; +import com.google.cloud.compute.v1.HealthCheck; +import com.google.cloud.compute.v1.HealthCheckList; +import com.google.cloud.compute.v1.InsertHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ListHealthChecksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchHealthCheckHttpRequest; +import com.google.cloud.compute.v1.UpdateHealthCheckHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class HealthCheckStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: deleteHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable getHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: getHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable insertHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: insertHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable + listHealthChecksPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listHealthChecksPagedCallable()"); + } + + @BetaApi + public UnaryCallable listHealthChecksCallable() { + throw new UnsupportedOperationException("Not implemented: listHealthChecksCallable()"); + } + + @BetaApi + public UnaryCallable patchHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: patchHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable updateHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: updateHealthCheckCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HealthCheckStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HealthCheckStubSettings.java new file mode 100644 index 000000000000..11cdb64541fa --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HealthCheckStubSettings.java @@ -0,0 +1,489 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.HealthCheckClient.ListHealthChecksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteHealthCheckHttpRequest; +import com.google.cloud.compute.v1.GetHealthCheckHttpRequest; +import com.google.cloud.compute.v1.HealthCheck; +import com.google.cloud.compute.v1.HealthCheckList; +import com.google.cloud.compute.v1.InsertHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ListHealthChecksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchHealthCheckHttpRequest; +import com.google.cloud.compute.v1.UpdateHealthCheckHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link HealthCheckStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteHealthCheck to 30 seconds: + * + *

+ * 
+ * HealthCheckStubSettings.Builder healthCheckSettingsBuilder =
+ *     HealthCheckStubSettings.newBuilder();
+ * healthCheckSettingsBuilder.deleteHealthCheckSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * HealthCheckStubSettings healthCheckSettings = healthCheckSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class HealthCheckStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteHealthCheckSettings; + private final UnaryCallSettings getHealthCheckSettings; + private final UnaryCallSettings + insertHealthCheckSettings; + private final PagedCallSettings< + ListHealthChecksHttpRequest, HealthCheckList, ListHealthChecksPagedResponse> + listHealthChecksSettings; + private final UnaryCallSettings patchHealthCheckSettings; + private final UnaryCallSettings + updateHealthCheckSettings; + + /** Returns the object with the settings used for calls to deleteHealthCheck. */ + public UnaryCallSettings deleteHealthCheckSettings() { + return deleteHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to getHealthCheck. */ + public UnaryCallSettings getHealthCheckSettings() { + return getHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to insertHealthCheck. */ + public UnaryCallSettings insertHealthCheckSettings() { + return insertHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to listHealthChecks. */ + public PagedCallSettings< + ListHealthChecksHttpRequest, HealthCheckList, ListHealthChecksPagedResponse> + listHealthChecksSettings() { + return listHealthChecksSettings; + } + + /** Returns the object with the settings used for calls to patchHealthCheck. */ + public UnaryCallSettings patchHealthCheckSettings() { + return patchHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to updateHealthCheck. */ + public UnaryCallSettings updateHealthCheckSettings() { + return updateHealthCheckSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public HealthCheckStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonHealthCheckStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(HealthCheckStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected HealthCheckStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteHealthCheckSettings = settingsBuilder.deleteHealthCheckSettings().build(); + getHealthCheckSettings = settingsBuilder.getHealthCheckSettings().build(); + insertHealthCheckSettings = settingsBuilder.insertHealthCheckSettings().build(); + listHealthChecksSettings = settingsBuilder.listHealthChecksSettings().build(); + patchHealthCheckSettings = settingsBuilder.patchHealthCheckSettings().build(); + updateHealthCheckSettings = settingsBuilder.updateHealthCheckSettings().build(); + } + + private static final PagedListDescriptor< + ListHealthChecksHttpRequest, HealthCheckList, HealthCheck> + LIST_HEALTH_CHECKS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListHealthChecksHttpRequest injectToken( + ListHealthChecksHttpRequest payload, String token) { + return ListHealthChecksHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListHealthChecksHttpRequest injectPageSize( + ListHealthChecksHttpRequest payload, int pageSize) { + return ListHealthChecksHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListHealthChecksHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(HealthCheckList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(HealthCheckList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListHealthChecksHttpRequest, HealthCheckList, ListHealthChecksPagedResponse> + LIST_HEALTH_CHECKS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListHealthChecksHttpRequest, HealthCheckList, ListHealthChecksPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListHealthChecksHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_HEALTH_CHECKS_PAGE_STR_DESC, request, context); + return ListHealthChecksPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for HealthCheckStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteHealthCheckSettings; + private final UnaryCallSettings.Builder + getHealthCheckSettings; + private final UnaryCallSettings.Builder + insertHealthCheckSettings; + private final PagedCallSettings.Builder< + ListHealthChecksHttpRequest, HealthCheckList, ListHealthChecksPagedResponse> + listHealthChecksSettings; + private final UnaryCallSettings.Builder + patchHealthCheckSettings; + private final UnaryCallSettings.Builder + updateHealthCheckSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listHealthChecksSettings = PagedCallSettings.newBuilder(LIST_HEALTH_CHECKS_PAGE_STR_FACT); + + patchHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteHealthCheckSettings, + getHealthCheckSettings, + insertHealthCheckSettings, + listHealthChecksSettings, + patchHealthCheckSettings, + updateHealthCheckSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listHealthChecksSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(HealthCheckStubSettings settings) { + super(settings); + + deleteHealthCheckSettings = settings.deleteHealthCheckSettings.toBuilder(); + getHealthCheckSettings = settings.getHealthCheckSettings.toBuilder(); + insertHealthCheckSettings = settings.insertHealthCheckSettings.toBuilder(); + listHealthChecksSettings = settings.listHealthChecksSettings.toBuilder(); + patchHealthCheckSettings = settings.patchHealthCheckSettings.toBuilder(); + updateHealthCheckSettings = settings.updateHealthCheckSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteHealthCheckSettings, + getHealthCheckSettings, + insertHealthCheckSettings, + listHealthChecksSettings, + patchHealthCheckSettings, + updateHealthCheckSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteHealthCheck. */ + public UnaryCallSettings.Builder + deleteHealthCheckSettings() { + return deleteHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to getHealthCheck. */ + public UnaryCallSettings.Builder + getHealthCheckSettings() { + return getHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to insertHealthCheck. */ + public UnaryCallSettings.Builder + insertHealthCheckSettings() { + return insertHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to listHealthChecks. */ + public PagedCallSettings.Builder< + ListHealthChecksHttpRequest, HealthCheckList, ListHealthChecksPagedResponse> + listHealthChecksSettings() { + return listHealthChecksSettings; + } + + /** Returns the builder for the settings used for calls to patchHealthCheck. */ + public UnaryCallSettings.Builder + patchHealthCheckSettings() { + return patchHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to updateHealthCheck. */ + public UnaryCallSettings.Builder + updateHealthCheckSettings() { + return updateHealthCheckSettings; + } + + @Override + public HealthCheckStubSettings build() throws IOException { + return new HealthCheckStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpHealthCheckStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpHealthCheckStub.java new file mode 100644 index 000000000000..84676af100df --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpHealthCheckStub.java @@ -0,0 +1,87 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.HttpHealthCheckClient.ListHttpHealthChecksPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.GetHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.HttpHealthCheck2; +import com.google.cloud.compute.v1.HttpHealthCheckList; +import com.google.cloud.compute.v1.InsertHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ListHttpHealthChecksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.UpdateHttpHealthCheckHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class HttpHealthCheckStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + deleteHttpHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: deleteHttpHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable + getHttpHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: getHttpHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable + insertHttpHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: insertHttpHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable + listHttpHealthChecksPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listHttpHealthChecksPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listHttpHealthChecksCallable() { + throw new UnsupportedOperationException("Not implemented: listHttpHealthChecksCallable()"); + } + + @BetaApi + public UnaryCallable patchHttpHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: patchHttpHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable + updateHttpHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: updateHttpHealthCheckCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpHealthCheckStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpHealthCheckStubSettings.java new file mode 100644 index 000000000000..6ce448ba8aed --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpHealthCheckStubSettings.java @@ -0,0 +1,503 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.HttpHealthCheckClient.ListHttpHealthChecksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.GetHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.HttpHealthCheck2; +import com.google.cloud.compute.v1.HttpHealthCheckList; +import com.google.cloud.compute.v1.InsertHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ListHttpHealthChecksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.UpdateHttpHealthCheckHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link HttpHealthCheckStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteHttpHealthCheck to 30 seconds: + * + *

+ * 
+ * HttpHealthCheckStubSettings.Builder httpHealthCheckSettingsBuilder =
+ *     HttpHealthCheckStubSettings.newBuilder();
+ * httpHealthCheckSettingsBuilder.deleteHttpHealthCheckSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * HttpHealthCheckStubSettings httpHealthCheckSettings = httpHealthCheckSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class HttpHealthCheckStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteHttpHealthCheckSettings; + private final UnaryCallSettings + getHttpHealthCheckSettings; + private final UnaryCallSettings + insertHttpHealthCheckSettings; + private final PagedCallSettings< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, ListHttpHealthChecksPagedResponse> + listHttpHealthChecksSettings; + private final UnaryCallSettings + patchHttpHealthCheckSettings; + private final UnaryCallSettings + updateHttpHealthCheckSettings; + + /** Returns the object with the settings used for calls to deleteHttpHealthCheck. */ + public UnaryCallSettings + deleteHttpHealthCheckSettings() { + return deleteHttpHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to getHttpHealthCheck. */ + public UnaryCallSettings + getHttpHealthCheckSettings() { + return getHttpHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to insertHttpHealthCheck. */ + public UnaryCallSettings + insertHttpHealthCheckSettings() { + return insertHttpHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to listHttpHealthChecks. */ + public PagedCallSettings< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, ListHttpHealthChecksPagedResponse> + listHttpHealthChecksSettings() { + return listHttpHealthChecksSettings; + } + + /** Returns the object with the settings used for calls to patchHttpHealthCheck. */ + public UnaryCallSettings + patchHttpHealthCheckSettings() { + return patchHttpHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to updateHttpHealthCheck. */ + public UnaryCallSettings + updateHttpHealthCheckSettings() { + return updateHttpHealthCheckSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public HttpHealthCheckStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonHttpHealthCheckStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(HttpHealthCheckStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected HttpHealthCheckStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteHttpHealthCheckSettings = settingsBuilder.deleteHttpHealthCheckSettings().build(); + getHttpHealthCheckSettings = settingsBuilder.getHttpHealthCheckSettings().build(); + insertHttpHealthCheckSettings = settingsBuilder.insertHttpHealthCheckSettings().build(); + listHttpHealthChecksSettings = settingsBuilder.listHttpHealthChecksSettings().build(); + patchHttpHealthCheckSettings = settingsBuilder.patchHttpHealthCheckSettings().build(); + updateHttpHealthCheckSettings = settingsBuilder.updateHttpHealthCheckSettings().build(); + } + + private static final PagedListDescriptor< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, HttpHealthCheck2> + LIST_HTTP_HEALTH_CHECKS_PAGE_STR_DESC = + new PagedListDescriptor< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, HttpHealthCheck2>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListHttpHealthChecksHttpRequest injectToken( + ListHttpHealthChecksHttpRequest payload, String token) { + return ListHttpHealthChecksHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListHttpHealthChecksHttpRequest injectPageSize( + ListHttpHealthChecksHttpRequest payload, int pageSize) { + return ListHttpHealthChecksHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListHttpHealthChecksHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(HttpHealthCheckList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(HttpHealthCheckList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, ListHttpHealthChecksPagedResponse> + LIST_HTTP_HEALTH_CHECKS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, + ListHttpHealthChecksPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListHttpHealthChecksHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_HTTP_HEALTH_CHECKS_PAGE_STR_DESC, request, context); + return ListHttpHealthChecksPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for HttpHealthCheckStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteHttpHealthCheckSettings; + private final UnaryCallSettings.Builder + getHttpHealthCheckSettings; + private final UnaryCallSettings.Builder + insertHttpHealthCheckSettings; + private final PagedCallSettings.Builder< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, ListHttpHealthChecksPagedResponse> + listHttpHealthChecksSettings; + private final UnaryCallSettings.Builder + patchHttpHealthCheckSettings; + private final UnaryCallSettings.Builder + updateHttpHealthCheckSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteHttpHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getHttpHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertHttpHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listHttpHealthChecksSettings = + PagedCallSettings.newBuilder(LIST_HTTP_HEALTH_CHECKS_PAGE_STR_FACT); + + patchHttpHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateHttpHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteHttpHealthCheckSettings, + getHttpHealthCheckSettings, + insertHttpHealthCheckSettings, + listHttpHealthChecksSettings, + patchHttpHealthCheckSettings, + updateHttpHealthCheckSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteHttpHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getHttpHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertHttpHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listHttpHealthChecksSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchHttpHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateHttpHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(HttpHealthCheckStubSettings settings) { + super(settings); + + deleteHttpHealthCheckSettings = settings.deleteHttpHealthCheckSettings.toBuilder(); + getHttpHealthCheckSettings = settings.getHttpHealthCheckSettings.toBuilder(); + insertHttpHealthCheckSettings = settings.insertHttpHealthCheckSettings.toBuilder(); + listHttpHealthChecksSettings = settings.listHttpHealthChecksSettings.toBuilder(); + patchHttpHealthCheckSettings = settings.patchHttpHealthCheckSettings.toBuilder(); + updateHttpHealthCheckSettings = settings.updateHttpHealthCheckSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteHttpHealthCheckSettings, + getHttpHealthCheckSettings, + insertHttpHealthCheckSettings, + listHttpHealthChecksSettings, + patchHttpHealthCheckSettings, + updateHttpHealthCheckSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteHttpHealthCheck. */ + public UnaryCallSettings.Builder + deleteHttpHealthCheckSettings() { + return deleteHttpHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to getHttpHealthCheck. */ + public UnaryCallSettings.Builder + getHttpHealthCheckSettings() { + return getHttpHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to insertHttpHealthCheck. */ + public UnaryCallSettings.Builder + insertHttpHealthCheckSettings() { + return insertHttpHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to listHttpHealthChecks. */ + public PagedCallSettings.Builder< + ListHttpHealthChecksHttpRequest, HttpHealthCheckList, ListHttpHealthChecksPagedResponse> + listHttpHealthChecksSettings() { + return listHttpHealthChecksSettings; + } + + /** Returns the builder for the settings used for calls to patchHttpHealthCheck. */ + public UnaryCallSettings.Builder + patchHttpHealthCheckSettings() { + return patchHttpHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to updateHttpHealthCheck. */ + public UnaryCallSettings.Builder + updateHttpHealthCheckSettings() { + return updateHttpHealthCheckSettings; + } + + @Override + public HttpHealthCheckStubSettings build() throws IOException { + return new HttpHealthCheckStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAcceleratorTypeCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAcceleratorTypeCallableFactory.java new file mode 100644 index 000000000000..12849d1a252e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAcceleratorTypeCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonAcceleratorTypeCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAcceleratorTypeStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAcceleratorTypeStub.java new file mode 100644 index 000000000000..597842fdabe8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAcceleratorTypeStub.java @@ -0,0 +1,286 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.AcceleratorTypeClient.AggregatedListAcceleratorTypesPagedResponse; +import static com.google.cloud.compute.v1.AcceleratorTypeClient.ListAcceleratorTypesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AcceleratorType; +import com.google.cloud.compute.v1.AcceleratorTypeAggregatedList; +import com.google.cloud.compute.v1.AcceleratorTypeList; +import com.google.cloud.compute.v1.AggregatedListAcceleratorTypesHttpRequest; +import com.google.cloud.compute.v1.GetAcceleratorTypeHttpRequest; +import com.google.cloud.compute.v1.ListAcceleratorTypesHttpRequest; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectZoneAcceleratorTypeName; +import com.google.cloud.compute.v1.ProjectZoneName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonAcceleratorTypeStub extends AcceleratorTypeStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList> + aggregatedListAcceleratorTypesMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("compute.acceleratorTypes.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/acceleratorTypes")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(AcceleratorTypeAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getAcceleratorTypeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.acceleratorTypes.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/acceleratorTypes/{acceleratorType}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneAcceleratorTypeName.newFactory()) + .setResourceNameField("acceleratorType") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(AcceleratorType.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listAcceleratorTypesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.acceleratorTypes.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/acceleratorTypes")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(AcceleratorTypeList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable< + AggregatedListAcceleratorTypesHttpRequest, AcceleratorTypeAggregatedList> + aggregatedListAcceleratorTypesCallable; + private final UnaryCallable< + AggregatedListAcceleratorTypesHttpRequest, AggregatedListAcceleratorTypesPagedResponse> + aggregatedListAcceleratorTypesPagedCallable; + private final UnaryCallable + getAcceleratorTypeCallable; + private final UnaryCallable + listAcceleratorTypesCallable; + private final UnaryCallable + listAcceleratorTypesPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonAcceleratorTypeStub create(AcceleratorTypeStubSettings settings) + throws IOException { + return new HttpJsonAcceleratorTypeStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonAcceleratorTypeStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonAcceleratorTypeStub( + AcceleratorTypeStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonAcceleratorTypeStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonAcceleratorTypeStub( + AcceleratorTypeStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonAcceleratorTypeStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonAcceleratorTypeStub( + AcceleratorTypeStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonAcceleratorTypeCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonAcceleratorTypeStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonAcceleratorTypeStub( + AcceleratorTypeStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListAcceleratorTypesTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(aggregatedListAcceleratorTypesMethodDescriptor) + .build(); + HttpJsonCallSettings + getAcceleratorTypeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAcceleratorTypeMethodDescriptor) + .build(); + HttpJsonCallSettings + listAcceleratorTypesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listAcceleratorTypesMethodDescriptor) + .build(); + + this.aggregatedListAcceleratorTypesCallable = + callableFactory.createUnaryCallable( + aggregatedListAcceleratorTypesTransportSettings, + settings.aggregatedListAcceleratorTypesSettings(), + clientContext); + this.aggregatedListAcceleratorTypesPagedCallable = + callableFactory.createPagedCallable( + aggregatedListAcceleratorTypesTransportSettings, + settings.aggregatedListAcceleratorTypesSettings(), + clientContext); + this.getAcceleratorTypeCallable = + callableFactory.createUnaryCallable( + getAcceleratorTypeTransportSettings, + settings.getAcceleratorTypeSettings(), + clientContext); + this.listAcceleratorTypesCallable = + callableFactory.createUnaryCallable( + listAcceleratorTypesTransportSettings, + settings.listAcceleratorTypesSettings(), + clientContext); + this.listAcceleratorTypesPagedCallable = + callableFactory.createPagedCallable( + listAcceleratorTypesTransportSettings, + settings.listAcceleratorTypesSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable< + AggregatedListAcceleratorTypesHttpRequest, AggregatedListAcceleratorTypesPagedResponse> + aggregatedListAcceleratorTypesPagedCallable() { + return aggregatedListAcceleratorTypesPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListAcceleratorTypesCallable() { + return aggregatedListAcceleratorTypesCallable; + } + + @BetaApi + public UnaryCallable + getAcceleratorTypeCallable() { + return getAcceleratorTypeCallable; + } + + @BetaApi + public UnaryCallable + listAcceleratorTypesPagedCallable() { + return listAcceleratorTypesPagedCallable; + } + + @BetaApi + public UnaryCallable + listAcceleratorTypesCallable() { + return listAcceleratorTypesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAddressCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAddressCallableFactory.java new file mode 100644 index 000000000000..43522b0186e6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAddressCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonAddressCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAddressStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAddressStub.java new file mode 100644 index 000000000000..7092da29b4c0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAddressStub.java @@ -0,0 +1,331 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.AddressClient.AggregatedListAddressesPagedResponse; +import static com.google.cloud.compute.v1.AddressClient.ListAddressesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.Address; +import com.google.cloud.compute.v1.AddressAggregatedList; +import com.google.cloud.compute.v1.AddressList; +import com.google.cloud.compute.v1.AggregatedListAddressesHttpRequest; +import com.google.cloud.compute.v1.DeleteAddressHttpRequest; +import com.google.cloud.compute.v1.GetAddressHttpRequest; +import com.google.cloud.compute.v1.InsertAddressHttpRequest; +import com.google.cloud.compute.v1.ListAddressesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectRegionAddressName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonAddressStub extends AddressStub { + @InternalApi + public static final ApiMethodDescriptor + aggregatedListAddressesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.addresses.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/addresses")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(AddressAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteAddressMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.addresses.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/addresses/{address}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionAddressName.newFactory()) + .setResourceNameField("address") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getAddressMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.addresses.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/addresses/{address}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionAddressName.newFactory()) + .setResourceNameField("address") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.

newBuilder() + .setResponseInstance(Address.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertAddressMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.addresses.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions/{region}/addresses")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listAddressesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.addresses.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions/{region}/addresses")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(AddressList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + aggregatedListAddressesCallable; + private final UnaryCallable< + AggregatedListAddressesHttpRequest, AggregatedListAddressesPagedResponse> + aggregatedListAddressesPagedCallable; + private final UnaryCallable deleteAddressCallable; + private final UnaryCallable getAddressCallable; + private final UnaryCallable insertAddressCallable; + private final UnaryCallable listAddressesCallable; + private final UnaryCallable + listAddressesPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonAddressStub create(AddressStubSettings settings) throws IOException { + return new HttpJsonAddressStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonAddressStub create(ClientContext clientContext) throws IOException { + return new HttpJsonAddressStub(AddressStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonAddressStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonAddressStub( + AddressStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonAddressStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonAddressStub(AddressStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonAddressCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonAddressStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonAddressStub( + AddressStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListAddressesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListAddressesMethodDescriptor) + .build(); + HttpJsonCallSettings deleteAddressTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAddressMethodDescriptor) + .build(); + HttpJsonCallSettings getAddressTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAddressMethodDescriptor) + .build(); + HttpJsonCallSettings insertAddressTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertAddressMethodDescriptor) + .build(); + HttpJsonCallSettings listAddressesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listAddressesMethodDescriptor) + .build(); + + this.aggregatedListAddressesCallable = + callableFactory.createUnaryCallable( + aggregatedListAddressesTransportSettings, + settings.aggregatedListAddressesSettings(), + clientContext); + this.aggregatedListAddressesPagedCallable = + callableFactory.createPagedCallable( + aggregatedListAddressesTransportSettings, + settings.aggregatedListAddressesSettings(), + clientContext); + this.deleteAddressCallable = + callableFactory.createUnaryCallable( + deleteAddressTransportSettings, settings.deleteAddressSettings(), clientContext); + this.getAddressCallable = + callableFactory.createUnaryCallable( + getAddressTransportSettings, settings.getAddressSettings(), clientContext); + this.insertAddressCallable = + callableFactory.createUnaryCallable( + insertAddressTransportSettings, settings.insertAddressSettings(), clientContext); + this.listAddressesCallable = + callableFactory.createUnaryCallable( + listAddressesTransportSettings, settings.listAddressesSettings(), clientContext); + this.listAddressesPagedCallable = + callableFactory.createPagedCallable( + listAddressesTransportSettings, settings.listAddressesSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + aggregatedListAddressesPagedCallable() { + return aggregatedListAddressesPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListAddressesCallable() { + return aggregatedListAddressesCallable; + } + + @BetaApi + public UnaryCallable deleteAddressCallable() { + return deleteAddressCallable; + } + + @BetaApi + public UnaryCallable getAddressCallable() { + return getAddressCallable; + } + + @BetaApi + public UnaryCallable insertAddressCallable() { + return insertAddressCallable; + } + + @BetaApi + public UnaryCallable + listAddressesPagedCallable() { + return listAddressesPagedCallable; + } + + @BetaApi + public UnaryCallable listAddressesCallable() { + return listAddressesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAutoscalerCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAutoscalerCallableFactory.java new file mode 100644 index 000000000000..72e927a72753 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAutoscalerCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonAutoscalerCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAutoscalerStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAutoscalerStub.java new file mode 100644 index 000000000000..5247f8519acd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonAutoscalerStub.java @@ -0,0 +1,401 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.AutoscalerClient.AggregatedListAutoscalersPagedResponse; +import static com.google.cloud.compute.v1.AutoscalerClient.ListAutoscalersPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListAutoscalersHttpRequest; +import com.google.cloud.compute.v1.Autoscaler; +import com.google.cloud.compute.v1.AutoscalerAggregatedList; +import com.google.cloud.compute.v1.AutoscalerList; +import com.google.cloud.compute.v1.DeleteAutoscalerHttpRequest; +import com.google.cloud.compute.v1.GetAutoscalerHttpRequest; +import com.google.cloud.compute.v1.InsertAutoscalerHttpRequest; +import com.google.cloud.compute.v1.ListAutoscalersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchAutoscalerHttpRequest; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectZoneAutoscalerName; +import com.google.cloud.compute.v1.ProjectZoneName; +import com.google.cloud.compute.v1.UpdateAutoscalerHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonAutoscalerStub extends AutoscalerStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListAutoscalersHttpRequest, AutoscalerAggregatedList> + aggregatedListAutoscalersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.autoscalers.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/autoscalers")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(AutoscalerAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteAutoscalerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.autoscalers.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/autoscalers/{autoscaler}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneAutoscalerName.newFactory()) + .setResourceNameField("autoscaler") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getAutoscalerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.autoscalers.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/autoscalers/{autoscaler}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneAutoscalerName.newFactory()) + .setResourceNameField("autoscaler") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Autoscaler.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertAutoscalerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.autoscalers.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/autoscalers")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listAutoscalersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.autoscalers.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/autoscalers")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(AutoscalerList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchAutoscalerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.autoscalers.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/autoscalers")) + .setQueryParams(Sets.newHashSet("autoscaler", "requestId")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateAutoscalerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.autoscalers.update") + .setHttpMethod(HttpMethods.PUT) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/autoscalers")) + .setQueryParams(Sets.newHashSet("autoscaler", "requestId")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + aggregatedListAutoscalersCallable; + private final UnaryCallable< + AggregatedListAutoscalersHttpRequest, AggregatedListAutoscalersPagedResponse> + aggregatedListAutoscalersPagedCallable; + private final UnaryCallable deleteAutoscalerCallable; + private final UnaryCallable getAutoscalerCallable; + private final UnaryCallable insertAutoscalerCallable; + private final UnaryCallable listAutoscalersCallable; + private final UnaryCallable + listAutoscalersPagedCallable; + private final UnaryCallable patchAutoscalerCallable; + private final UnaryCallable updateAutoscalerCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonAutoscalerStub create(AutoscalerStubSettings settings) + throws IOException { + return new HttpJsonAutoscalerStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonAutoscalerStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonAutoscalerStub(AutoscalerStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonAutoscalerStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonAutoscalerStub( + AutoscalerStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonAutoscalerStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonAutoscalerStub(AutoscalerStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonAutoscalerCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonAutoscalerStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonAutoscalerStub( + AutoscalerStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListAutoscalersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListAutoscalersMethodDescriptor) + .build(); + HttpJsonCallSettings deleteAutoscalerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAutoscalerMethodDescriptor) + .build(); + HttpJsonCallSettings getAutoscalerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAutoscalerMethodDescriptor) + .build(); + HttpJsonCallSettings insertAutoscalerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertAutoscalerMethodDescriptor) + .build(); + HttpJsonCallSettings + listAutoscalersTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listAutoscalersMethodDescriptor) + .build(); + HttpJsonCallSettings patchAutoscalerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchAutoscalerMethodDescriptor) + .build(); + HttpJsonCallSettings updateAutoscalerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateAutoscalerMethodDescriptor) + .build(); + + this.aggregatedListAutoscalersCallable = + callableFactory.createUnaryCallable( + aggregatedListAutoscalersTransportSettings, + settings.aggregatedListAutoscalersSettings(), + clientContext); + this.aggregatedListAutoscalersPagedCallable = + callableFactory.createPagedCallable( + aggregatedListAutoscalersTransportSettings, + settings.aggregatedListAutoscalersSettings(), + clientContext); + this.deleteAutoscalerCallable = + callableFactory.createUnaryCallable( + deleteAutoscalerTransportSettings, settings.deleteAutoscalerSettings(), clientContext); + this.getAutoscalerCallable = + callableFactory.createUnaryCallable( + getAutoscalerTransportSettings, settings.getAutoscalerSettings(), clientContext); + this.insertAutoscalerCallable = + callableFactory.createUnaryCallable( + insertAutoscalerTransportSettings, settings.insertAutoscalerSettings(), clientContext); + this.listAutoscalersCallable = + callableFactory.createUnaryCallable( + listAutoscalersTransportSettings, settings.listAutoscalersSettings(), clientContext); + this.listAutoscalersPagedCallable = + callableFactory.createPagedCallable( + listAutoscalersTransportSettings, settings.listAutoscalersSettings(), clientContext); + this.patchAutoscalerCallable = + callableFactory.createUnaryCallable( + patchAutoscalerTransportSettings, settings.patchAutoscalerSettings(), clientContext); + this.updateAutoscalerCallable = + callableFactory.createUnaryCallable( + updateAutoscalerTransportSettings, settings.updateAutoscalerSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + aggregatedListAutoscalersPagedCallable() { + return aggregatedListAutoscalersPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListAutoscalersCallable() { + return aggregatedListAutoscalersCallable; + } + + @BetaApi + public UnaryCallable deleteAutoscalerCallable() { + return deleteAutoscalerCallable; + } + + @BetaApi + public UnaryCallable getAutoscalerCallable() { + return getAutoscalerCallable; + } + + @BetaApi + public UnaryCallable insertAutoscalerCallable() { + return insertAutoscalerCallable; + } + + @BetaApi + public UnaryCallable + listAutoscalersPagedCallable() { + return listAutoscalersPagedCallable; + } + + @BetaApi + public UnaryCallable listAutoscalersCallable() { + return listAutoscalersCallable; + } + + @BetaApi + public UnaryCallable patchAutoscalerCallable() { + return patchAutoscalerCallable; + } + + @BetaApi + public UnaryCallable updateAutoscalerCallable() { + return updateAutoscalerCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendBucketCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendBucketCallableFactory.java new file mode 100644 index 000000000000..d5c304703394 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendBucketCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonBackendBucketCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendBucketStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendBucketStub.java new file mode 100644 index 000000000000..e293e0781306 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendBucketStub.java @@ -0,0 +1,367 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.BackendBucketClient.ListBackendBucketsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.BackendBucket; +import com.google.cloud.compute.v1.BackendBucketList; +import com.google.cloud.compute.v1.DeleteBackendBucketHttpRequest; +import com.google.cloud.compute.v1.GetBackendBucketHttpRequest; +import com.google.cloud.compute.v1.InsertBackendBucketHttpRequest; +import com.google.cloud.compute.v1.ListBackendBucketsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchBackendBucketHttpRequest; +import com.google.cloud.compute.v1.ProjectGlobalBackendBucketName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.UpdateBackendBucketHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonBackendBucketStub extends BackendBucketStub { + @InternalApi + public static final ApiMethodDescriptor + deleteBackendBucketMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendBuckets.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/backendBuckets/{backendBucket}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalBackendBucketName.newFactory()) + .setResourceNameField("backendBucket") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getBackendBucketMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendBuckets.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/backendBuckets/{backendBucket}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalBackendBucketName.newFactory()) + .setResourceNameField("backendBucket") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(BackendBucket.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertBackendBucketMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendBuckets.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/backendBuckets")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listBackendBucketsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendBuckets.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/backendBuckets")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(BackendBucketList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchBackendBucketMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendBuckets.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/backendBuckets/{backendBucket}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalBackendBucketName.newFactory()) + .setResourceNameField("backendBucket") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateBackendBucketMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendBuckets.update") + .setHttpMethod(HttpMethods.PUT) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/backendBuckets/{backendBucket}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalBackendBucketName.newFactory()) + .setResourceNameField("backendBucket") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteBackendBucketCallable; + private final UnaryCallable getBackendBucketCallable; + private final UnaryCallable + insertBackendBucketCallable; + private final UnaryCallable + listBackendBucketsCallable; + private final UnaryCallable + listBackendBucketsPagedCallable; + private final UnaryCallable patchBackendBucketCallable; + private final UnaryCallable + updateBackendBucketCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonBackendBucketStub create(BackendBucketStubSettings settings) + throws IOException { + return new HttpJsonBackendBucketStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonBackendBucketStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonBackendBucketStub( + BackendBucketStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonBackendBucketStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonBackendBucketStub( + BackendBucketStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonBackendBucketStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonBackendBucketStub( + BackendBucketStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonBackendBucketCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonBackendBucketStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonBackendBucketStub( + BackendBucketStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteBackendBucketTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteBackendBucketMethodDescriptor) + .build(); + HttpJsonCallSettings + getBackendBucketTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getBackendBucketMethodDescriptor) + .build(); + HttpJsonCallSettings + insertBackendBucketTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertBackendBucketMethodDescriptor) + .build(); + HttpJsonCallSettings + listBackendBucketsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listBackendBucketsMethodDescriptor) + .build(); + HttpJsonCallSettings + patchBackendBucketTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchBackendBucketMethodDescriptor) + .build(); + HttpJsonCallSettings + updateBackendBucketTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateBackendBucketMethodDescriptor) + .build(); + + this.deleteBackendBucketCallable = + callableFactory.createUnaryCallable( + deleteBackendBucketTransportSettings, + settings.deleteBackendBucketSettings(), + clientContext); + this.getBackendBucketCallable = + callableFactory.createUnaryCallable( + getBackendBucketTransportSettings, settings.getBackendBucketSettings(), clientContext); + this.insertBackendBucketCallable = + callableFactory.createUnaryCallable( + insertBackendBucketTransportSettings, + settings.insertBackendBucketSettings(), + clientContext); + this.listBackendBucketsCallable = + callableFactory.createUnaryCallable( + listBackendBucketsTransportSettings, + settings.listBackendBucketsSettings(), + clientContext); + this.listBackendBucketsPagedCallable = + callableFactory.createPagedCallable( + listBackendBucketsTransportSettings, + settings.listBackendBucketsSettings(), + clientContext); + this.patchBackendBucketCallable = + callableFactory.createUnaryCallable( + patchBackendBucketTransportSettings, + settings.patchBackendBucketSettings(), + clientContext); + this.updateBackendBucketCallable = + callableFactory.createUnaryCallable( + updateBackendBucketTransportSettings, + settings.updateBackendBucketSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteBackendBucketCallable() { + return deleteBackendBucketCallable; + } + + @BetaApi + public UnaryCallable getBackendBucketCallable() { + return getBackendBucketCallable; + } + + @BetaApi + public UnaryCallable insertBackendBucketCallable() { + return insertBackendBucketCallable; + } + + @BetaApi + public UnaryCallable + listBackendBucketsPagedCallable() { + return listBackendBucketsPagedCallable; + } + + @BetaApi + public UnaryCallable + listBackendBucketsCallable() { + return listBackendBucketsCallable; + } + + @BetaApi + public UnaryCallable patchBackendBucketCallable() { + return patchBackendBucketCallable; + } + + @BetaApi + public UnaryCallable updateBackendBucketCallable() { + return updateBackendBucketCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendServiceCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendServiceCallableFactory.java new file mode 100644 index 000000000000..2e6d68cd1908 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendServiceCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonBackendServiceCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendServiceStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendServiceStub.java new file mode 100644 index 000000000000..707e2defa242 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonBackendServiceStub.java @@ -0,0 +1,477 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.BackendServiceClient.AggregatedListBackendServicesPagedResponse; +import static com.google.cloud.compute.v1.BackendServiceClient.ListBackendServicesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListBackendServicesHttpRequest; +import com.google.cloud.compute.v1.BackendService; +import com.google.cloud.compute.v1.BackendServiceAggregatedList; +import com.google.cloud.compute.v1.BackendServiceGroupHealth; +import com.google.cloud.compute.v1.BackendServiceList; +import com.google.cloud.compute.v1.DeleteBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetHealthBackendServiceHttpRequest; +import com.google.cloud.compute.v1.InsertBackendServiceHttpRequest; +import com.google.cloud.compute.v1.ListBackendServicesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchBackendServiceHttpRequest; +import com.google.cloud.compute.v1.ProjectGlobalBackendServiceName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.UpdateBackendServiceHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonBackendServiceStub extends BackendServiceStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList> + aggregatedListBackendServicesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.backendServices.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/backendServices")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(BackendServiceAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteBackendServiceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendServices.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/backendServices/{backendService}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalBackendServiceName.newFactory()) + .setResourceNameField("backendService") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getBackendServiceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendServices.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/backendServices/{backendService}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalBackendServiceName.newFactory()) + .setResourceNameField("backendService") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(BackendService.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + GetHealthBackendServiceHttpRequest, BackendServiceGroupHealth> + getHealthBackendServiceMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.backendServices.getHealth") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/backendServices/{backendService}/getHealth")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalBackendServiceName.newFactory()) + .setResourceNameField("backendService") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(BackendServiceGroupHealth.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertBackendServiceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendServices.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/backendServices")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listBackendServicesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendServices.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/backendServices")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(BackendServiceList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchBackendServiceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendServices.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/backendServices/{backendService}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalBackendServiceName.newFactory()) + .setResourceNameField("backendService") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateBackendServiceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.backendServices.update") + .setHttpMethod(HttpMethods.PUT) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/backendServices/{backendService}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalBackendServiceName.newFactory()) + .setResourceNameField("backendService") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable< + AggregatedListBackendServicesHttpRequest, BackendServiceAggregatedList> + aggregatedListBackendServicesCallable; + private final UnaryCallable< + AggregatedListBackendServicesHttpRequest, AggregatedListBackendServicesPagedResponse> + aggregatedListBackendServicesPagedCallable; + private final UnaryCallable + deleteBackendServiceCallable; + private final UnaryCallable + getBackendServiceCallable; + private final UnaryCallable + getHealthBackendServiceCallable; + private final UnaryCallable + insertBackendServiceCallable; + private final UnaryCallable + listBackendServicesCallable; + private final UnaryCallable + listBackendServicesPagedCallable; + private final UnaryCallable + patchBackendServiceCallable; + private final UnaryCallable + updateBackendServiceCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonBackendServiceStub create(BackendServiceStubSettings settings) + throws IOException { + return new HttpJsonBackendServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonBackendServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonBackendServiceStub( + BackendServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonBackendServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonBackendServiceStub( + BackendServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonBackendServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonBackendServiceStub( + BackendServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonBackendServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonBackendServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonBackendServiceStub( + BackendServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListBackendServicesTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(aggregatedListBackendServicesMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteBackendServiceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteBackendServiceMethodDescriptor) + .build(); + HttpJsonCallSettings + getBackendServiceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getBackendServiceMethodDescriptor) + .build(); + HttpJsonCallSettings + getHealthBackendServiceTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getHealthBackendServiceMethodDescriptor) + .build(); + HttpJsonCallSettings + insertBackendServiceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertBackendServiceMethodDescriptor) + .build(); + HttpJsonCallSettings + listBackendServicesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listBackendServicesMethodDescriptor) + .build(); + HttpJsonCallSettings + patchBackendServiceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchBackendServiceMethodDescriptor) + .build(); + HttpJsonCallSettings + updateBackendServiceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateBackendServiceMethodDescriptor) + .build(); + + this.aggregatedListBackendServicesCallable = + callableFactory.createUnaryCallable( + aggregatedListBackendServicesTransportSettings, + settings.aggregatedListBackendServicesSettings(), + clientContext); + this.aggregatedListBackendServicesPagedCallable = + callableFactory.createPagedCallable( + aggregatedListBackendServicesTransportSettings, + settings.aggregatedListBackendServicesSettings(), + clientContext); + this.deleteBackendServiceCallable = + callableFactory.createUnaryCallable( + deleteBackendServiceTransportSettings, + settings.deleteBackendServiceSettings(), + clientContext); + this.getBackendServiceCallable = + callableFactory.createUnaryCallable( + getBackendServiceTransportSettings, + settings.getBackendServiceSettings(), + clientContext); + this.getHealthBackendServiceCallable = + callableFactory.createUnaryCallable( + getHealthBackendServiceTransportSettings, + settings.getHealthBackendServiceSettings(), + clientContext); + this.insertBackendServiceCallable = + callableFactory.createUnaryCallable( + insertBackendServiceTransportSettings, + settings.insertBackendServiceSettings(), + clientContext); + this.listBackendServicesCallable = + callableFactory.createUnaryCallable( + listBackendServicesTransportSettings, + settings.listBackendServicesSettings(), + clientContext); + this.listBackendServicesPagedCallable = + callableFactory.createPagedCallable( + listBackendServicesTransportSettings, + settings.listBackendServicesSettings(), + clientContext); + this.patchBackendServiceCallable = + callableFactory.createUnaryCallable( + patchBackendServiceTransportSettings, + settings.patchBackendServiceSettings(), + clientContext); + this.updateBackendServiceCallable = + callableFactory.createUnaryCallable( + updateBackendServiceTransportSettings, + settings.updateBackendServiceSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable< + AggregatedListBackendServicesHttpRequest, AggregatedListBackendServicesPagedResponse> + aggregatedListBackendServicesPagedCallable() { + return aggregatedListBackendServicesPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListBackendServicesCallable() { + return aggregatedListBackendServicesCallable; + } + + @BetaApi + public UnaryCallable deleteBackendServiceCallable() { + return deleteBackendServiceCallable; + } + + @BetaApi + public UnaryCallable getBackendServiceCallable() { + return getBackendServiceCallable; + } + + @BetaApi + public UnaryCallable + getHealthBackendServiceCallable() { + return getHealthBackendServiceCallable; + } + + @BetaApi + public UnaryCallable insertBackendServiceCallable() { + return insertBackendServiceCallable; + } + + @BetaApi + public UnaryCallable + listBackendServicesPagedCallable() { + return listBackendServicesPagedCallable; + } + + @BetaApi + public UnaryCallable + listBackendServicesCallable() { + return listBackendServicesCallable; + } + + @BetaApi + public UnaryCallable patchBackendServiceCallable() { + return patchBackendServiceCallable; + } + + @BetaApi + public UnaryCallable updateBackendServiceCallable() { + return updateBackendServiceCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskCallableFactory.java new file mode 100644 index 000000000000..6b35ba6b38f6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonDiskCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskStub.java new file mode 100644 index 000000000000..601895c004fb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskStub.java @@ -0,0 +1,427 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.DiskClient.AggregatedListDisksPagedResponse; +import static com.google.cloud.compute.v1.DiskClient.ListDisksPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListDisksHttpRequest; +import com.google.cloud.compute.v1.CreateSnapshotDiskHttpRequest; +import com.google.cloud.compute.v1.DeleteDiskHttpRequest; +import com.google.cloud.compute.v1.Disk; +import com.google.cloud.compute.v1.DiskAggregatedList; +import com.google.cloud.compute.v1.DiskList; +import com.google.cloud.compute.v1.GetDiskHttpRequest; +import com.google.cloud.compute.v1.InsertDiskHttpRequest; +import com.google.cloud.compute.v1.ListDisksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectZoneDiskName; +import com.google.cloud.compute.v1.ProjectZoneDiskResourceName; +import com.google.cloud.compute.v1.ProjectZoneName; +import com.google.cloud.compute.v1.ResizeDiskHttpRequest; +import com.google.cloud.compute.v1.SetLabelsDiskHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonDiskStub extends DiskStub { + @InternalApi + public static final ApiMethodDescriptor + aggregatedListDisksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.disks.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/disks")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(DiskAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + createSnapshotDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.disks.createSnapshot") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/disks/{disk}/createSnapshot")) + .setQueryParams(Sets.newHashSet("guestFlush", "requestId")) + .setResourceNameFactory(ProjectZoneDiskName.newFactory()) + .setResourceNameField("disk") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.disks.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/disks/{disk}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneDiskName.newFactory()) + .setResourceNameField("disk") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor getDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.disks.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/disks/{disk}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneDiskName.newFactory()) + .setResourceNameField("disk") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Disk.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.disks.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/disks")) + .setQueryParams(Sets.newHashSet("requestId", "sourceImage")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listDisksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.disks.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/disks")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(DiskList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + resizeDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.disks.resize") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/disks/{disk}/resize")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneDiskName.newFactory()) + .setResourceNameField("disk") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setLabelsDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.disks.setLabels") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/disks/{resource}/setLabels")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneDiskResourceName.newFactory()) + .setResourceNameField("resource") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + aggregatedListDisksCallable; + private final UnaryCallable + aggregatedListDisksPagedCallable; + private final UnaryCallable createSnapshotDiskCallable; + private final UnaryCallable deleteDiskCallable; + private final UnaryCallable getDiskCallable; + private final UnaryCallable insertDiskCallable; + private final UnaryCallable listDisksCallable; + private final UnaryCallable listDisksPagedCallable; + private final UnaryCallable resizeDiskCallable; + private final UnaryCallable setLabelsDiskCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDiskStub create(DiskStubSettings settings) throws IOException { + return new HttpJsonDiskStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDiskStub create(ClientContext clientContext) throws IOException { + return new HttpJsonDiskStub(DiskStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonDiskStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDiskStub( + DiskStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDiskStub, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected HttpJsonDiskStub(DiskStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonDiskCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDiskStub, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected HttpJsonDiskStub( + DiskStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListDisksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(aggregatedListDisksMethodDescriptor) + .build(); + HttpJsonCallSettings + createSnapshotDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createSnapshotDiskMethodDescriptor) + .build(); + HttpJsonCallSettings deleteDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteDiskMethodDescriptor) + .build(); + HttpJsonCallSettings getDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getDiskMethodDescriptor) + .build(); + HttpJsonCallSettings insertDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertDiskMethodDescriptor) + .build(); + HttpJsonCallSettings listDisksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listDisksMethodDescriptor) + .build(); + HttpJsonCallSettings resizeDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(resizeDiskMethodDescriptor) + .build(); + HttpJsonCallSettings setLabelsDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setLabelsDiskMethodDescriptor) + .build(); + + this.aggregatedListDisksCallable = + callableFactory.createUnaryCallable( + aggregatedListDisksTransportSettings, + settings.aggregatedListDisksSettings(), + clientContext); + this.aggregatedListDisksPagedCallable = + callableFactory.createPagedCallable( + aggregatedListDisksTransportSettings, + settings.aggregatedListDisksSettings(), + clientContext); + this.createSnapshotDiskCallable = + callableFactory.createUnaryCallable( + createSnapshotDiskTransportSettings, + settings.createSnapshotDiskSettings(), + clientContext); + this.deleteDiskCallable = + callableFactory.createUnaryCallable( + deleteDiskTransportSettings, settings.deleteDiskSettings(), clientContext); + this.getDiskCallable = + callableFactory.createUnaryCallable( + getDiskTransportSettings, settings.getDiskSettings(), clientContext); + this.insertDiskCallable = + callableFactory.createUnaryCallable( + insertDiskTransportSettings, settings.insertDiskSettings(), clientContext); + this.listDisksCallable = + callableFactory.createUnaryCallable( + listDisksTransportSettings, settings.listDisksSettings(), clientContext); + this.listDisksPagedCallable = + callableFactory.createPagedCallable( + listDisksTransportSettings, settings.listDisksSettings(), clientContext); + this.resizeDiskCallable = + callableFactory.createUnaryCallable( + resizeDiskTransportSettings, settings.resizeDiskSettings(), clientContext); + this.setLabelsDiskCallable = + callableFactory.createUnaryCallable( + setLabelsDiskTransportSettings, settings.setLabelsDiskSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + aggregatedListDisksPagedCallable() { + return aggregatedListDisksPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListDisksCallable() { + return aggregatedListDisksCallable; + } + + @BetaApi + public UnaryCallable createSnapshotDiskCallable() { + return createSnapshotDiskCallable; + } + + @BetaApi + public UnaryCallable deleteDiskCallable() { + return deleteDiskCallable; + } + + @BetaApi + public UnaryCallable getDiskCallable() { + return getDiskCallable; + } + + @BetaApi + public UnaryCallable insertDiskCallable() { + return insertDiskCallable; + } + + @BetaApi + public UnaryCallable listDisksPagedCallable() { + return listDisksPagedCallable; + } + + @BetaApi + public UnaryCallable listDisksCallable() { + return listDisksCallable; + } + + @BetaApi + public UnaryCallable resizeDiskCallable() { + return resizeDiskCallable; + } + + @BetaApi + public UnaryCallable setLabelsDiskCallable() { + return setLabelsDiskCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskTypeCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskTypeCallableFactory.java new file mode 100644 index 000000000000..6408a26b6d3a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskTypeCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonDiskTypeCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskTypeStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskTypeStub.java new file mode 100644 index 000000000000..8831d983a454 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonDiskTypeStub.java @@ -0,0 +1,265 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.DiskTypeClient.AggregatedListDiskTypesPagedResponse; +import static com.google.cloud.compute.v1.DiskTypeClient.ListDiskTypesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListDiskTypesHttpRequest; +import com.google.cloud.compute.v1.DiskType; +import com.google.cloud.compute.v1.DiskTypeAggregatedList; +import com.google.cloud.compute.v1.DiskTypeList; +import com.google.cloud.compute.v1.GetDiskTypeHttpRequest; +import com.google.cloud.compute.v1.ListDiskTypesHttpRequest; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectZoneDiskTypeName; +import com.google.cloud.compute.v1.ProjectZoneName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonDiskTypeStub extends DiskTypeStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListDiskTypesHttpRequest, DiskTypeAggregatedList> + aggregatedListDiskTypesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.diskTypes.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/diskTypes")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(DiskTypeAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getDiskTypeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.diskTypes.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/diskTypes/{diskType}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneDiskTypeName.newFactory()) + .setResourceNameField("diskType") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(DiskType.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listDiskTypesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.diskTypes.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/diskTypes")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(DiskTypeList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + aggregatedListDiskTypesCallable; + private final UnaryCallable< + AggregatedListDiskTypesHttpRequest, AggregatedListDiskTypesPagedResponse> + aggregatedListDiskTypesPagedCallable; + private final UnaryCallable getDiskTypeCallable; + private final UnaryCallable listDiskTypesCallable; + private final UnaryCallable + listDiskTypesPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDiskTypeStub create(DiskTypeStubSettings settings) + throws IOException { + return new HttpJsonDiskTypeStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDiskTypeStub create(ClientContext clientContext) throws IOException { + return new HttpJsonDiskTypeStub(DiskTypeStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonDiskTypeStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDiskTypeStub( + DiskTypeStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDiskTypeStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDiskTypeStub(DiskTypeStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonDiskTypeCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDiskTypeStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDiskTypeStub( + DiskTypeStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListDiskTypesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListDiskTypesMethodDescriptor) + .build(); + HttpJsonCallSettings getDiskTypeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getDiskTypeMethodDescriptor) + .build(); + HttpJsonCallSettings listDiskTypesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listDiskTypesMethodDescriptor) + .build(); + + this.aggregatedListDiskTypesCallable = + callableFactory.createUnaryCallable( + aggregatedListDiskTypesTransportSettings, + settings.aggregatedListDiskTypesSettings(), + clientContext); + this.aggregatedListDiskTypesPagedCallable = + callableFactory.createPagedCallable( + aggregatedListDiskTypesTransportSettings, + settings.aggregatedListDiskTypesSettings(), + clientContext); + this.getDiskTypeCallable = + callableFactory.createUnaryCallable( + getDiskTypeTransportSettings, settings.getDiskTypeSettings(), clientContext); + this.listDiskTypesCallable = + callableFactory.createUnaryCallable( + listDiskTypesTransportSettings, settings.listDiskTypesSettings(), clientContext); + this.listDiskTypesPagedCallable = + callableFactory.createPagedCallable( + listDiskTypesTransportSettings, settings.listDiskTypesSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + aggregatedListDiskTypesPagedCallable() { + return aggregatedListDiskTypesPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListDiskTypesCallable() { + return aggregatedListDiskTypesCallable; + } + + @BetaApi + public UnaryCallable getDiskTypeCallable() { + return getDiskTypeCallable; + } + + @BetaApi + public UnaryCallable + listDiskTypesPagedCallable() { + return listDiskTypesPagedCallable; + } + + @BetaApi + public UnaryCallable listDiskTypesCallable() { + return listDiskTypesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonFirewallCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonFirewallCallableFactory.java new file mode 100644 index 000000000000..ad34a00a93a9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonFirewallCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonFirewallCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonFirewallStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonFirewallStub.java new file mode 100644 index 000000000000..468a6224f60a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonFirewallStub.java @@ -0,0 +1,338 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.FirewallClient.ListFirewallsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteFirewallHttpRequest; +import com.google.cloud.compute.v1.Firewall; +import com.google.cloud.compute.v1.FirewallList; +import com.google.cloud.compute.v1.GetFirewallHttpRequest; +import com.google.cloud.compute.v1.InsertFirewallHttpRequest; +import com.google.cloud.compute.v1.ListFirewallsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchFirewallHttpRequest; +import com.google.cloud.compute.v1.ProjectGlobalFirewallName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.UpdateFirewallHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonFirewallStub extends FirewallStub { + @InternalApi + public static final ApiMethodDescriptor + deleteFirewallMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.firewalls.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/firewalls/{firewall}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalFirewallName.newFactory()) + .setResourceNameField("firewall") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getFirewallMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.firewalls.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/firewalls/{firewall}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalFirewallName.newFactory()) + .setResourceNameField("firewall") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Firewall.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertFirewallMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.firewalls.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/firewalls")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listFirewallsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.firewalls.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/firewalls")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(FirewallList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchFirewallMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.firewalls.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/firewalls/{firewall}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalFirewallName.newFactory()) + .setResourceNameField("firewall") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateFirewallMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.firewalls.update") + .setHttpMethod(HttpMethods.PUT) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/firewalls/{firewall}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalFirewallName.newFactory()) + .setResourceNameField("firewall") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable deleteFirewallCallable; + private final UnaryCallable getFirewallCallable; + private final UnaryCallable insertFirewallCallable; + private final UnaryCallable listFirewallsCallable; + private final UnaryCallable + listFirewallsPagedCallable; + private final UnaryCallable patchFirewallCallable; + private final UnaryCallable updateFirewallCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonFirewallStub create(FirewallStubSettings settings) + throws IOException { + return new HttpJsonFirewallStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonFirewallStub create(ClientContext clientContext) throws IOException { + return new HttpJsonFirewallStub(FirewallStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonFirewallStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonFirewallStub( + FirewallStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonFirewallStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonFirewallStub(FirewallStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonFirewallCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonFirewallStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonFirewallStub( + FirewallStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings deleteFirewallTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteFirewallMethodDescriptor) + .build(); + HttpJsonCallSettings getFirewallTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getFirewallMethodDescriptor) + .build(); + HttpJsonCallSettings insertFirewallTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertFirewallMethodDescriptor) + .build(); + HttpJsonCallSettings listFirewallsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listFirewallsMethodDescriptor) + .build(); + HttpJsonCallSettings patchFirewallTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchFirewallMethodDescriptor) + .build(); + HttpJsonCallSettings updateFirewallTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateFirewallMethodDescriptor) + .build(); + + this.deleteFirewallCallable = + callableFactory.createUnaryCallable( + deleteFirewallTransportSettings, settings.deleteFirewallSettings(), clientContext); + this.getFirewallCallable = + callableFactory.createUnaryCallable( + getFirewallTransportSettings, settings.getFirewallSettings(), clientContext); + this.insertFirewallCallable = + callableFactory.createUnaryCallable( + insertFirewallTransportSettings, settings.insertFirewallSettings(), clientContext); + this.listFirewallsCallable = + callableFactory.createUnaryCallable( + listFirewallsTransportSettings, settings.listFirewallsSettings(), clientContext); + this.listFirewallsPagedCallable = + callableFactory.createPagedCallable( + listFirewallsTransportSettings, settings.listFirewallsSettings(), clientContext); + this.patchFirewallCallable = + callableFactory.createUnaryCallable( + patchFirewallTransportSettings, settings.patchFirewallSettings(), clientContext); + this.updateFirewallCallable = + callableFactory.createUnaryCallable( + updateFirewallTransportSettings, settings.updateFirewallSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteFirewallCallable() { + return deleteFirewallCallable; + } + + @BetaApi + public UnaryCallable getFirewallCallable() { + return getFirewallCallable; + } + + @BetaApi + public UnaryCallable insertFirewallCallable() { + return insertFirewallCallable; + } + + @BetaApi + public UnaryCallable + listFirewallsPagedCallable() { + return listFirewallsPagedCallable; + } + + @BetaApi + public UnaryCallable listFirewallsCallable() { + return listFirewallsCallable; + } + + @BetaApi + public UnaryCallable patchFirewallCallable() { + return patchFirewallCallable; + } + + @BetaApi + public UnaryCallable updateFirewallCallable() { + return updateFirewallCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonForwardingRuleCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonForwardingRuleCallableFactory.java new file mode 100644 index 000000000000..d951fb6373f0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonForwardingRuleCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonForwardingRuleCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonForwardingRuleStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonForwardingRuleStub.java new file mode 100644 index 000000000000..f6adf2664a38 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonForwardingRuleStub.java @@ -0,0 +1,402 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ForwardingRuleClient.AggregatedListForwardingRulesPagedResponse; +import static com.google.cloud.compute.v1.ForwardingRuleClient.ListForwardingRulesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListForwardingRulesHttpRequest; +import com.google.cloud.compute.v1.DeleteForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ForwardingRule; +import com.google.cloud.compute.v1.ForwardingRuleAggregatedList; +import com.google.cloud.compute.v1.ForwardingRuleList; +import com.google.cloud.compute.v1.GetForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.InsertForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ListForwardingRulesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectRegionForwardingRuleName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.SetTargetForwardingRuleHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonForwardingRuleStub extends ForwardingRuleStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList> + aggregatedListForwardingRulesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.forwardingRules.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/forwardingRules")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(ForwardingRuleAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteForwardingRuleMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.forwardingRules.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/forwardingRules/{forwardingRule}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionForwardingRuleName.newFactory()) + .setResourceNameField("forwardingRule") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getForwardingRuleMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.forwardingRules.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/forwardingRules/{forwardingRule}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionForwardingRuleName.newFactory()) + .setResourceNameField("forwardingRule") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(ForwardingRule.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertForwardingRuleMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.forwardingRules.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/forwardingRules")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listForwardingRulesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.forwardingRules.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/forwardingRules")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(ForwardingRuleList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setTargetForwardingRuleMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.forwardingRules.setTarget") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/forwardingRules/{forwardingRule}/setTarget")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionForwardingRuleName.newFactory()) + .setResourceNameField("forwardingRule") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable< + AggregatedListForwardingRulesHttpRequest, ForwardingRuleAggregatedList> + aggregatedListForwardingRulesCallable; + private final UnaryCallable< + AggregatedListForwardingRulesHttpRequest, AggregatedListForwardingRulesPagedResponse> + aggregatedListForwardingRulesPagedCallable; + private final UnaryCallable + deleteForwardingRuleCallable; + private final UnaryCallable + getForwardingRuleCallable; + private final UnaryCallable + insertForwardingRuleCallable; + private final UnaryCallable + listForwardingRulesCallable; + private final UnaryCallable + listForwardingRulesPagedCallable; + private final UnaryCallable + setTargetForwardingRuleCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonForwardingRuleStub create(ForwardingRuleStubSettings settings) + throws IOException { + return new HttpJsonForwardingRuleStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonForwardingRuleStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonForwardingRuleStub( + ForwardingRuleStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonForwardingRuleStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonForwardingRuleStub( + ForwardingRuleStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonForwardingRuleStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonForwardingRuleStub( + ForwardingRuleStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonForwardingRuleCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonForwardingRuleStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonForwardingRuleStub( + ForwardingRuleStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListForwardingRulesTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(aggregatedListForwardingRulesMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteForwardingRuleTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteForwardingRuleMethodDescriptor) + .build(); + HttpJsonCallSettings + getForwardingRuleTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getForwardingRuleMethodDescriptor) + .build(); + HttpJsonCallSettings + insertForwardingRuleTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertForwardingRuleMethodDescriptor) + .build(); + HttpJsonCallSettings + listForwardingRulesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listForwardingRulesMethodDescriptor) + .build(); + HttpJsonCallSettings + setTargetForwardingRuleTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setTargetForwardingRuleMethodDescriptor) + .build(); + + this.aggregatedListForwardingRulesCallable = + callableFactory.createUnaryCallable( + aggregatedListForwardingRulesTransportSettings, + settings.aggregatedListForwardingRulesSettings(), + clientContext); + this.aggregatedListForwardingRulesPagedCallable = + callableFactory.createPagedCallable( + aggregatedListForwardingRulesTransportSettings, + settings.aggregatedListForwardingRulesSettings(), + clientContext); + this.deleteForwardingRuleCallable = + callableFactory.createUnaryCallable( + deleteForwardingRuleTransportSettings, + settings.deleteForwardingRuleSettings(), + clientContext); + this.getForwardingRuleCallable = + callableFactory.createUnaryCallable( + getForwardingRuleTransportSettings, + settings.getForwardingRuleSettings(), + clientContext); + this.insertForwardingRuleCallable = + callableFactory.createUnaryCallable( + insertForwardingRuleTransportSettings, + settings.insertForwardingRuleSettings(), + clientContext); + this.listForwardingRulesCallable = + callableFactory.createUnaryCallable( + listForwardingRulesTransportSettings, + settings.listForwardingRulesSettings(), + clientContext); + this.listForwardingRulesPagedCallable = + callableFactory.createPagedCallable( + listForwardingRulesTransportSettings, + settings.listForwardingRulesSettings(), + clientContext); + this.setTargetForwardingRuleCallable = + callableFactory.createUnaryCallable( + setTargetForwardingRuleTransportSettings, + settings.setTargetForwardingRuleSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable< + AggregatedListForwardingRulesHttpRequest, AggregatedListForwardingRulesPagedResponse> + aggregatedListForwardingRulesPagedCallable() { + return aggregatedListForwardingRulesPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListForwardingRulesCallable() { + return aggregatedListForwardingRulesCallable; + } + + @BetaApi + public UnaryCallable deleteForwardingRuleCallable() { + return deleteForwardingRuleCallable; + } + + @BetaApi + public UnaryCallable getForwardingRuleCallable() { + return getForwardingRuleCallable; + } + + @BetaApi + public UnaryCallable insertForwardingRuleCallable() { + return insertForwardingRuleCallable; + } + + @BetaApi + public UnaryCallable + listForwardingRulesPagedCallable() { + return listForwardingRulesPagedCallable; + } + + @BetaApi + public UnaryCallable + listForwardingRulesCallable() { + return listForwardingRulesCallable; + } + + @BetaApi + public UnaryCallable + setTargetForwardingRuleCallable() { + return setTargetForwardingRuleCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalAddressCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalAddressCallableFactory.java new file mode 100644 index 000000000000..7bfc99b5d0a8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalAddressCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonGlobalAddressCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalAddressStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalAddressStub.java new file mode 100644 index 000000000000..2b904500960f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalAddressStub.java @@ -0,0 +1,288 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.GlobalAddressClient.ListGlobalAddressesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.Address; +import com.google.cloud.compute.v1.AddressList; +import com.google.cloud.compute.v1.DeleteGlobalAddressHttpRequest; +import com.google.cloud.compute.v1.GetGlobalAddressHttpRequest; +import com.google.cloud.compute.v1.InsertGlobalAddressHttpRequest; +import com.google.cloud.compute.v1.ListGlobalAddressesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalAddressName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonGlobalAddressStub extends GlobalAddressStub { + @InternalApi + public static final ApiMethodDescriptor + deleteGlobalAddressMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalAddresses.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/addresses/{address}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalAddressName.newFactory()) + .setResourceNameField("address") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getGlobalAddressMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalAddresses.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/addresses/{address}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalAddressName.newFactory()) + .setResourceNameField("address") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.

newBuilder() + .setResponseInstance(Address.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertGlobalAddressMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalAddresses.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/addresses")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listGlobalAddressesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalAddresses.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/addresses")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(AddressList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteGlobalAddressCallable; + private final UnaryCallable getGlobalAddressCallable; + private final UnaryCallable + insertGlobalAddressCallable; + private final UnaryCallable + listGlobalAddressesCallable; + private final UnaryCallable + listGlobalAddressesPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonGlobalAddressStub create(GlobalAddressStubSettings settings) + throws IOException { + return new HttpJsonGlobalAddressStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonGlobalAddressStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonGlobalAddressStub( + GlobalAddressStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonGlobalAddressStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonGlobalAddressStub( + GlobalAddressStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonGlobalAddressStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonGlobalAddressStub( + GlobalAddressStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonGlobalAddressCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonGlobalAddressStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonGlobalAddressStub( + GlobalAddressStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteGlobalAddressTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteGlobalAddressMethodDescriptor) + .build(); + HttpJsonCallSettings getGlobalAddressTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getGlobalAddressMethodDescriptor) + .build(); + HttpJsonCallSettings + insertGlobalAddressTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertGlobalAddressMethodDescriptor) + .build(); + HttpJsonCallSettings + listGlobalAddressesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listGlobalAddressesMethodDescriptor) + .build(); + + this.deleteGlobalAddressCallable = + callableFactory.createUnaryCallable( + deleteGlobalAddressTransportSettings, + settings.deleteGlobalAddressSettings(), + clientContext); + this.getGlobalAddressCallable = + callableFactory.createUnaryCallable( + getGlobalAddressTransportSettings, settings.getGlobalAddressSettings(), clientContext); + this.insertGlobalAddressCallable = + callableFactory.createUnaryCallable( + insertGlobalAddressTransportSettings, + settings.insertGlobalAddressSettings(), + clientContext); + this.listGlobalAddressesCallable = + callableFactory.createUnaryCallable( + listGlobalAddressesTransportSettings, + settings.listGlobalAddressesSettings(), + clientContext); + this.listGlobalAddressesPagedCallable = + callableFactory.createPagedCallable( + listGlobalAddressesTransportSettings, + settings.listGlobalAddressesSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteGlobalAddressCallable() { + return deleteGlobalAddressCallable; + } + + @BetaApi + public UnaryCallable getGlobalAddressCallable() { + return getGlobalAddressCallable; + } + + @BetaApi + public UnaryCallable insertGlobalAddressCallable() { + return insertGlobalAddressCallable; + } + + @BetaApi + public UnaryCallable + listGlobalAddressesPagedCallable() { + return listGlobalAddressesPagedCallable; + } + + @BetaApi + public UnaryCallable listGlobalAddressesCallable() { + return listGlobalAddressesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalForwardingRuleCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalForwardingRuleCallableFactory.java new file mode 100644 index 000000000000..8d8918a8af20 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalForwardingRuleCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonGlobalForwardingRuleCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalForwardingRuleStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalForwardingRuleStub.java new file mode 100644 index 000000000000..fa77e0ea9c16 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalForwardingRuleStub.java @@ -0,0 +1,341 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteGlobalForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ForwardingRule; +import com.google.cloud.compute.v1.ForwardingRuleList; +import com.google.cloud.compute.v1.GetGlobalForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.InsertGlobalForwardingRuleHttpRequest; +import com.google.cloud.compute.v1.ListGlobalForwardingRulesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalForwardingRuleName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.SetTargetGlobalForwardingRuleHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonGlobalForwardingRuleStub extends GlobalForwardingRuleStub { + @InternalApi + public static final ApiMethodDescriptor + deleteGlobalForwardingRuleMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalForwardingRules.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/forwardingRules/{forwardingRule}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalForwardingRuleName.newFactory()) + .setResourceNameField("forwardingRule") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getGlobalForwardingRuleMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalForwardingRules.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/forwardingRules/{forwardingRule}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalForwardingRuleName.newFactory()) + .setResourceNameField("forwardingRule") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(ForwardingRule.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertGlobalForwardingRuleMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalForwardingRules.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/forwardingRules")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listGlobalForwardingRulesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalForwardingRules.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/forwardingRules")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(ForwardingRuleList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setTargetGlobalForwardingRuleMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalForwardingRules.setTarget") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/forwardingRules/{forwardingRule}/setTarget")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalForwardingRuleName.newFactory()) + .setResourceNameField("forwardingRule") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteGlobalForwardingRuleCallable; + private final UnaryCallable + getGlobalForwardingRuleCallable; + private final UnaryCallable + insertGlobalForwardingRuleCallable; + private final UnaryCallable + listGlobalForwardingRulesCallable; + private final UnaryCallable< + ListGlobalForwardingRulesHttpRequest, ListGlobalForwardingRulesPagedResponse> + listGlobalForwardingRulesPagedCallable; + private final UnaryCallable + setTargetGlobalForwardingRuleCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonGlobalForwardingRuleStub create( + GlobalForwardingRuleStubSettings settings) throws IOException { + return new HttpJsonGlobalForwardingRuleStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonGlobalForwardingRuleStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonGlobalForwardingRuleStub( + GlobalForwardingRuleStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonGlobalForwardingRuleStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonGlobalForwardingRuleStub( + GlobalForwardingRuleStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonGlobalForwardingRuleStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonGlobalForwardingRuleStub( + GlobalForwardingRuleStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonGlobalForwardingRuleCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonGlobalForwardingRuleStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonGlobalForwardingRuleStub( + GlobalForwardingRuleStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteGlobalForwardingRuleTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteGlobalForwardingRuleMethodDescriptor) + .build(); + HttpJsonCallSettings + getGlobalForwardingRuleTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getGlobalForwardingRuleMethodDescriptor) + .build(); + HttpJsonCallSettings + insertGlobalForwardingRuleTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertGlobalForwardingRuleMethodDescriptor) + .build(); + HttpJsonCallSettings + listGlobalForwardingRulesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listGlobalForwardingRulesMethodDescriptor) + .build(); + HttpJsonCallSettings + setTargetGlobalForwardingRuleTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setTargetGlobalForwardingRuleMethodDescriptor) + .build(); + + this.deleteGlobalForwardingRuleCallable = + callableFactory.createUnaryCallable( + deleteGlobalForwardingRuleTransportSettings, + settings.deleteGlobalForwardingRuleSettings(), + clientContext); + this.getGlobalForwardingRuleCallable = + callableFactory.createUnaryCallable( + getGlobalForwardingRuleTransportSettings, + settings.getGlobalForwardingRuleSettings(), + clientContext); + this.insertGlobalForwardingRuleCallable = + callableFactory.createUnaryCallable( + insertGlobalForwardingRuleTransportSettings, + settings.insertGlobalForwardingRuleSettings(), + clientContext); + this.listGlobalForwardingRulesCallable = + callableFactory.createUnaryCallable( + listGlobalForwardingRulesTransportSettings, + settings.listGlobalForwardingRulesSettings(), + clientContext); + this.listGlobalForwardingRulesPagedCallable = + callableFactory.createPagedCallable( + listGlobalForwardingRulesTransportSettings, + settings.listGlobalForwardingRulesSettings(), + clientContext); + this.setTargetGlobalForwardingRuleCallable = + callableFactory.createUnaryCallable( + setTargetGlobalForwardingRuleTransportSettings, + settings.setTargetGlobalForwardingRuleSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + deleteGlobalForwardingRuleCallable() { + return deleteGlobalForwardingRuleCallable; + } + + @BetaApi + public UnaryCallable + getGlobalForwardingRuleCallable() { + return getGlobalForwardingRuleCallable; + } + + @BetaApi + public UnaryCallable + insertGlobalForwardingRuleCallable() { + return insertGlobalForwardingRuleCallable; + } + + @BetaApi + public UnaryCallable + listGlobalForwardingRulesPagedCallable() { + return listGlobalForwardingRulesPagedCallable; + } + + @BetaApi + public UnaryCallable + listGlobalForwardingRulesCallable() { + return listGlobalForwardingRulesCallable; + } + + @BetaApi + public UnaryCallable + setTargetGlobalForwardingRuleCallable() { + return setTargetGlobalForwardingRuleCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalOperationCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalOperationCallableFactory.java new file mode 100644 index 000000000000..0b7c72fcd525 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalOperationCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonGlobalOperationCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalOperationStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalOperationStub.java new file mode 100644 index 000000000000..ba198e28cb7e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonGlobalOperationStub.java @@ -0,0 +1,311 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.GlobalOperationClient.AggregatedListGlobalOperationsPagedResponse; +import static com.google.cloud.compute.v1.GlobalOperationClient.ListGlobalOperationsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListGlobalOperationsHttpRequest; +import com.google.cloud.compute.v1.DeleteGlobalOperationHttpRequest; +import com.google.cloud.compute.v1.GetGlobalOperationHttpRequest; +import com.google.cloud.compute.v1.ListGlobalOperationsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.OperationAggregatedList; +import com.google.cloud.compute.v1.OperationList; +import com.google.cloud.compute.v1.ProjectGlobalOperationName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonGlobalOperationStub extends GlobalOperationStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListGlobalOperationsHttpRequest, OperationAggregatedList> + aggregatedListGlobalOperationsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.globalOperations.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/operations")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(OperationAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteGlobalOperationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalOperations.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/operations/{operation}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalOperationName.newFactory()) + .setResourceNameField("operation") + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getGlobalOperationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalOperations.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/operations/{operation}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalOperationName.newFactory()) + .setResourceNameField("operation") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listGlobalOperationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.globalOperations.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/operations")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(OperationList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + aggregatedListGlobalOperationsCallable; + private final UnaryCallable< + AggregatedListGlobalOperationsHttpRequest, AggregatedListGlobalOperationsPagedResponse> + aggregatedListGlobalOperationsPagedCallable; + private final UnaryCallable deleteGlobalOperationCallable; + private final UnaryCallable getGlobalOperationCallable; + private final UnaryCallable + listGlobalOperationsCallable; + private final UnaryCallable + listGlobalOperationsPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonGlobalOperationStub create(GlobalOperationStubSettings settings) + throws IOException { + return new HttpJsonGlobalOperationStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonGlobalOperationStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonGlobalOperationStub( + GlobalOperationStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonGlobalOperationStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonGlobalOperationStub( + GlobalOperationStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonGlobalOperationStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonGlobalOperationStub( + GlobalOperationStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonGlobalOperationCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonGlobalOperationStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonGlobalOperationStub( + GlobalOperationStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListGlobalOperationsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListGlobalOperationsMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteGlobalOperationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteGlobalOperationMethodDescriptor) + .build(); + HttpJsonCallSettings + getGlobalOperationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getGlobalOperationMethodDescriptor) + .build(); + HttpJsonCallSettings + listGlobalOperationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listGlobalOperationsMethodDescriptor) + .build(); + + this.aggregatedListGlobalOperationsCallable = + callableFactory.createUnaryCallable( + aggregatedListGlobalOperationsTransportSettings, + settings.aggregatedListGlobalOperationsSettings(), + clientContext); + this.aggregatedListGlobalOperationsPagedCallable = + callableFactory.createPagedCallable( + aggregatedListGlobalOperationsTransportSettings, + settings.aggregatedListGlobalOperationsSettings(), + clientContext); + this.deleteGlobalOperationCallable = + callableFactory.createUnaryCallable( + deleteGlobalOperationTransportSettings, + settings.deleteGlobalOperationSettings(), + clientContext); + this.getGlobalOperationCallable = + callableFactory.createUnaryCallable( + getGlobalOperationTransportSettings, + settings.getGlobalOperationSettings(), + clientContext); + this.listGlobalOperationsCallable = + callableFactory.createUnaryCallable( + listGlobalOperationsTransportSettings, + settings.listGlobalOperationsSettings(), + clientContext); + this.listGlobalOperationsPagedCallable = + callableFactory.createPagedCallable( + listGlobalOperationsTransportSettings, + settings.listGlobalOperationsSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable< + AggregatedListGlobalOperationsHttpRequest, AggregatedListGlobalOperationsPagedResponse> + aggregatedListGlobalOperationsPagedCallable() { + return aggregatedListGlobalOperationsPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListGlobalOperationsCallable() { + return aggregatedListGlobalOperationsCallable; + } + + @BetaApi + public UnaryCallable deleteGlobalOperationCallable() { + return deleteGlobalOperationCallable; + } + + @BetaApi + public UnaryCallable getGlobalOperationCallable() { + return getGlobalOperationCallable; + } + + @BetaApi + public UnaryCallable + listGlobalOperationsPagedCallable() { + return listGlobalOperationsPagedCallable; + } + + @BetaApi + public UnaryCallable + listGlobalOperationsCallable() { + return listGlobalOperationsCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHealthCheckCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHealthCheckCallableFactory.java new file mode 100644 index 000000000000..8c75c78c8871 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHealthCheckCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonHealthCheckCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHealthCheckStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHealthCheckStub.java new file mode 100644 index 000000000000..7a376c55eedd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHealthCheckStub.java @@ -0,0 +1,354 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.HealthCheckClient.ListHealthChecksPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteHealthCheckHttpRequest; +import com.google.cloud.compute.v1.GetHealthCheckHttpRequest; +import com.google.cloud.compute.v1.HealthCheck; +import com.google.cloud.compute.v1.HealthCheckList; +import com.google.cloud.compute.v1.InsertHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ListHealthChecksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ProjectGlobalHealthCheckName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.UpdateHealthCheckHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonHealthCheckStub extends HealthCheckStub { + @InternalApi + public static final ApiMethodDescriptor + deleteHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.healthChecks.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/healthChecks/{healthCheck}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalHealthCheckName.newFactory()) + .setResourceNameField("healthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.healthChecks.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/healthChecks/{healthCheck}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalHealthCheckName.newFactory()) + .setResourceNameField("healthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(HealthCheck.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.healthChecks.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/healthChecks")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listHealthChecksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.healthChecks.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/healthChecks")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(HealthCheckList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.healthChecks.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/healthChecks/{healthCheck}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalHealthCheckName.newFactory()) + .setResourceNameField("healthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.healthChecks.update") + .setHttpMethod(HttpMethods.PUT) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/healthChecks/{healthCheck}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalHealthCheckName.newFactory()) + .setResourceNameField("healthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable deleteHealthCheckCallable; + private final UnaryCallable getHealthCheckCallable; + private final UnaryCallable insertHealthCheckCallable; + private final UnaryCallable + listHealthChecksCallable; + private final UnaryCallable + listHealthChecksPagedCallable; + private final UnaryCallable patchHealthCheckCallable; + private final UnaryCallable updateHealthCheckCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonHealthCheckStub create(HealthCheckStubSettings settings) + throws IOException { + return new HttpJsonHealthCheckStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonHealthCheckStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonHealthCheckStub(HealthCheckStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonHealthCheckStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonHealthCheckStub( + HealthCheckStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonHealthCheckStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonHealthCheckStub(HealthCheckStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonHealthCheckCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonHealthCheckStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonHealthCheckStub( + HealthCheckStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings getHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings + insertHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings + listHealthChecksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listHealthChecksMethodDescriptor) + .build(); + HttpJsonCallSettings patchHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings + updateHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateHealthCheckMethodDescriptor) + .build(); + + this.deleteHealthCheckCallable = + callableFactory.createUnaryCallable( + deleteHealthCheckTransportSettings, + settings.deleteHealthCheckSettings(), + clientContext); + this.getHealthCheckCallable = + callableFactory.createUnaryCallable( + getHealthCheckTransportSettings, settings.getHealthCheckSettings(), clientContext); + this.insertHealthCheckCallable = + callableFactory.createUnaryCallable( + insertHealthCheckTransportSettings, + settings.insertHealthCheckSettings(), + clientContext); + this.listHealthChecksCallable = + callableFactory.createUnaryCallable( + listHealthChecksTransportSettings, settings.listHealthChecksSettings(), clientContext); + this.listHealthChecksPagedCallable = + callableFactory.createPagedCallable( + listHealthChecksTransportSettings, settings.listHealthChecksSettings(), clientContext); + this.patchHealthCheckCallable = + callableFactory.createUnaryCallable( + patchHealthCheckTransportSettings, settings.patchHealthCheckSettings(), clientContext); + this.updateHealthCheckCallable = + callableFactory.createUnaryCallable( + updateHealthCheckTransportSettings, + settings.updateHealthCheckSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteHealthCheckCallable() { + return deleteHealthCheckCallable; + } + + @BetaApi + public UnaryCallable getHealthCheckCallable() { + return getHealthCheckCallable; + } + + @BetaApi + public UnaryCallable insertHealthCheckCallable() { + return insertHealthCheckCallable; + } + + @BetaApi + public UnaryCallable + listHealthChecksPagedCallable() { + return listHealthChecksPagedCallable; + } + + @BetaApi + public UnaryCallable listHealthChecksCallable() { + return listHealthChecksCallable; + } + + @BetaApi + public UnaryCallable patchHealthCheckCallable() { + return patchHealthCheckCallable; + } + + @BetaApi + public UnaryCallable updateHealthCheckCallable() { + return updateHealthCheckCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpHealthCheckCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpHealthCheckCallableFactory.java new file mode 100644 index 000000000000..38561aff0603 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpHealthCheckCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonHttpHealthCheckCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpHealthCheckStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpHealthCheckStub.java new file mode 100644 index 000000000000..5e95d6cba767 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpHealthCheckStub.java @@ -0,0 +1,379 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.HttpHealthCheckClient.ListHttpHealthChecksPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.GetHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.HttpHealthCheck2; +import com.google.cloud.compute.v1.HttpHealthCheckList; +import com.google.cloud.compute.v1.InsertHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ListHttpHealthChecksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchHttpHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ProjectGlobalHttpHealthCheckName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.UpdateHttpHealthCheckHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonHttpHealthCheckStub extends HttpHealthCheckStub { + @InternalApi + public static final ApiMethodDescriptor + deleteHttpHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpHealthChecks.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/httpHealthChecks/{httpHealthCheck}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalHttpHealthCheckName.newFactory()) + .setResourceNameField("httpHealthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getHttpHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpHealthChecks.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/httpHealthChecks/{httpHealthCheck}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalHttpHealthCheckName.newFactory()) + .setResourceNameField("httpHealthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(HttpHealthCheck2.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertHttpHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpHealthChecks.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/httpHealthChecks")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listHttpHealthChecksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpHealthChecks.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/httpHealthChecks")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(HttpHealthCheckList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchHttpHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpHealthChecks.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/httpHealthChecks/{httpHealthCheck}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalHttpHealthCheckName.newFactory()) + .setResourceNameField("httpHealthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateHttpHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpHealthChecks.update") + .setHttpMethod(HttpMethods.PUT) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/httpHealthChecks/{httpHealthCheck}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalHttpHealthCheckName.newFactory()) + .setResourceNameField("httpHealthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteHttpHealthCheckCallable; + private final UnaryCallable + getHttpHealthCheckCallable; + private final UnaryCallable + insertHttpHealthCheckCallable; + private final UnaryCallable + listHttpHealthChecksCallable; + private final UnaryCallable + listHttpHealthChecksPagedCallable; + private final UnaryCallable + patchHttpHealthCheckCallable; + private final UnaryCallable + updateHttpHealthCheckCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonHttpHealthCheckStub create(HttpHealthCheckStubSettings settings) + throws IOException { + return new HttpJsonHttpHealthCheckStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonHttpHealthCheckStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonHttpHealthCheckStub( + HttpHealthCheckStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonHttpHealthCheckStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonHttpHealthCheckStub( + HttpHealthCheckStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonHttpHealthCheckStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonHttpHealthCheckStub( + HttpHealthCheckStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonHttpHealthCheckCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonHttpHealthCheckStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonHttpHealthCheckStub( + HttpHealthCheckStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteHttpHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteHttpHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings + getHttpHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getHttpHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings + insertHttpHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertHttpHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings + listHttpHealthChecksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listHttpHealthChecksMethodDescriptor) + .build(); + HttpJsonCallSettings + patchHttpHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchHttpHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings + updateHttpHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateHttpHealthCheckMethodDescriptor) + .build(); + + this.deleteHttpHealthCheckCallable = + callableFactory.createUnaryCallable( + deleteHttpHealthCheckTransportSettings, + settings.deleteHttpHealthCheckSettings(), + clientContext); + this.getHttpHealthCheckCallable = + callableFactory.createUnaryCallable( + getHttpHealthCheckTransportSettings, + settings.getHttpHealthCheckSettings(), + clientContext); + this.insertHttpHealthCheckCallable = + callableFactory.createUnaryCallable( + insertHttpHealthCheckTransportSettings, + settings.insertHttpHealthCheckSettings(), + clientContext); + this.listHttpHealthChecksCallable = + callableFactory.createUnaryCallable( + listHttpHealthChecksTransportSettings, + settings.listHttpHealthChecksSettings(), + clientContext); + this.listHttpHealthChecksPagedCallable = + callableFactory.createPagedCallable( + listHttpHealthChecksTransportSettings, + settings.listHttpHealthChecksSettings(), + clientContext); + this.patchHttpHealthCheckCallable = + callableFactory.createUnaryCallable( + patchHttpHealthCheckTransportSettings, + settings.patchHttpHealthCheckSettings(), + clientContext); + this.updateHttpHealthCheckCallable = + callableFactory.createUnaryCallable( + updateHttpHealthCheckTransportSettings, + settings.updateHttpHealthCheckSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + deleteHttpHealthCheckCallable() { + return deleteHttpHealthCheckCallable; + } + + @BetaApi + public UnaryCallable + getHttpHealthCheckCallable() { + return getHttpHealthCheckCallable; + } + + @BetaApi + public UnaryCallable + insertHttpHealthCheckCallable() { + return insertHttpHealthCheckCallable; + } + + @BetaApi + public UnaryCallable + listHttpHealthChecksPagedCallable() { + return listHttpHealthChecksPagedCallable; + } + + @BetaApi + public UnaryCallable + listHttpHealthChecksCallable() { + return listHttpHealthChecksCallable; + } + + @BetaApi + public UnaryCallable patchHttpHealthCheckCallable() { + return patchHttpHealthCheckCallable; + } + + @BetaApi + public UnaryCallable + updateHttpHealthCheckCallable() { + return updateHttpHealthCheckCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpsHealthCheckCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpsHealthCheckCallableFactory.java new file mode 100644 index 000000000000..c290e0fc58a7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpsHealthCheckCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonHttpsHealthCheckCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpsHealthCheckStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpsHealthCheckStub.java new file mode 100644 index 000000000000..6005410adb56 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonHttpsHealthCheckStub.java @@ -0,0 +1,381 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.HttpsHealthCheckClient.ListHttpsHealthChecksPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.GetHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.HttpsHealthCheck2; +import com.google.cloud.compute.v1.HttpsHealthCheckList; +import com.google.cloud.compute.v1.InsertHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ListHttpsHealthChecksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ProjectGlobalHttpsHealthCheckName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.UpdateHttpsHealthCheckHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonHttpsHealthCheckStub extends HttpsHealthCheckStub { + @InternalApi + public static final ApiMethodDescriptor + deleteHttpsHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpsHealthChecks.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/httpsHealthChecks/{httpsHealthCheck}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalHttpsHealthCheckName.newFactory()) + .setResourceNameField("httpsHealthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getHttpsHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpsHealthChecks.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/httpsHealthChecks/{httpsHealthCheck}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalHttpsHealthCheckName.newFactory()) + .setResourceNameField("httpsHealthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(HttpsHealthCheck2.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertHttpsHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpsHealthChecks.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/httpsHealthChecks")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listHttpsHealthChecksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpsHealthChecks.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/httpsHealthChecks")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(HttpsHealthCheckList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchHttpsHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpsHealthChecks.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/httpsHealthChecks/{httpsHealthCheck}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalHttpsHealthCheckName.newFactory()) + .setResourceNameField("httpsHealthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateHttpsHealthCheckMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.httpsHealthChecks.update") + .setHttpMethod(HttpMethods.PUT) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/httpsHealthChecks/{httpsHealthCheck}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalHttpsHealthCheckName.newFactory()) + .setResourceNameField("httpsHealthCheck") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteHttpsHealthCheckCallable; + private final UnaryCallable + getHttpsHealthCheckCallable; + private final UnaryCallable + insertHttpsHealthCheckCallable; + private final UnaryCallable + listHttpsHealthChecksCallable; + private final UnaryCallable + listHttpsHealthChecksPagedCallable; + private final UnaryCallable + patchHttpsHealthCheckCallable; + private final UnaryCallable + updateHttpsHealthCheckCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonHttpsHealthCheckStub create(HttpsHealthCheckStubSettings settings) + throws IOException { + return new HttpJsonHttpsHealthCheckStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonHttpsHealthCheckStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonHttpsHealthCheckStub( + HttpsHealthCheckStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonHttpsHealthCheckStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonHttpsHealthCheckStub( + HttpsHealthCheckStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonHttpsHealthCheckStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonHttpsHealthCheckStub( + HttpsHealthCheckStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonHttpsHealthCheckCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonHttpsHealthCheckStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonHttpsHealthCheckStub( + HttpsHealthCheckStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteHttpsHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteHttpsHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings + getHttpsHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getHttpsHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings + insertHttpsHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertHttpsHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings + listHttpsHealthChecksTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listHttpsHealthChecksMethodDescriptor) + .build(); + HttpJsonCallSettings + patchHttpsHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchHttpsHealthCheckMethodDescriptor) + .build(); + HttpJsonCallSettings + updateHttpsHealthCheckTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateHttpsHealthCheckMethodDescriptor) + .build(); + + this.deleteHttpsHealthCheckCallable = + callableFactory.createUnaryCallable( + deleteHttpsHealthCheckTransportSettings, + settings.deleteHttpsHealthCheckSettings(), + clientContext); + this.getHttpsHealthCheckCallable = + callableFactory.createUnaryCallable( + getHttpsHealthCheckTransportSettings, + settings.getHttpsHealthCheckSettings(), + clientContext); + this.insertHttpsHealthCheckCallable = + callableFactory.createUnaryCallable( + insertHttpsHealthCheckTransportSettings, + settings.insertHttpsHealthCheckSettings(), + clientContext); + this.listHttpsHealthChecksCallable = + callableFactory.createUnaryCallable( + listHttpsHealthChecksTransportSettings, + settings.listHttpsHealthChecksSettings(), + clientContext); + this.listHttpsHealthChecksPagedCallable = + callableFactory.createPagedCallable( + listHttpsHealthChecksTransportSettings, + settings.listHttpsHealthChecksSettings(), + clientContext); + this.patchHttpsHealthCheckCallable = + callableFactory.createUnaryCallable( + patchHttpsHealthCheckTransportSettings, + settings.patchHttpsHealthCheckSettings(), + clientContext); + this.updateHttpsHealthCheckCallable = + callableFactory.createUnaryCallable( + updateHttpsHealthCheckTransportSettings, + settings.updateHttpsHealthCheckSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + deleteHttpsHealthCheckCallable() { + return deleteHttpsHealthCheckCallable; + } + + @BetaApi + public UnaryCallable + getHttpsHealthCheckCallable() { + return getHttpsHealthCheckCallable; + } + + @BetaApi + public UnaryCallable + insertHttpsHealthCheckCallable() { + return insertHttpsHealthCheckCallable; + } + + @BetaApi + public UnaryCallable + listHttpsHealthChecksPagedCallable() { + return listHttpsHealthChecksPagedCallable; + } + + @BetaApi + public UnaryCallable + listHttpsHealthChecksCallable() { + return listHttpsHealthChecksCallable; + } + + @BetaApi + public UnaryCallable + patchHttpsHealthCheckCallable() { + return patchHttpsHealthCheckCallable; + } + + @BetaApi + public UnaryCallable + updateHttpsHealthCheckCallable() { + return updateHttpsHealthCheckCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonImageCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonImageCallableFactory.java new file mode 100644 index 000000000000..2ab8f66e8e7b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonImageCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonImageCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonImageStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonImageStub.java new file mode 100644 index 000000000000..56beeda780b9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonImageStub.java @@ -0,0 +1,375 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ImageClient.ListImagesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteImageHttpRequest; +import com.google.cloud.compute.v1.DeprecateImageHttpRequest; +import com.google.cloud.compute.v1.GetFromFamilyImageHttpRequest; +import com.google.cloud.compute.v1.GetImageHttpRequest; +import com.google.cloud.compute.v1.Image; +import com.google.cloud.compute.v1.ImageList; +import com.google.cloud.compute.v1.InsertImageHttpRequest; +import com.google.cloud.compute.v1.ListImagesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalImageFamilyName; +import com.google.cloud.compute.v1.ProjectGlobalImageName; +import com.google.cloud.compute.v1.ProjectGlobalImageResourceName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.SetLabelsImageHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonImageStub extends ImageStub { + @InternalApi + public static final ApiMethodDescriptor + deleteImageMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.images.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/images/{image}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalImageName.newFactory()) + .setResourceNameField("image") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deprecateImageMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.images.deprecate") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/images/{image}/deprecate")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalImageName.newFactory()) + .setResourceNameField("image") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor getImageMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.images.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/images/{image}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalImageName.newFactory()) + .setResourceNameField("image") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Image.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getFromFamilyImageMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.images.getFromFamily") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/images/family/{family}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalImageFamilyName.newFactory()) + .setResourceNameField("family") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Image.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertImageMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.images.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/images")) + .setQueryParams(Sets.newHashSet("forceCreate", "requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listImagesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.images.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/images")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(ImageList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setLabelsImageMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.images.setLabels") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/images/{resource}/setLabels")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalImageResourceName.newFactory()) + .setResourceNameField("resource") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable deleteImageCallable; + private final UnaryCallable deprecateImageCallable; + private final UnaryCallable getImageCallable; + private final UnaryCallable getFromFamilyImageCallable; + private final UnaryCallable insertImageCallable; + private final UnaryCallable listImagesCallable; + private final UnaryCallable + listImagesPagedCallable; + private final UnaryCallable setLabelsImageCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonImageStub create(ImageStubSettings settings) throws IOException { + return new HttpJsonImageStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonImageStub create(ClientContext clientContext) throws IOException { + return new HttpJsonImageStub(ImageStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonImageStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonImageStub( + ImageStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonImageStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonImageStub(ImageStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonImageCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonImageStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonImageStub( + ImageStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings deleteImageTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteImageMethodDescriptor) + .build(); + HttpJsonCallSettings deprecateImageTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deprecateImageMethodDescriptor) + .build(); + HttpJsonCallSettings getImageTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getImageMethodDescriptor) + .build(); + HttpJsonCallSettings getFromFamilyImageTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getFromFamilyImageMethodDescriptor) + .build(); + HttpJsonCallSettings insertImageTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertImageMethodDescriptor) + .build(); + HttpJsonCallSettings listImagesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listImagesMethodDescriptor) + .build(); + HttpJsonCallSettings setLabelsImageTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setLabelsImageMethodDescriptor) + .build(); + + this.deleteImageCallable = + callableFactory.createUnaryCallable( + deleteImageTransportSettings, settings.deleteImageSettings(), clientContext); + this.deprecateImageCallable = + callableFactory.createUnaryCallable( + deprecateImageTransportSettings, settings.deprecateImageSettings(), clientContext); + this.getImageCallable = + callableFactory.createUnaryCallable( + getImageTransportSettings, settings.getImageSettings(), clientContext); + this.getFromFamilyImageCallable = + callableFactory.createUnaryCallable( + getFromFamilyImageTransportSettings, + settings.getFromFamilyImageSettings(), + clientContext); + this.insertImageCallable = + callableFactory.createUnaryCallable( + insertImageTransportSettings, settings.insertImageSettings(), clientContext); + this.listImagesCallable = + callableFactory.createUnaryCallable( + listImagesTransportSettings, settings.listImagesSettings(), clientContext); + this.listImagesPagedCallable = + callableFactory.createPagedCallable( + listImagesTransportSettings, settings.listImagesSettings(), clientContext); + this.setLabelsImageCallable = + callableFactory.createUnaryCallable( + setLabelsImageTransportSettings, settings.setLabelsImageSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteImageCallable() { + return deleteImageCallable; + } + + @BetaApi + public UnaryCallable deprecateImageCallable() { + return deprecateImageCallable; + } + + @BetaApi + public UnaryCallable getImageCallable() { + return getImageCallable; + } + + @BetaApi + public UnaryCallable getFromFamilyImageCallable() { + return getFromFamilyImageCallable; + } + + @BetaApi + public UnaryCallable insertImageCallable() { + return insertImageCallable; + } + + @BetaApi + public UnaryCallable listImagesPagedCallable() { + return listImagesPagedCallable; + } + + @BetaApi + public UnaryCallable listImagesCallable() { + return listImagesCallable; + } + + @BetaApi + public UnaryCallable setLabelsImageCallable() { + return setLabelsImageCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceCallableFactory.java new file mode 100644 index 000000000000..4866cc448499 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonInstanceCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupCallableFactory.java new file mode 100644 index 000000000000..248810e6f9cd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonInstanceGroupCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupManagerCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupManagerCallableFactory.java new file mode 100644 index 000000000000..1472a24b1411 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupManagerCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonInstanceGroupManagerCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupManagerStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupManagerStub.java new file mode 100644 index 000000000000..392f69a3c76d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupManagerStub.java @@ -0,0 +1,693 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AbandonInstancesInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.AggregatedListInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.DeleteInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.DeleteInstancesInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.GetInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InstanceGroupManager; +import com.google.cloud.compute.v1.InstanceGroupManagerAggregatedList; +import com.google.cloud.compute.v1.InstanceGroupManagerList; +import com.google.cloud.compute.v1.InstanceGroupManagersListManagedInstancesResponse; +import com.google.cloud.compute.v1.ListInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.ListManagedInstancesInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectZoneInstanceGroupManagerName; +import com.google.cloud.compute.v1.ProjectZoneName; +import com.google.cloud.compute.v1.RecreateInstancesInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.ResizeInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetInstanceTemplateInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetTargetPoolsInstanceGroupManagerHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonInstanceGroupManagerStub extends InstanceGroupManagerStub { + @InternalApi + public static final ApiMethodDescriptor< + AbandonInstancesInstanceGroupManagerHttpRequest, Operation> + abandonInstancesInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.instanceGroupManagers.abandonInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/abandonInstances")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList> + aggregatedListInstanceGroupManagersMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("compute.instanceGroupManagers.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/aggregated/instanceGroupManagers")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceGroupManagerAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroupManagers.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteInstancesInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.instanceGroupManagers.deleteInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/deleteInstances")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroupManagers.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceGroupManager.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroupManagers.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/instanceGroupManagers")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList> + listInstanceGroupManagersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.instanceGroupManagers.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/instanceGroupManagers")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceGroupManagerList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("compute.instanceGroupManagers.listManagedInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/listManagedInstances")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "order_by", "pageToken")) + .setResourceNameFactory(ProjectZoneInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser + .newBuilder() + .setResponseInstance( + InstanceGroupManagersListManagedInstancesResponse.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + RecreateInstancesInstanceGroupManagerHttpRequest, Operation> + recreateInstancesInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.instanceGroupManagers.recreateInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/recreateInstances")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + resizeInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroupManagers.resize") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/resize")) + .setQueryParams(Sets.newHashSet("requestId", "size")) + .setResourceNameFactory(ProjectZoneInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + SetInstanceTemplateInstanceGroupManagerHttpRequest, Operation> + setInstanceTemplateInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.instanceGroupManagers.setInstanceTemplate") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/setInstanceTemplate")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setTargetPoolsInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroupManagers.setTargetPools") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}/setTargetPools")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + abandonInstancesInstanceGroupManagerCallable; + private final UnaryCallable< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList> + aggregatedListInstanceGroupManagersCallable; + private final UnaryCallable< + AggregatedListInstanceGroupManagersHttpRequest, + AggregatedListInstanceGroupManagersPagedResponse> + aggregatedListInstanceGroupManagersPagedCallable; + private final UnaryCallable + deleteInstanceGroupManagerCallable; + private final UnaryCallable + deleteInstancesInstanceGroupManagerCallable; + private final UnaryCallable + getInstanceGroupManagerCallable; + private final UnaryCallable + insertInstanceGroupManagerCallable; + private final UnaryCallable + listInstanceGroupManagersCallable; + private final UnaryCallable< + ListInstanceGroupManagersHttpRequest, ListInstanceGroupManagersPagedResponse> + listInstanceGroupManagersPagedCallable; + private final UnaryCallable< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersCallable; + private final UnaryCallable + recreateInstancesInstanceGroupManagerCallable; + private final UnaryCallable + resizeInstanceGroupManagerCallable; + private final UnaryCallable + setInstanceTemplateInstanceGroupManagerCallable; + private final UnaryCallable + setTargetPoolsInstanceGroupManagerCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonInstanceGroupManagerStub create( + InstanceGroupManagerStubSettings settings) throws IOException { + return new HttpJsonInstanceGroupManagerStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonInstanceGroupManagerStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonInstanceGroupManagerStub( + InstanceGroupManagerStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonInstanceGroupManagerStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonInstanceGroupManagerStub( + InstanceGroupManagerStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonInstanceGroupManagerStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonInstanceGroupManagerStub( + InstanceGroupManagerStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonInstanceGroupManagerCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonInstanceGroupManagerStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonInstanceGroupManagerStub( + InstanceGroupManagerStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + abandonInstancesInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(abandonInstancesInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList> + aggregatedListInstanceGroupManagersTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(aggregatedListInstanceGroupManagersMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteInstanceGroupManagerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteInstancesInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(deleteInstancesInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + getInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + insertInstanceGroupManagerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + listInstanceGroupManagersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listInstanceGroupManagersMethodDescriptor) + .build(); + HttpJsonCallSettings< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listManagedInstancesInstanceGroupManagersMethodDescriptor) + .build(); + HttpJsonCallSettings + recreateInstancesInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(recreateInstancesInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + resizeInstanceGroupManagerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(resizeInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + setInstanceTemplateInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(setInstanceTemplateInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + setTargetPoolsInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(setTargetPoolsInstanceGroupManagerMethodDescriptor) + .build(); + + this.abandonInstancesInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + abandonInstancesInstanceGroupManagerTransportSettings, + settings.abandonInstancesInstanceGroupManagerSettings(), + clientContext); + this.aggregatedListInstanceGroupManagersCallable = + callableFactory.createUnaryCallable( + aggregatedListInstanceGroupManagersTransportSettings, + settings.aggregatedListInstanceGroupManagersSettings(), + clientContext); + this.aggregatedListInstanceGroupManagersPagedCallable = + callableFactory.createPagedCallable( + aggregatedListInstanceGroupManagersTransportSettings, + settings.aggregatedListInstanceGroupManagersSettings(), + clientContext); + this.deleteInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + deleteInstanceGroupManagerTransportSettings, + settings.deleteInstanceGroupManagerSettings(), + clientContext); + this.deleteInstancesInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + deleteInstancesInstanceGroupManagerTransportSettings, + settings.deleteInstancesInstanceGroupManagerSettings(), + clientContext); + this.getInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + getInstanceGroupManagerTransportSettings, + settings.getInstanceGroupManagerSettings(), + clientContext); + this.insertInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + insertInstanceGroupManagerTransportSettings, + settings.insertInstanceGroupManagerSettings(), + clientContext); + this.listInstanceGroupManagersCallable = + callableFactory.createUnaryCallable( + listInstanceGroupManagersTransportSettings, + settings.listInstanceGroupManagersSettings(), + clientContext); + this.listInstanceGroupManagersPagedCallable = + callableFactory.createPagedCallable( + listInstanceGroupManagersTransportSettings, + settings.listInstanceGroupManagersSettings(), + clientContext); + this.listManagedInstancesInstanceGroupManagersCallable = + callableFactory.createUnaryCallable( + listManagedInstancesInstanceGroupManagersTransportSettings, + settings.listManagedInstancesInstanceGroupManagersSettings(), + clientContext); + this.recreateInstancesInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + recreateInstancesInstanceGroupManagerTransportSettings, + settings.recreateInstancesInstanceGroupManagerSettings(), + clientContext); + this.resizeInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + resizeInstanceGroupManagerTransportSettings, + settings.resizeInstanceGroupManagerSettings(), + clientContext); + this.setInstanceTemplateInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + setInstanceTemplateInstanceGroupManagerTransportSettings, + settings.setInstanceTemplateInstanceGroupManagerSettings(), + clientContext); + this.setTargetPoolsInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + setTargetPoolsInstanceGroupManagerTransportSettings, + settings.setTargetPoolsInstanceGroupManagerSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + abandonInstancesInstanceGroupManagerCallable() { + return abandonInstancesInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable< + AggregatedListInstanceGroupManagersHttpRequest, + AggregatedListInstanceGroupManagersPagedResponse> + aggregatedListInstanceGroupManagersPagedCallable() { + return aggregatedListInstanceGroupManagersPagedCallable; + } + + @BetaApi + public UnaryCallable< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList> + aggregatedListInstanceGroupManagersCallable() { + return aggregatedListInstanceGroupManagersCallable; + } + + @BetaApi + public UnaryCallable + deleteInstanceGroupManagerCallable() { + return deleteInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + deleteInstancesInstanceGroupManagerCallable() { + return deleteInstancesInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + getInstanceGroupManagerCallable() { + return getInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + insertInstanceGroupManagerCallable() { + return insertInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + listInstanceGroupManagersPagedCallable() { + return listInstanceGroupManagersPagedCallable; + } + + @BetaApi + public UnaryCallable + listInstanceGroupManagersCallable() { + return listInstanceGroupManagersCallable; + } + + @BetaApi + public UnaryCallable< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersCallable() { + return listManagedInstancesInstanceGroupManagersCallable; + } + + @BetaApi + public UnaryCallable + recreateInstancesInstanceGroupManagerCallable() { + return recreateInstancesInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + resizeInstanceGroupManagerCallable() { + return resizeInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + setInstanceTemplateInstanceGroupManagerCallable() { + return setInstanceTemplateInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + setTargetPoolsInstanceGroupManagerCallable() { + return setTargetPoolsInstanceGroupManagerCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupStub.java new file mode 100644 index 000000000000..788a010acc13 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceGroupStub.java @@ -0,0 +1,538 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceGroupClient.AggregatedListInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupClient.ListInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupClient.ListInstancesInstanceGroupsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AddInstancesInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.AggregatedListInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.DeleteInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.GetInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.InstanceGroup; +import com.google.cloud.compute.v1.InstanceGroupAggregatedList; +import com.google.cloud.compute.v1.InstanceGroupList; +import com.google.cloud.compute.v1.InstanceGroupsListInstances; +import com.google.cloud.compute.v1.ListInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.ListInstancesInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectZoneInstanceGroupName; +import com.google.cloud.compute.v1.ProjectZoneName; +import com.google.cloud.compute.v1.RemoveInstancesInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.SetNamedPortsInstanceGroupHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonInstanceGroupStub extends InstanceGroupStub { + @InternalApi + public static final ApiMethodDescriptor + addInstancesInstanceGroupMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroups.addInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroups/{instanceGroup}/addInstances")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceGroupName.newFactory()) + .setResourceNameField("instanceGroup") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList> + aggregatedListInstanceGroupsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.instanceGroups.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/instanceGroups")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceGroupAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteInstanceGroupMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroups.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroups/{instanceGroup}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceGroupName.newFactory()) + .setResourceNameField("instanceGroup") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getInstanceGroupMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroups.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroups/{instanceGroup}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneInstanceGroupName.newFactory()) + .setResourceNameField("instanceGroup") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceGroup.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertInstanceGroupMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroups.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/instanceGroups")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listInstanceGroupsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroups.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/instanceGroups")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceGroupList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances> + listInstancesInstanceGroupsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.instanceGroups.listInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroups/{instanceGroup}/listInstances")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneInstanceGroupName.newFactory()) + .setResourceNameField("instanceGroup") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceGroupsListInstances.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + removeInstancesInstanceGroupMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroups.removeInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroups/{instanceGroup}/removeInstances")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceGroupName.newFactory()) + .setResourceNameField("instanceGroup") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setNamedPortsInstanceGroupMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceGroups.setNamedPorts") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instanceGroups/{instanceGroup}/setNamedPorts")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceGroupName.newFactory()) + .setResourceNameField("instanceGroup") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + addInstancesInstanceGroupCallable; + private final UnaryCallable + aggregatedListInstanceGroupsCallable; + private final UnaryCallable< + AggregatedListInstanceGroupsHttpRequest, AggregatedListInstanceGroupsPagedResponse> + aggregatedListInstanceGroupsPagedCallable; + private final UnaryCallable + deleteInstanceGroupCallable; + private final UnaryCallable getInstanceGroupCallable; + private final UnaryCallable + insertInstanceGroupCallable; + private final UnaryCallable + listInstanceGroupsCallable; + private final UnaryCallable + listInstanceGroupsPagedCallable; + private final UnaryCallable + listInstancesInstanceGroupsCallable; + private final UnaryCallable< + ListInstancesInstanceGroupsHttpRequest, ListInstancesInstanceGroupsPagedResponse> + listInstancesInstanceGroupsPagedCallable; + private final UnaryCallable + removeInstancesInstanceGroupCallable; + private final UnaryCallable + setNamedPortsInstanceGroupCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonInstanceGroupStub create(InstanceGroupStubSettings settings) + throws IOException { + return new HttpJsonInstanceGroupStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonInstanceGroupStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonInstanceGroupStub( + InstanceGroupStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonInstanceGroupStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonInstanceGroupStub( + InstanceGroupStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonInstanceGroupStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonInstanceGroupStub( + InstanceGroupStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonInstanceGroupCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonInstanceGroupStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonInstanceGroupStub( + InstanceGroupStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + addInstancesInstanceGroupTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(addInstancesInstanceGroupMethodDescriptor) + .build(); + HttpJsonCallSettings + aggregatedListInstanceGroupsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListInstanceGroupsMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteInstanceGroupTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteInstanceGroupMethodDescriptor) + .build(); + HttpJsonCallSettings + getInstanceGroupTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getInstanceGroupMethodDescriptor) + .build(); + HttpJsonCallSettings + insertInstanceGroupTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertInstanceGroupMethodDescriptor) + .build(); + HttpJsonCallSettings + listInstanceGroupsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listInstanceGroupsMethodDescriptor) + .build(); + HttpJsonCallSettings + listInstancesInstanceGroupsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listInstancesInstanceGroupsMethodDescriptor) + .build(); + HttpJsonCallSettings + removeInstancesInstanceGroupTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(removeInstancesInstanceGroupMethodDescriptor) + .build(); + HttpJsonCallSettings + setNamedPortsInstanceGroupTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setNamedPortsInstanceGroupMethodDescriptor) + .build(); + + this.addInstancesInstanceGroupCallable = + callableFactory.createUnaryCallable( + addInstancesInstanceGroupTransportSettings, + settings.addInstancesInstanceGroupSettings(), + clientContext); + this.aggregatedListInstanceGroupsCallable = + callableFactory.createUnaryCallable( + aggregatedListInstanceGroupsTransportSettings, + settings.aggregatedListInstanceGroupsSettings(), + clientContext); + this.aggregatedListInstanceGroupsPagedCallable = + callableFactory.createPagedCallable( + aggregatedListInstanceGroupsTransportSettings, + settings.aggregatedListInstanceGroupsSettings(), + clientContext); + this.deleteInstanceGroupCallable = + callableFactory.createUnaryCallable( + deleteInstanceGroupTransportSettings, + settings.deleteInstanceGroupSettings(), + clientContext); + this.getInstanceGroupCallable = + callableFactory.createUnaryCallable( + getInstanceGroupTransportSettings, settings.getInstanceGroupSettings(), clientContext); + this.insertInstanceGroupCallable = + callableFactory.createUnaryCallable( + insertInstanceGroupTransportSettings, + settings.insertInstanceGroupSettings(), + clientContext); + this.listInstanceGroupsCallable = + callableFactory.createUnaryCallable( + listInstanceGroupsTransportSettings, + settings.listInstanceGroupsSettings(), + clientContext); + this.listInstanceGroupsPagedCallable = + callableFactory.createPagedCallable( + listInstanceGroupsTransportSettings, + settings.listInstanceGroupsSettings(), + clientContext); + this.listInstancesInstanceGroupsCallable = + callableFactory.createUnaryCallable( + listInstancesInstanceGroupsTransportSettings, + settings.listInstancesInstanceGroupsSettings(), + clientContext); + this.listInstancesInstanceGroupsPagedCallable = + callableFactory.createPagedCallable( + listInstancesInstanceGroupsTransportSettings, + settings.listInstancesInstanceGroupsSettings(), + clientContext); + this.removeInstancesInstanceGroupCallable = + callableFactory.createUnaryCallable( + removeInstancesInstanceGroupTransportSettings, + settings.removeInstancesInstanceGroupSettings(), + clientContext); + this.setNamedPortsInstanceGroupCallable = + callableFactory.createUnaryCallable( + setNamedPortsInstanceGroupTransportSettings, + settings.setNamedPortsInstanceGroupSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + addInstancesInstanceGroupCallable() { + return addInstancesInstanceGroupCallable; + } + + @BetaApi + public UnaryCallable< + AggregatedListInstanceGroupsHttpRequest, AggregatedListInstanceGroupsPagedResponse> + aggregatedListInstanceGroupsPagedCallable() { + return aggregatedListInstanceGroupsPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListInstanceGroupsCallable() { + return aggregatedListInstanceGroupsCallable; + } + + @BetaApi + public UnaryCallable deleteInstanceGroupCallable() { + return deleteInstanceGroupCallable; + } + + @BetaApi + public UnaryCallable getInstanceGroupCallable() { + return getInstanceGroupCallable; + } + + @BetaApi + public UnaryCallable insertInstanceGroupCallable() { + return insertInstanceGroupCallable; + } + + @BetaApi + public UnaryCallable + listInstanceGroupsPagedCallable() { + return listInstanceGroupsPagedCallable; + } + + @BetaApi + public UnaryCallable + listInstanceGroupsCallable() { + return listInstanceGroupsCallable; + } + + @BetaApi + public UnaryCallable< + ListInstancesInstanceGroupsHttpRequest, ListInstancesInstanceGroupsPagedResponse> + listInstancesInstanceGroupsPagedCallable() { + return listInstancesInstanceGroupsPagedCallable; + } + + @BetaApi + public UnaryCallable + listInstancesInstanceGroupsCallable() { + return listInstancesInstanceGroupsCallable; + } + + @BetaApi + public UnaryCallable + removeInstancesInstanceGroupCallable() { + return removeInstancesInstanceGroupCallable; + } + + @BetaApi + public UnaryCallable + setNamedPortsInstanceGroupCallable() { + return setNamedPortsInstanceGroupCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceStub.java new file mode 100644 index 000000000000..8ee9c52e86bb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceStub.java @@ -0,0 +1,1212 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceClient.AggregatedListInstancesPagedResponse; +import static com.google.cloud.compute.v1.InstanceClient.ListInstancesPagedResponse; +import static com.google.cloud.compute.v1.InstanceClient.ListReferrersInstancesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AddAccessConfigInstanceHttpRequest; +import com.google.cloud.compute.v1.AggregatedListInstancesHttpRequest; +import com.google.cloud.compute.v1.AttachDiskInstanceHttpRequest; +import com.google.cloud.compute.v1.DeleteAccessConfigInstanceHttpRequest; +import com.google.cloud.compute.v1.DeleteInstanceHttpRequest; +import com.google.cloud.compute.v1.DetachDiskInstanceHttpRequest; +import com.google.cloud.compute.v1.GetInstanceHttpRequest; +import com.google.cloud.compute.v1.GetSerialPortOutputInstanceHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceHttpRequest; +import com.google.cloud.compute.v1.Instance; +import com.google.cloud.compute.v1.InstanceAggregatedList; +import com.google.cloud.compute.v1.InstanceList; +import com.google.cloud.compute.v1.InstanceListReferrers; +import com.google.cloud.compute.v1.ListInstancesHttpRequest; +import com.google.cloud.compute.v1.ListReferrersInstancesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectZoneInstanceName; +import com.google.cloud.compute.v1.ProjectZoneInstanceResourceName; +import com.google.cloud.compute.v1.ProjectZoneName; +import com.google.cloud.compute.v1.ResetInstanceHttpRequest; +import com.google.cloud.compute.v1.SerialPortOutput; +import com.google.cloud.compute.v1.SetDeletionProtectionInstanceHttpRequest; +import com.google.cloud.compute.v1.SetDiskAutoDeleteInstanceHttpRequest; +import com.google.cloud.compute.v1.SetLabelsInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMachineResourcesInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMachineTypeInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMetadataInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMinCpuPlatformInstanceHttpRequest; +import com.google.cloud.compute.v1.SetSchedulingInstanceHttpRequest; +import com.google.cloud.compute.v1.SetServiceAccountInstanceHttpRequest; +import com.google.cloud.compute.v1.SetTagsInstanceHttpRequest; +import com.google.cloud.compute.v1.StartInstanceHttpRequest; +import com.google.cloud.compute.v1.StartWithEncryptionKeyInstanceHttpRequest; +import com.google.cloud.compute.v1.StopInstanceHttpRequest; +import com.google.cloud.compute.v1.UpdateAccessConfigInstanceHttpRequest; +import com.google.cloud.compute.v1.UpdateNetworkInterfaceInstanceHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonInstanceStub extends InstanceStub { + @InternalApi + public static final ApiMethodDescriptor + addAccessConfigInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.addAccessConfig") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/addAccessConfig")) + .setQueryParams(Sets.newHashSet("networkInterface", "requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListInstancesHttpRequest, InstanceAggregatedList> + aggregatedListInstancesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.instances.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/instances")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + attachDiskInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.attachDisk") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/attachDisk")) + .setQueryParams(Sets.newHashSet("forceAttach", "requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/instances/{instance}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteAccessConfigInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.deleteAccessConfig") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/deleteAccessConfig")) + .setQueryParams( + Sets.newHashSet("accessConfig", "networkInterface", "requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + detachDiskInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.detachDisk") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/detachDisk")) + .setQueryParams(Sets.newHashSet("deviceName", "requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/instances/{instance}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Instance.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getSerialPortOutputInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.getSerialPortOutput") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/serialPort")) + .setQueryParams(Sets.newHashSet("port", "start")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(SerialPortOutput.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/instances")) + .setQueryParams( + Sets.newHashSet("requestId", "sourceInstanceTemplate")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listInstancesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/instances")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listReferrersInstancesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.listReferrers") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/referrers")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceListReferrers.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + resetInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.reset") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/instances/{instance}/reset")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setDeletionProtectionInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.setDeletionProtection") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{resource}/setDeletionProtection")) + .setQueryParams(Sets.newHashSet("deletionProtection", "requestId")) + .setResourceNameFactory(ProjectZoneInstanceResourceName.newFactory()) + .setResourceNameField("resource") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setDiskAutoDeleteInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.setDiskAutoDelete") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/setDiskAutoDelete")) + .setQueryParams( + Sets.newHashSet("autoDelete", "deviceName", "requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setLabelsInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.setLabels") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/setLabels")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setMachineResourcesInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.setMachineResources") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/setMachineResources")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setMachineTypeInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.setMachineType") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/setMachineType")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setMetadataInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.setMetadata") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/setMetadata")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setMinCpuPlatformInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.setMinCpuPlatform") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/setMinCpuPlatform")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setSchedulingInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.setScheduling") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/setScheduling")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setServiceAccountInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.setServiceAccount") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/setServiceAccount")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setTagsInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.setTags") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/setTags")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + startInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.start") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/instances/{instance}/start")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + startWithEncryptionKeyInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.startWithEncryptionKey") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/startWithEncryptionKey")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + stopInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.stop") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/instances/{instance}/stop")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateAccessConfigInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.updateAccessConfig") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/updateAccessConfig")) + .setQueryParams(Sets.newHashSet("networkInterface", "requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateNetworkInterfaceInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instances.updateNetworkInterface") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/instances/{instance}/updateNetworkInterface")) + .setQueryParams(Sets.newHashSet("networkInterface", "requestId")) + .setResourceNameFactory(ProjectZoneInstanceName.newFactory()) + .setResourceNameField("instance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + addAccessConfigInstanceCallable; + private final UnaryCallable + aggregatedListInstancesCallable; + private final UnaryCallable< + AggregatedListInstancesHttpRequest, AggregatedListInstancesPagedResponse> + aggregatedListInstancesPagedCallable; + private final UnaryCallable attachDiskInstanceCallable; + private final UnaryCallable deleteInstanceCallable; + private final UnaryCallable + deleteAccessConfigInstanceCallable; + private final UnaryCallable detachDiskInstanceCallable; + private final UnaryCallable getInstanceCallable; + private final UnaryCallable + getSerialPortOutputInstanceCallable; + private final UnaryCallable insertInstanceCallable; + private final UnaryCallable listInstancesCallable; + private final UnaryCallable + listInstancesPagedCallable; + private final UnaryCallable + listReferrersInstancesCallable; + private final UnaryCallable< + ListReferrersInstancesHttpRequest, ListReferrersInstancesPagedResponse> + listReferrersInstancesPagedCallable; + private final UnaryCallable resetInstanceCallable; + private final UnaryCallable + setDeletionProtectionInstanceCallable; + private final UnaryCallable + setDiskAutoDeleteInstanceCallable; + private final UnaryCallable setLabelsInstanceCallable; + private final UnaryCallable + setMachineResourcesInstanceCallable; + private final UnaryCallable + setMachineTypeInstanceCallable; + private final UnaryCallable + setMetadataInstanceCallable; + private final UnaryCallable + setMinCpuPlatformInstanceCallable; + private final UnaryCallable + setSchedulingInstanceCallable; + private final UnaryCallable + setServiceAccountInstanceCallable; + private final UnaryCallable setTagsInstanceCallable; + private final UnaryCallable startInstanceCallable; + private final UnaryCallable + startWithEncryptionKeyInstanceCallable; + private final UnaryCallable stopInstanceCallable; + private final UnaryCallable + updateAccessConfigInstanceCallable; + private final UnaryCallable + updateNetworkInterfaceInstanceCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonInstanceStub create(InstanceStubSettings settings) + throws IOException { + return new HttpJsonInstanceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonInstanceStub create(ClientContext clientContext) throws IOException { + return new HttpJsonInstanceStub(InstanceStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonInstanceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonInstanceStub( + InstanceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonInstanceStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonInstanceStub(InstanceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonInstanceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonInstanceStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonInstanceStub( + InstanceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + addAccessConfigInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(addAccessConfigInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + aggregatedListInstancesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListInstancesMethodDescriptor) + .build(); + HttpJsonCallSettings + attachDiskInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(attachDiskInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings deleteInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteAccessConfigInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAccessConfigInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + detachDiskInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(detachDiskInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings getInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + getSerialPortOutputInstanceTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getSerialPortOutputInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings insertInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings listInstancesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listInstancesMethodDescriptor) + .build(); + HttpJsonCallSettings + listReferrersInstancesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listReferrersInstancesMethodDescriptor) + .build(); + HttpJsonCallSettings resetInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(resetInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + setDeletionProtectionInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setDeletionProtectionInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + setDiskAutoDeleteInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setDiskAutoDeleteInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + setLabelsInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setLabelsInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + setMachineResourcesInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setMachineResourcesInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + setMachineTypeInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setMachineTypeInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + setMetadataInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setMetadataInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + setMinCpuPlatformInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setMinCpuPlatformInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + setSchedulingInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setSchedulingInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + setServiceAccountInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setServiceAccountInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings setTagsInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setTagsInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings startInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(startInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + startWithEncryptionKeyInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(startWithEncryptionKeyInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings stopInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(stopInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + updateAccessConfigInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateAccessConfigInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + updateNetworkInterfaceInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateNetworkInterfaceInstanceMethodDescriptor) + .build(); + + this.addAccessConfigInstanceCallable = + callableFactory.createUnaryCallable( + addAccessConfigInstanceTransportSettings, + settings.addAccessConfigInstanceSettings(), + clientContext); + this.aggregatedListInstancesCallable = + callableFactory.createUnaryCallable( + aggregatedListInstancesTransportSettings, + settings.aggregatedListInstancesSettings(), + clientContext); + this.aggregatedListInstancesPagedCallable = + callableFactory.createPagedCallable( + aggregatedListInstancesTransportSettings, + settings.aggregatedListInstancesSettings(), + clientContext); + this.attachDiskInstanceCallable = + callableFactory.createUnaryCallable( + attachDiskInstanceTransportSettings, + settings.attachDiskInstanceSettings(), + clientContext); + this.deleteInstanceCallable = + callableFactory.createUnaryCallable( + deleteInstanceTransportSettings, settings.deleteInstanceSettings(), clientContext); + this.deleteAccessConfigInstanceCallable = + callableFactory.createUnaryCallable( + deleteAccessConfigInstanceTransportSettings, + settings.deleteAccessConfigInstanceSettings(), + clientContext); + this.detachDiskInstanceCallable = + callableFactory.createUnaryCallable( + detachDiskInstanceTransportSettings, + settings.detachDiskInstanceSettings(), + clientContext); + this.getInstanceCallable = + callableFactory.createUnaryCallable( + getInstanceTransportSettings, settings.getInstanceSettings(), clientContext); + this.getSerialPortOutputInstanceCallable = + callableFactory.createUnaryCallable( + getSerialPortOutputInstanceTransportSettings, + settings.getSerialPortOutputInstanceSettings(), + clientContext); + this.insertInstanceCallable = + callableFactory.createUnaryCallable( + insertInstanceTransportSettings, settings.insertInstanceSettings(), clientContext); + this.listInstancesCallable = + callableFactory.createUnaryCallable( + listInstancesTransportSettings, settings.listInstancesSettings(), clientContext); + this.listInstancesPagedCallable = + callableFactory.createPagedCallable( + listInstancesTransportSettings, settings.listInstancesSettings(), clientContext); + this.listReferrersInstancesCallable = + callableFactory.createUnaryCallable( + listReferrersInstancesTransportSettings, + settings.listReferrersInstancesSettings(), + clientContext); + this.listReferrersInstancesPagedCallable = + callableFactory.createPagedCallable( + listReferrersInstancesTransportSettings, + settings.listReferrersInstancesSettings(), + clientContext); + this.resetInstanceCallable = + callableFactory.createUnaryCallable( + resetInstanceTransportSettings, settings.resetInstanceSettings(), clientContext); + this.setDeletionProtectionInstanceCallable = + callableFactory.createUnaryCallable( + setDeletionProtectionInstanceTransportSettings, + settings.setDeletionProtectionInstanceSettings(), + clientContext); + this.setDiskAutoDeleteInstanceCallable = + callableFactory.createUnaryCallable( + setDiskAutoDeleteInstanceTransportSettings, + settings.setDiskAutoDeleteInstanceSettings(), + clientContext); + this.setLabelsInstanceCallable = + callableFactory.createUnaryCallable( + setLabelsInstanceTransportSettings, + settings.setLabelsInstanceSettings(), + clientContext); + this.setMachineResourcesInstanceCallable = + callableFactory.createUnaryCallable( + setMachineResourcesInstanceTransportSettings, + settings.setMachineResourcesInstanceSettings(), + clientContext); + this.setMachineTypeInstanceCallable = + callableFactory.createUnaryCallable( + setMachineTypeInstanceTransportSettings, + settings.setMachineTypeInstanceSettings(), + clientContext); + this.setMetadataInstanceCallable = + callableFactory.createUnaryCallable( + setMetadataInstanceTransportSettings, + settings.setMetadataInstanceSettings(), + clientContext); + this.setMinCpuPlatformInstanceCallable = + callableFactory.createUnaryCallable( + setMinCpuPlatformInstanceTransportSettings, + settings.setMinCpuPlatformInstanceSettings(), + clientContext); + this.setSchedulingInstanceCallable = + callableFactory.createUnaryCallable( + setSchedulingInstanceTransportSettings, + settings.setSchedulingInstanceSettings(), + clientContext); + this.setServiceAccountInstanceCallable = + callableFactory.createUnaryCallable( + setServiceAccountInstanceTransportSettings, + settings.setServiceAccountInstanceSettings(), + clientContext); + this.setTagsInstanceCallable = + callableFactory.createUnaryCallable( + setTagsInstanceTransportSettings, settings.setTagsInstanceSettings(), clientContext); + this.startInstanceCallable = + callableFactory.createUnaryCallable( + startInstanceTransportSettings, settings.startInstanceSettings(), clientContext); + this.startWithEncryptionKeyInstanceCallable = + callableFactory.createUnaryCallable( + startWithEncryptionKeyInstanceTransportSettings, + settings.startWithEncryptionKeyInstanceSettings(), + clientContext); + this.stopInstanceCallable = + callableFactory.createUnaryCallable( + stopInstanceTransportSettings, settings.stopInstanceSettings(), clientContext); + this.updateAccessConfigInstanceCallable = + callableFactory.createUnaryCallable( + updateAccessConfigInstanceTransportSettings, + settings.updateAccessConfigInstanceSettings(), + clientContext); + this.updateNetworkInterfaceInstanceCallable = + callableFactory.createUnaryCallable( + updateNetworkInterfaceInstanceTransportSettings, + settings.updateNetworkInterfaceInstanceSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + addAccessConfigInstanceCallable() { + return addAccessConfigInstanceCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListInstancesPagedCallable() { + return aggregatedListInstancesPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListInstancesCallable() { + return aggregatedListInstancesCallable; + } + + @BetaApi + public UnaryCallable attachDiskInstanceCallable() { + return attachDiskInstanceCallable; + } + + @BetaApi + public UnaryCallable deleteInstanceCallable() { + return deleteInstanceCallable; + } + + @BetaApi + public UnaryCallable + deleteAccessConfigInstanceCallable() { + return deleteAccessConfigInstanceCallable; + } + + @BetaApi + public UnaryCallable detachDiskInstanceCallable() { + return detachDiskInstanceCallable; + } + + @BetaApi + public UnaryCallable getInstanceCallable() { + return getInstanceCallable; + } + + @BetaApi + public UnaryCallable + getSerialPortOutputInstanceCallable() { + return getSerialPortOutputInstanceCallable; + } + + @BetaApi + public UnaryCallable insertInstanceCallable() { + return insertInstanceCallable; + } + + @BetaApi + public UnaryCallable + listInstancesPagedCallable() { + return listInstancesPagedCallable; + } + + @BetaApi + public UnaryCallable listInstancesCallable() { + return listInstancesCallable; + } + + @BetaApi + public UnaryCallable + listReferrersInstancesPagedCallable() { + return listReferrersInstancesPagedCallable; + } + + @BetaApi + public UnaryCallable + listReferrersInstancesCallable() { + return listReferrersInstancesCallable; + } + + @BetaApi + public UnaryCallable resetInstanceCallable() { + return resetInstanceCallable; + } + + @BetaApi + public UnaryCallable + setDeletionProtectionInstanceCallable() { + return setDeletionProtectionInstanceCallable; + } + + @BetaApi + public UnaryCallable + setDiskAutoDeleteInstanceCallable() { + return setDiskAutoDeleteInstanceCallable; + } + + @BetaApi + public UnaryCallable setLabelsInstanceCallable() { + return setLabelsInstanceCallable; + } + + @BetaApi + public UnaryCallable + setMachineResourcesInstanceCallable() { + return setMachineResourcesInstanceCallable; + } + + @BetaApi + public UnaryCallable + setMachineTypeInstanceCallable() { + return setMachineTypeInstanceCallable; + } + + @BetaApi + public UnaryCallable setMetadataInstanceCallable() { + return setMetadataInstanceCallable; + } + + @BetaApi + public UnaryCallable + setMinCpuPlatformInstanceCallable() { + return setMinCpuPlatformInstanceCallable; + } + + @BetaApi + public UnaryCallable + setSchedulingInstanceCallable() { + return setSchedulingInstanceCallable; + } + + @BetaApi + public UnaryCallable + setServiceAccountInstanceCallable() { + return setServiceAccountInstanceCallable; + } + + @BetaApi + public UnaryCallable setTagsInstanceCallable() { + return setTagsInstanceCallable; + } + + @BetaApi + public UnaryCallable startInstanceCallable() { + return startInstanceCallable; + } + + @BetaApi + public UnaryCallable + startWithEncryptionKeyInstanceCallable() { + return startWithEncryptionKeyInstanceCallable; + } + + @BetaApi + public UnaryCallable stopInstanceCallable() { + return stopInstanceCallable; + } + + @BetaApi + public UnaryCallable + updateAccessConfigInstanceCallable() { + return updateAccessConfigInstanceCallable; + } + + @BetaApi + public UnaryCallable + updateNetworkInterfaceInstanceCallable() { + return updateNetworkInterfaceInstanceCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceTemplateCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceTemplateCallableFactory.java new file mode 100644 index 000000000000..fa0f1dca2b34 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceTemplateCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonInstanceTemplateCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceTemplateStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceTemplateStub.java new file mode 100644 index 000000000000..bc01f1963a26 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInstanceTemplateStub.java @@ -0,0 +1,301 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceTemplateClient.ListInstanceTemplatesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteInstanceTemplateHttpRequest; +import com.google.cloud.compute.v1.GetInstanceTemplateHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceTemplateHttpRequest; +import com.google.cloud.compute.v1.InstanceTemplate; +import com.google.cloud.compute.v1.InstanceTemplateList; +import com.google.cloud.compute.v1.ListInstanceTemplatesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalInstanceTemplateName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonInstanceTemplateStub extends InstanceTemplateStub { + @InternalApi + public static final ApiMethodDescriptor + deleteInstanceTemplateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceTemplates.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/instanceTemplates/{instanceTemplate}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalInstanceTemplateName.newFactory()) + .setResourceNameField("instanceTemplate") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getInstanceTemplateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceTemplates.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/instanceTemplates/{instanceTemplate}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalInstanceTemplateName.newFactory()) + .setResourceNameField("instanceTemplate") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceTemplate.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertInstanceTemplateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceTemplates.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/instanceTemplates")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listInstanceTemplatesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.instanceTemplates.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/instanceTemplates")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceTemplateList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteInstanceTemplateCallable; + private final UnaryCallable + getInstanceTemplateCallable; + private final UnaryCallable + insertInstanceTemplateCallable; + private final UnaryCallable + listInstanceTemplatesCallable; + private final UnaryCallable + listInstanceTemplatesPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonInstanceTemplateStub create(InstanceTemplateStubSettings settings) + throws IOException { + return new HttpJsonInstanceTemplateStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonInstanceTemplateStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonInstanceTemplateStub( + InstanceTemplateStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonInstanceTemplateStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonInstanceTemplateStub( + InstanceTemplateStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonInstanceTemplateStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonInstanceTemplateStub( + InstanceTemplateStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonInstanceTemplateCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonInstanceTemplateStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonInstanceTemplateStub( + InstanceTemplateStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteInstanceTemplateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteInstanceTemplateMethodDescriptor) + .build(); + HttpJsonCallSettings + getInstanceTemplateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getInstanceTemplateMethodDescriptor) + .build(); + HttpJsonCallSettings + insertInstanceTemplateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertInstanceTemplateMethodDescriptor) + .build(); + HttpJsonCallSettings + listInstanceTemplatesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listInstanceTemplatesMethodDescriptor) + .build(); + + this.deleteInstanceTemplateCallable = + callableFactory.createUnaryCallable( + deleteInstanceTemplateTransportSettings, + settings.deleteInstanceTemplateSettings(), + clientContext); + this.getInstanceTemplateCallable = + callableFactory.createUnaryCallable( + getInstanceTemplateTransportSettings, + settings.getInstanceTemplateSettings(), + clientContext); + this.insertInstanceTemplateCallable = + callableFactory.createUnaryCallable( + insertInstanceTemplateTransportSettings, + settings.insertInstanceTemplateSettings(), + clientContext); + this.listInstanceTemplatesCallable = + callableFactory.createUnaryCallable( + listInstanceTemplatesTransportSettings, + settings.listInstanceTemplatesSettings(), + clientContext); + this.listInstanceTemplatesPagedCallable = + callableFactory.createPagedCallable( + listInstanceTemplatesTransportSettings, + settings.listInstanceTemplatesSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + deleteInstanceTemplateCallable() { + return deleteInstanceTemplateCallable; + } + + @BetaApi + public UnaryCallable + getInstanceTemplateCallable() { + return getInstanceTemplateCallable; + } + + @BetaApi + public UnaryCallable + insertInstanceTemplateCallable() { + return insertInstanceTemplateCallable; + } + + @BetaApi + public UnaryCallable + listInstanceTemplatesPagedCallable() { + return listInstanceTemplatesPagedCallable; + } + + @BetaApi + public UnaryCallable + listInstanceTemplatesCallable() { + return listInstanceTemplatesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectAttachmentCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectAttachmentCallableFactory.java new file mode 100644 index 000000000000..719bc7630711 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectAttachmentCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonInterconnectAttachmentCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectAttachmentStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectAttachmentStub.java new file mode 100644 index 000000000000..b6878ea5897b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectAttachmentStub.java @@ -0,0 +1,385 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InterconnectAttachmentClient.AggregatedListInterconnectAttachmentsPagedResponse; +import static com.google.cloud.compute.v1.InterconnectAttachmentClient.ListInterconnectAttachmentsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListInterconnectAttachmentsHttpRequest; +import com.google.cloud.compute.v1.DeleteInterconnectAttachmentHttpRequest; +import com.google.cloud.compute.v1.GetInterconnectAttachmentHttpRequest; +import com.google.cloud.compute.v1.InsertInterconnectAttachmentHttpRequest; +import com.google.cloud.compute.v1.InterconnectAttachment; +import com.google.cloud.compute.v1.InterconnectAttachmentAggregatedList; +import com.google.cloud.compute.v1.InterconnectAttachmentList; +import com.google.cloud.compute.v1.ListInterconnectAttachmentsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectRegionInterconnectAttachmentName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonInterconnectAttachmentStub extends InterconnectAttachmentStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList> + aggregatedListInterconnectAttachmentsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("compute.interconnectAttachments.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/aggregated/interconnectAttachments")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance( + InterconnectAttachmentAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteInterconnectAttachmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.interconnectAttachments.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/interconnectAttachments/{interconnectAttachment}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionInterconnectAttachmentName.newFactory()) + .setResourceNameField("interconnectAttachment") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + GetInterconnectAttachmentHttpRequest, InterconnectAttachment> + getInterconnectAttachmentMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.interconnectAttachments.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/interconnectAttachments/{interconnectAttachment}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionInterconnectAttachmentName.newFactory()) + .setResourceNameField("interconnectAttachment") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InterconnectAttachment.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertInterconnectAttachmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.interconnectAttachments.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/interconnectAttachments")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList> + listInterconnectAttachmentsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.interconnectAttachments.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/interconnectAttachments")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InterconnectAttachmentList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList> + aggregatedListInterconnectAttachmentsCallable; + private final UnaryCallable< + AggregatedListInterconnectAttachmentsHttpRequest, + AggregatedListInterconnectAttachmentsPagedResponse> + aggregatedListInterconnectAttachmentsPagedCallable; + private final UnaryCallable + deleteInterconnectAttachmentCallable; + private final UnaryCallable + getInterconnectAttachmentCallable; + private final UnaryCallable + insertInterconnectAttachmentCallable; + private final UnaryCallable + listInterconnectAttachmentsCallable; + private final UnaryCallable< + ListInterconnectAttachmentsHttpRequest, ListInterconnectAttachmentsPagedResponse> + listInterconnectAttachmentsPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonInterconnectAttachmentStub create( + InterconnectAttachmentStubSettings settings) throws IOException { + return new HttpJsonInterconnectAttachmentStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonInterconnectAttachmentStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonInterconnectAttachmentStub( + InterconnectAttachmentStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonInterconnectAttachmentStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonInterconnectAttachmentStub( + InterconnectAttachmentStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonInterconnectAttachmentStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonInterconnectAttachmentStub( + InterconnectAttachmentStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonInterconnectAttachmentCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonInterconnectAttachmentStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonInterconnectAttachmentStub( + InterconnectAttachmentStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList> + aggregatedListInterconnectAttachmentsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(aggregatedListInterconnectAttachmentsMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteInterconnectAttachmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteInterconnectAttachmentMethodDescriptor) + .build(); + HttpJsonCallSettings + getInterconnectAttachmentTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getInterconnectAttachmentMethodDescriptor) + .build(); + HttpJsonCallSettings + insertInterconnectAttachmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertInterconnectAttachmentMethodDescriptor) + .build(); + HttpJsonCallSettings + listInterconnectAttachmentsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listInterconnectAttachmentsMethodDescriptor) + .build(); + + this.aggregatedListInterconnectAttachmentsCallable = + callableFactory.createUnaryCallable( + aggregatedListInterconnectAttachmentsTransportSettings, + settings.aggregatedListInterconnectAttachmentsSettings(), + clientContext); + this.aggregatedListInterconnectAttachmentsPagedCallable = + callableFactory.createPagedCallable( + aggregatedListInterconnectAttachmentsTransportSettings, + settings.aggregatedListInterconnectAttachmentsSettings(), + clientContext); + this.deleteInterconnectAttachmentCallable = + callableFactory.createUnaryCallable( + deleteInterconnectAttachmentTransportSettings, + settings.deleteInterconnectAttachmentSettings(), + clientContext); + this.getInterconnectAttachmentCallable = + callableFactory.createUnaryCallable( + getInterconnectAttachmentTransportSettings, + settings.getInterconnectAttachmentSettings(), + clientContext); + this.insertInterconnectAttachmentCallable = + callableFactory.createUnaryCallable( + insertInterconnectAttachmentTransportSettings, + settings.insertInterconnectAttachmentSettings(), + clientContext); + this.listInterconnectAttachmentsCallable = + callableFactory.createUnaryCallable( + listInterconnectAttachmentsTransportSettings, + settings.listInterconnectAttachmentsSettings(), + clientContext); + this.listInterconnectAttachmentsPagedCallable = + callableFactory.createPagedCallable( + listInterconnectAttachmentsTransportSettings, + settings.listInterconnectAttachmentsSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable< + AggregatedListInterconnectAttachmentsHttpRequest, + AggregatedListInterconnectAttachmentsPagedResponse> + aggregatedListInterconnectAttachmentsPagedCallable() { + return aggregatedListInterconnectAttachmentsPagedCallable; + } + + @BetaApi + public UnaryCallable< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList> + aggregatedListInterconnectAttachmentsCallable() { + return aggregatedListInterconnectAttachmentsCallable; + } + + @BetaApi + public UnaryCallable + deleteInterconnectAttachmentCallable() { + return deleteInterconnectAttachmentCallable; + } + + @BetaApi + public UnaryCallable + getInterconnectAttachmentCallable() { + return getInterconnectAttachmentCallable; + } + + @BetaApi + public UnaryCallable + insertInterconnectAttachmentCallable() { + return insertInterconnectAttachmentCallable; + } + + @BetaApi + public UnaryCallable< + ListInterconnectAttachmentsHttpRequest, ListInterconnectAttachmentsPagedResponse> + listInterconnectAttachmentsPagedCallable() { + return listInterconnectAttachmentsPagedCallable; + } + + @BetaApi + public UnaryCallable + listInterconnectAttachmentsCallable() { + return listInterconnectAttachmentsCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectCallableFactory.java new file mode 100644 index 000000000000..900ee9f7070b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonInterconnectCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectLocationCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectLocationCallableFactory.java new file mode 100644 index 000000000000..163d3fc8f470 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectLocationCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonInterconnectLocationCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectLocationStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectLocationStub.java new file mode 100644 index 000000000000..e8c631e04b58 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectLocationStub.java @@ -0,0 +1,227 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InterconnectLocationClient.ListInterconnectLocationsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.GetInterconnectLocationHttpRequest; +import com.google.cloud.compute.v1.InterconnectLocation; +import com.google.cloud.compute.v1.InterconnectLocationList; +import com.google.cloud.compute.v1.ListInterconnectLocationsHttpRequest; +import com.google.cloud.compute.v1.ProjectGlobalInterconnectLocationName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonInterconnectLocationStub extends InterconnectLocationStub { + @InternalApi + public static final ApiMethodDescriptor + getInterconnectLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.interconnectLocations.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/interconnectLocations/{interconnectLocation}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalInterconnectLocationName.newFactory()) + .setResourceNameField("interconnectLocation") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InterconnectLocation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + ListInterconnectLocationsHttpRequest, InterconnectLocationList> + listInterconnectLocationsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.interconnectLocations.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/interconnectLocations")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InterconnectLocationList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + getInterconnectLocationCallable; + private final UnaryCallable + listInterconnectLocationsCallable; + private final UnaryCallable< + ListInterconnectLocationsHttpRequest, ListInterconnectLocationsPagedResponse> + listInterconnectLocationsPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonInterconnectLocationStub create( + InterconnectLocationStubSettings settings) throws IOException { + return new HttpJsonInterconnectLocationStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonInterconnectLocationStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonInterconnectLocationStub( + InterconnectLocationStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonInterconnectLocationStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonInterconnectLocationStub( + InterconnectLocationStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonInterconnectLocationStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonInterconnectLocationStub( + InterconnectLocationStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonInterconnectLocationCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonInterconnectLocationStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonInterconnectLocationStub( + InterconnectLocationStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + getInterconnectLocationTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getInterconnectLocationMethodDescriptor) + .build(); + HttpJsonCallSettings + listInterconnectLocationsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listInterconnectLocationsMethodDescriptor) + .build(); + + this.getInterconnectLocationCallable = + callableFactory.createUnaryCallable( + getInterconnectLocationTransportSettings, + settings.getInterconnectLocationSettings(), + clientContext); + this.listInterconnectLocationsCallable = + callableFactory.createUnaryCallable( + listInterconnectLocationsTransportSettings, + settings.listInterconnectLocationsSettings(), + clientContext); + this.listInterconnectLocationsPagedCallable = + callableFactory.createPagedCallable( + listInterconnectLocationsTransportSettings, + settings.listInterconnectLocationsSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + getInterconnectLocationCallable() { + return getInterconnectLocationCallable; + } + + @BetaApi + public UnaryCallable + listInterconnectLocationsPagedCallable() { + return listInterconnectLocationsPagedCallable; + } + + @BetaApi + public UnaryCallable + listInterconnectLocationsCallable() { + return listInterconnectLocationsCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectStub.java new file mode 100644 index 000000000000..b1b15eb95a92 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonInterconnectStub.java @@ -0,0 +1,326 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InterconnectClient.ListInterconnectsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteInterconnectHttpRequest; +import com.google.cloud.compute.v1.GetInterconnectHttpRequest; +import com.google.cloud.compute.v1.InsertInterconnectHttpRequest; +import com.google.cloud.compute.v1.Interconnect; +import com.google.cloud.compute.v1.InterconnectList; +import com.google.cloud.compute.v1.ListInterconnectsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchInterconnectHttpRequest; +import com.google.cloud.compute.v1.ProjectGlobalInterconnectName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonInterconnectStub extends InterconnectStub { + @InternalApi + public static final ApiMethodDescriptor + deleteInterconnectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.interconnects.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/interconnects/{interconnect}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalInterconnectName.newFactory()) + .setResourceNameField("interconnect") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getInterconnectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.interconnects.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/interconnects/{interconnect}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalInterconnectName.newFactory()) + .setResourceNameField("interconnect") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Interconnect.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertInterconnectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.interconnects.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/interconnects")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listInterconnectsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.interconnects.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/interconnects")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InterconnectList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchInterconnectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.interconnects.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/interconnects/{interconnect}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalInterconnectName.newFactory()) + .setResourceNameField("interconnect") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable deleteInterconnectCallable; + private final UnaryCallable getInterconnectCallable; + private final UnaryCallable insertInterconnectCallable; + private final UnaryCallable + listInterconnectsCallable; + private final UnaryCallable + listInterconnectsPagedCallable; + private final UnaryCallable patchInterconnectCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonInterconnectStub create(InterconnectStubSettings settings) + throws IOException { + return new HttpJsonInterconnectStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonInterconnectStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonInterconnectStub( + InterconnectStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonInterconnectStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonInterconnectStub( + InterconnectStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonInterconnectStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonInterconnectStub(InterconnectStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonInterconnectCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonInterconnectStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonInterconnectStub( + InterconnectStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteInterconnectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteInterconnectMethodDescriptor) + .build(); + HttpJsonCallSettings + getInterconnectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getInterconnectMethodDescriptor) + .build(); + HttpJsonCallSettings + insertInterconnectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertInterconnectMethodDescriptor) + .build(); + HttpJsonCallSettings + listInterconnectsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listInterconnectsMethodDescriptor) + .build(); + HttpJsonCallSettings + patchInterconnectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchInterconnectMethodDescriptor) + .build(); + + this.deleteInterconnectCallable = + callableFactory.createUnaryCallable( + deleteInterconnectTransportSettings, + settings.deleteInterconnectSettings(), + clientContext); + this.getInterconnectCallable = + callableFactory.createUnaryCallable( + getInterconnectTransportSettings, settings.getInterconnectSettings(), clientContext); + this.insertInterconnectCallable = + callableFactory.createUnaryCallable( + insertInterconnectTransportSettings, + settings.insertInterconnectSettings(), + clientContext); + this.listInterconnectsCallable = + callableFactory.createUnaryCallable( + listInterconnectsTransportSettings, + settings.listInterconnectsSettings(), + clientContext); + this.listInterconnectsPagedCallable = + callableFactory.createPagedCallable( + listInterconnectsTransportSettings, + settings.listInterconnectsSettings(), + clientContext); + this.patchInterconnectCallable = + callableFactory.createUnaryCallable( + patchInterconnectTransportSettings, + settings.patchInterconnectSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteInterconnectCallable() { + return deleteInterconnectCallable; + } + + @BetaApi + public UnaryCallable getInterconnectCallable() { + return getInterconnectCallable; + } + + @BetaApi + public UnaryCallable insertInterconnectCallable() { + return insertInterconnectCallable; + } + + @BetaApi + public UnaryCallable + listInterconnectsPagedCallable() { + return listInterconnectsPagedCallable; + } + + @BetaApi + public UnaryCallable listInterconnectsCallable() { + return listInterconnectsCallable; + } + + @BetaApi + public UnaryCallable patchInterconnectCallable() { + return patchInterconnectCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseCallableFactory.java new file mode 100644 index 000000000000..9209664298a0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonLicenseCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseCodeCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseCodeCallableFactory.java new file mode 100644 index 000000000000..214b28ee2a1a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseCodeCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonLicenseCodeCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseCodeStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseCodeStub.java new file mode 100644 index 000000000000..6d6cb808fb5d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseCodeStub.java @@ -0,0 +1,204 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.GetLicenseCodeHttpRequest; +import com.google.cloud.compute.v1.LicenseCode; +import com.google.cloud.compute.v1.ProjectGlobalLicenseCodeName; +import com.google.cloud.compute.v1.ProjectGlobalLicenseCodeResourceName; +import com.google.cloud.compute.v1.TestIamPermissionsLicenseCodeHttpRequest; +import com.google.cloud.compute.v1.TestPermissionsResponse; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonLicenseCodeStub extends LicenseCodeStub { + @InternalApi + public static final ApiMethodDescriptor + getLicenseCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.licenseCodes.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/licenseCodes/{licenseCode}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalLicenseCodeName.newFactory()) + .setResourceNameField("licenseCode") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(LicenseCode.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + TestIamPermissionsLicenseCodeHttpRequest, TestPermissionsResponse> + testIamPermissionsLicenseCodeMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.licenseCodes.testIamPermissions") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/licenseCodes/{resource}/testIamPermissions")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalLicenseCodeResourceName.newFactory()) + .setResourceNameField("resource") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TestPermissionsResponse.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable getLicenseCodeCallable; + private final UnaryCallable + testIamPermissionsLicenseCodeCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonLicenseCodeStub create(LicenseCodeStubSettings settings) + throws IOException { + return new HttpJsonLicenseCodeStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonLicenseCodeStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonLicenseCodeStub(LicenseCodeStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonLicenseCodeStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonLicenseCodeStub( + LicenseCodeStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonLicenseCodeStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonLicenseCodeStub(LicenseCodeStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonLicenseCodeCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonLicenseCodeStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonLicenseCodeStub( + LicenseCodeStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings getLicenseCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLicenseCodeMethodDescriptor) + .build(); + HttpJsonCallSettings + testIamPermissionsLicenseCodeTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(testIamPermissionsLicenseCodeMethodDescriptor) + .build(); + + this.getLicenseCodeCallable = + callableFactory.createUnaryCallable( + getLicenseCodeTransportSettings, settings.getLicenseCodeSettings(), clientContext); + this.testIamPermissionsLicenseCodeCallable = + callableFactory.createUnaryCallable( + testIamPermissionsLicenseCodeTransportSettings, + settings.testIamPermissionsLicenseCodeSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable getLicenseCodeCallable() { + return getLicenseCodeCallable; + } + + @BetaApi + public UnaryCallable + testIamPermissionsLicenseCodeCallable() { + return testIamPermissionsLicenseCodeCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseStub.java new file mode 100644 index 000000000000..a3e2dbb86fb3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonLicenseStub.java @@ -0,0 +1,317 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.LicenseClient.ListLicensesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteLicenseHttpRequest; +import com.google.cloud.compute.v1.GetLicenseHttpRequest; +import com.google.cloud.compute.v1.InsertLicenseHttpRequest; +import com.google.cloud.compute.v1.License; +import com.google.cloud.compute.v1.LicensesListResponse; +import com.google.cloud.compute.v1.ListLicensesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalLicenseName; +import com.google.cloud.compute.v1.ProjectGlobalLicenseResourceName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.TestIamPermissionsLicenseHttpRequest; +import com.google.cloud.compute.v1.TestPermissionsResponse; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonLicenseStub extends LicenseStub { + @InternalApi + public static final ApiMethodDescriptor + deleteLicenseMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.licenses.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/licenses/{license}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalLicenseName.newFactory()) + .setResourceNameField("license") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getLicenseMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.licenses.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/licenses/{license}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalLicenseName.newFactory()) + .setResourceNameField("license") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(License.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertLicenseMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.licenses.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/licenses")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listLicensesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.licenses.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/licenses")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(LicensesListResponse.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + TestIamPermissionsLicenseHttpRequest, TestPermissionsResponse> + testIamPermissionsLicenseMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.licenses.testIamPermissions") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/licenses/{resource}/testIamPermissions")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalLicenseResourceName.newFactory()) + .setResourceNameField("resource") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TestPermissionsResponse.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable deleteLicenseCallable; + private final UnaryCallable getLicenseCallable; + private final UnaryCallable insertLicenseCallable; + private final UnaryCallable listLicensesCallable; + private final UnaryCallable + listLicensesPagedCallable; + private final UnaryCallable + testIamPermissionsLicenseCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonLicenseStub create(LicenseStubSettings settings) throws IOException { + return new HttpJsonLicenseStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonLicenseStub create(ClientContext clientContext) throws IOException { + return new HttpJsonLicenseStub(LicenseStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonLicenseStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonLicenseStub( + LicenseStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonLicenseStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonLicenseStub(LicenseStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonLicenseCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonLicenseStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonLicenseStub( + LicenseStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings deleteLicenseTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteLicenseMethodDescriptor) + .build(); + HttpJsonCallSettings getLicenseTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLicenseMethodDescriptor) + .build(); + HttpJsonCallSettings insertLicenseTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertLicenseMethodDescriptor) + .build(); + HttpJsonCallSettings + listLicensesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLicensesMethodDescriptor) + .build(); + HttpJsonCallSettings + testIamPermissionsLicenseTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(testIamPermissionsLicenseMethodDescriptor) + .build(); + + this.deleteLicenseCallable = + callableFactory.createUnaryCallable( + deleteLicenseTransportSettings, settings.deleteLicenseSettings(), clientContext); + this.getLicenseCallable = + callableFactory.createUnaryCallable( + getLicenseTransportSettings, settings.getLicenseSettings(), clientContext); + this.insertLicenseCallable = + callableFactory.createUnaryCallable( + insertLicenseTransportSettings, settings.insertLicenseSettings(), clientContext); + this.listLicensesCallable = + callableFactory.createUnaryCallable( + listLicensesTransportSettings, settings.listLicensesSettings(), clientContext); + this.listLicensesPagedCallable = + callableFactory.createPagedCallable( + listLicensesTransportSettings, settings.listLicensesSettings(), clientContext); + this.testIamPermissionsLicenseCallable = + callableFactory.createUnaryCallable( + testIamPermissionsLicenseTransportSettings, + settings.testIamPermissionsLicenseSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteLicenseCallable() { + return deleteLicenseCallable; + } + + @BetaApi + public UnaryCallable getLicenseCallable() { + return getLicenseCallable; + } + + @BetaApi + public UnaryCallable insertLicenseCallable() { + return insertLicenseCallable; + } + + @BetaApi + public UnaryCallable + listLicensesPagedCallable() { + return listLicensesPagedCallable; + } + + @BetaApi + public UnaryCallable listLicensesCallable() { + return listLicensesCallable; + } + + @BetaApi + public UnaryCallable + testIamPermissionsLicenseCallable() { + return testIamPermissionsLicenseCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonMachineTypeCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonMachineTypeCallableFactory.java new file mode 100644 index 000000000000..c7bf6f0a3188 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonMachineTypeCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonMachineTypeCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonMachineTypeStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonMachineTypeStub.java new file mode 100644 index 000000000000..3481d3b7a886 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonMachineTypeStub.java @@ -0,0 +1,269 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.MachineTypeClient.AggregatedListMachineTypesPagedResponse; +import static com.google.cloud.compute.v1.MachineTypeClient.ListMachineTypesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListMachineTypesHttpRequest; +import com.google.cloud.compute.v1.GetMachineTypeHttpRequest; +import com.google.cloud.compute.v1.ListMachineTypesHttpRequest; +import com.google.cloud.compute.v1.MachineType; +import com.google.cloud.compute.v1.MachineTypeAggregatedList; +import com.google.cloud.compute.v1.MachineTypeList; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectZoneMachineTypeName; +import com.google.cloud.compute.v1.ProjectZoneName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonMachineTypeStub extends MachineTypeStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList> + aggregatedListMachineTypesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.machineTypes.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/machineTypes")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(MachineTypeAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getMachineTypeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.machineTypes.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/machineTypes/{machineType}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneMachineTypeName.newFactory()) + .setResourceNameField("machineType") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(MachineType.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listMachineTypesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.machineTypes.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/machineTypes")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(MachineTypeList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + aggregatedListMachineTypesCallable; + private final UnaryCallable< + AggregatedListMachineTypesHttpRequest, AggregatedListMachineTypesPagedResponse> + aggregatedListMachineTypesPagedCallable; + private final UnaryCallable getMachineTypeCallable; + private final UnaryCallable + listMachineTypesCallable; + private final UnaryCallable + listMachineTypesPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonMachineTypeStub create(MachineTypeStubSettings settings) + throws IOException { + return new HttpJsonMachineTypeStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonMachineTypeStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonMachineTypeStub(MachineTypeStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonMachineTypeStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonMachineTypeStub( + MachineTypeStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonMachineTypeStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonMachineTypeStub(MachineTypeStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonMachineTypeCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonMachineTypeStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonMachineTypeStub( + MachineTypeStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListMachineTypesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListMachineTypesMethodDescriptor) + .build(); + HttpJsonCallSettings getMachineTypeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getMachineTypeMethodDescriptor) + .build(); + HttpJsonCallSettings + listMachineTypesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listMachineTypesMethodDescriptor) + .build(); + + this.aggregatedListMachineTypesCallable = + callableFactory.createUnaryCallable( + aggregatedListMachineTypesTransportSettings, + settings.aggregatedListMachineTypesSettings(), + clientContext); + this.aggregatedListMachineTypesPagedCallable = + callableFactory.createPagedCallable( + aggregatedListMachineTypesTransportSettings, + settings.aggregatedListMachineTypesSettings(), + clientContext); + this.getMachineTypeCallable = + callableFactory.createUnaryCallable( + getMachineTypeTransportSettings, settings.getMachineTypeSettings(), clientContext); + this.listMachineTypesCallable = + callableFactory.createUnaryCallable( + listMachineTypesTransportSettings, settings.listMachineTypesSettings(), clientContext); + this.listMachineTypesPagedCallable = + callableFactory.createPagedCallable( + listMachineTypesTransportSettings, settings.listMachineTypesSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable< + AggregatedListMachineTypesHttpRequest, AggregatedListMachineTypesPagedResponse> + aggregatedListMachineTypesPagedCallable() { + return aggregatedListMachineTypesPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListMachineTypesCallable() { + return aggregatedListMachineTypesCallable; + } + + @BetaApi + public UnaryCallable getMachineTypeCallable() { + return getMachineTypeCallable; + } + + @BetaApi + public UnaryCallable + listMachineTypesPagedCallable() { + return listMachineTypesPagedCallable; + } + + @BetaApi + public UnaryCallable listMachineTypesCallable() { + return listMachineTypesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonNetworkCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonNetworkCallableFactory.java new file mode 100644 index 000000000000..f693074eb19a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonNetworkCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonNetworkCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonNetworkStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonNetworkStub.java new file mode 100644 index 000000000000..e6749f921a7b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonNetworkStub.java @@ -0,0 +1,419 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.NetworkClient.ListNetworksPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AddPeeringNetworkHttpRequest; +import com.google.cloud.compute.v1.DeleteNetworkHttpRequest; +import com.google.cloud.compute.v1.GetNetworkHttpRequest; +import com.google.cloud.compute.v1.InsertNetworkHttpRequest; +import com.google.cloud.compute.v1.ListNetworksHttpRequest; +import com.google.cloud.compute.v1.Network; +import com.google.cloud.compute.v1.NetworkList; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchNetworkHttpRequest; +import com.google.cloud.compute.v1.ProjectGlobalNetworkName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.RemovePeeringNetworkHttpRequest; +import com.google.cloud.compute.v1.SwitchToCustomModeNetworkHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonNetworkStub extends NetworkStub { + @InternalApi + public static final ApiMethodDescriptor + addPeeringNetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.networks.addPeering") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/networks/{network}/addPeering")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalNetworkName.newFactory()) + .setResourceNameField("network") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteNetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.networks.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/networks/{network}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalNetworkName.newFactory()) + .setResourceNameField("network") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getNetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.networks.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/networks/{network}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalNetworkName.newFactory()) + .setResourceNameField("network") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Network.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertNetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.networks.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/networks")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listNetworksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.networks.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/networks")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(NetworkList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchNetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.networks.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/networks/{network}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalNetworkName.newFactory()) + .setResourceNameField("network") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + removePeeringNetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.networks.removePeering") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/networks/{network}/removePeering")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalNetworkName.newFactory()) + .setResourceNameField("network") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + switchToCustomModeNetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.networks.switchToCustomMode") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/networks/{network}/switchToCustomMode")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalNetworkName.newFactory()) + .setResourceNameField("network") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable addPeeringNetworkCallable; + private final UnaryCallable deleteNetworkCallable; + private final UnaryCallable getNetworkCallable; + private final UnaryCallable insertNetworkCallable; + private final UnaryCallable listNetworksCallable; + private final UnaryCallable + listNetworksPagedCallable; + private final UnaryCallable patchNetworkCallable; + private final UnaryCallable + removePeeringNetworkCallable; + private final UnaryCallable + switchToCustomModeNetworkCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonNetworkStub create(NetworkStubSettings settings) throws IOException { + return new HttpJsonNetworkStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonNetworkStub create(ClientContext clientContext) throws IOException { + return new HttpJsonNetworkStub(NetworkStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonNetworkStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonNetworkStub( + NetworkStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonNetworkStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonNetworkStub(NetworkStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonNetworkCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonNetworkStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonNetworkStub( + NetworkStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + addPeeringNetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(addPeeringNetworkMethodDescriptor) + .build(); + HttpJsonCallSettings deleteNetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteNetworkMethodDescriptor) + .build(); + HttpJsonCallSettings getNetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getNetworkMethodDescriptor) + .build(); + HttpJsonCallSettings insertNetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertNetworkMethodDescriptor) + .build(); + HttpJsonCallSettings listNetworksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listNetworksMethodDescriptor) + .build(); + HttpJsonCallSettings patchNetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchNetworkMethodDescriptor) + .build(); + HttpJsonCallSettings + removePeeringNetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(removePeeringNetworkMethodDescriptor) + .build(); + HttpJsonCallSettings + switchToCustomModeNetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(switchToCustomModeNetworkMethodDescriptor) + .build(); + + this.addPeeringNetworkCallable = + callableFactory.createUnaryCallable( + addPeeringNetworkTransportSettings, + settings.addPeeringNetworkSettings(), + clientContext); + this.deleteNetworkCallable = + callableFactory.createUnaryCallable( + deleteNetworkTransportSettings, settings.deleteNetworkSettings(), clientContext); + this.getNetworkCallable = + callableFactory.createUnaryCallable( + getNetworkTransportSettings, settings.getNetworkSettings(), clientContext); + this.insertNetworkCallable = + callableFactory.createUnaryCallable( + insertNetworkTransportSettings, settings.insertNetworkSettings(), clientContext); + this.listNetworksCallable = + callableFactory.createUnaryCallable( + listNetworksTransportSettings, settings.listNetworksSettings(), clientContext); + this.listNetworksPagedCallable = + callableFactory.createPagedCallable( + listNetworksTransportSettings, settings.listNetworksSettings(), clientContext); + this.patchNetworkCallable = + callableFactory.createUnaryCallable( + patchNetworkTransportSettings, settings.patchNetworkSettings(), clientContext); + this.removePeeringNetworkCallable = + callableFactory.createUnaryCallable( + removePeeringNetworkTransportSettings, + settings.removePeeringNetworkSettings(), + clientContext); + this.switchToCustomModeNetworkCallable = + callableFactory.createUnaryCallable( + switchToCustomModeNetworkTransportSettings, + settings.switchToCustomModeNetworkSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable addPeeringNetworkCallable() { + return addPeeringNetworkCallable; + } + + @BetaApi + public UnaryCallable deleteNetworkCallable() { + return deleteNetworkCallable; + } + + @BetaApi + public UnaryCallable getNetworkCallable() { + return getNetworkCallable; + } + + @BetaApi + public UnaryCallable insertNetworkCallable() { + return insertNetworkCallable; + } + + @BetaApi + public UnaryCallable + listNetworksPagedCallable() { + return listNetworksPagedCallable; + } + + @BetaApi + public UnaryCallable listNetworksCallable() { + return listNetworksCallable; + } + + @BetaApi + public UnaryCallable patchNetworkCallable() { + return patchNetworkCallable; + } + + @BetaApi + public UnaryCallable removePeeringNetworkCallable() { + return removePeeringNetworkCallable; + } + + @BetaApi + public UnaryCallable + switchToCustomModeNetworkCallable() { + return switchToCustomModeNetworkCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonProjectCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonProjectCallableFactory.java new file mode 100644 index 000000000000..d89c6781bf52 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonProjectCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonProjectCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonProjectStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonProjectStub.java new file mode 100644 index 000000000000..e85bff516d78 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonProjectStub.java @@ -0,0 +1,604 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ProjectClient.GetXpnResourcesProjectsPagedResponse; +import static com.google.cloud.compute.v1.ProjectClient.ListXpnHostsProjectsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DisableXpnHostProjectHttpRequest; +import com.google.cloud.compute.v1.DisableXpnResourceProjectHttpRequest; +import com.google.cloud.compute.v1.EnableXpnHostProjectHttpRequest; +import com.google.cloud.compute.v1.EnableXpnResourceProjectHttpRequest; +import com.google.cloud.compute.v1.GetProjectHttpRequest; +import com.google.cloud.compute.v1.GetXpnHostProjectHttpRequest; +import com.google.cloud.compute.v1.GetXpnResourcesProjectsHttpRequest; +import com.google.cloud.compute.v1.ListXpnHostsProjectsHttpRequest; +import com.google.cloud.compute.v1.MoveDiskProjectHttpRequest; +import com.google.cloud.compute.v1.MoveInstanceProjectHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.Project; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectsGetXpnResources; +import com.google.cloud.compute.v1.SetCommonInstanceMetadataProjectHttpRequest; +import com.google.cloud.compute.v1.SetUsageExportBucketProjectHttpRequest; +import com.google.cloud.compute.v1.XpnHostList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonProjectStub extends ProjectStub { + @InternalApi + public static final ApiMethodDescriptor + disableXpnHostProjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.projects.disableXpnHost") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/disableXpnHost")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + disableXpnResourceProjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.projects.disableXpnResource") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/disableXpnResource")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + enableXpnHostProjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.projects.enableXpnHost") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/enableXpnHost")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + enableXpnResourceProjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.projects.enableXpnResource") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/enableXpnResource")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getProjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.projects.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Project.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getXpnHostProjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.projects.getXpnHost") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/getXpnHost")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Project.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources> + getXpnResourcesProjectsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.projects.getXpnResources") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/getXpnResources")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "order_by", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(ProjectsGetXpnResources.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listXpnHostsProjectsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.projects.listXpnHosts") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/listXpnHosts")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "order_by", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(XpnHostList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + moveDiskProjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.projects.moveDisk") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/moveDisk")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + moveInstanceProjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.projects.moveInstance") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/moveInstance")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setCommonInstanceMetadataProjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.projects.setCommonInstanceMetadata") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate(PathTemplate.create("{project}/setCommonInstanceMetadata")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setUsageExportBucketProjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.projects.setUsageExportBucket") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate(PathTemplate.create("{project}/setUsageExportBucket")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + disableXpnHostProjectCallable; + private final UnaryCallable + disableXpnResourceProjectCallable; + private final UnaryCallable + enableXpnHostProjectCallable; + private final UnaryCallable + enableXpnResourceProjectCallable; + private final UnaryCallable getProjectCallable; + private final UnaryCallable getXpnHostProjectCallable; + private final UnaryCallable + getXpnResourcesProjectsCallable; + private final UnaryCallable< + GetXpnResourcesProjectsHttpRequest, GetXpnResourcesProjectsPagedResponse> + getXpnResourcesProjectsPagedCallable; + private final UnaryCallable + listXpnHostsProjectsCallable; + private final UnaryCallable + listXpnHostsProjectsPagedCallable; + private final UnaryCallable moveDiskProjectCallable; + private final UnaryCallable + moveInstanceProjectCallable; + private final UnaryCallable + setCommonInstanceMetadataProjectCallable; + private final UnaryCallable + setUsageExportBucketProjectCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonProjectStub create(ProjectStubSettings settings) throws IOException { + return new HttpJsonProjectStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonProjectStub create(ClientContext clientContext) throws IOException { + return new HttpJsonProjectStub(ProjectStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonProjectStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonProjectStub( + ProjectStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonProjectStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonProjectStub(ProjectStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonProjectCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonProjectStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonProjectStub( + ProjectStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + disableXpnHostProjectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(disableXpnHostProjectMethodDescriptor) + .build(); + HttpJsonCallSettings + disableXpnResourceProjectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(disableXpnResourceProjectMethodDescriptor) + .build(); + HttpJsonCallSettings + enableXpnHostProjectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(enableXpnHostProjectMethodDescriptor) + .build(); + HttpJsonCallSettings + enableXpnResourceProjectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(enableXpnResourceProjectMethodDescriptor) + .build(); + HttpJsonCallSettings getProjectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getProjectMethodDescriptor) + .build(); + HttpJsonCallSettings getXpnHostProjectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getXpnHostProjectMethodDescriptor) + .build(); + HttpJsonCallSettings + getXpnResourcesProjectsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getXpnResourcesProjectsMethodDescriptor) + .build(); + HttpJsonCallSettings + listXpnHostsProjectsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listXpnHostsProjectsMethodDescriptor) + .build(); + HttpJsonCallSettings moveDiskProjectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(moveDiskProjectMethodDescriptor) + .build(); + HttpJsonCallSettings + moveInstanceProjectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(moveInstanceProjectMethodDescriptor) + .build(); + HttpJsonCallSettings + setCommonInstanceMetadataProjectTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(setCommonInstanceMetadataProjectMethodDescriptor) + .build(); + HttpJsonCallSettings + setUsageExportBucketProjectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setUsageExportBucketProjectMethodDescriptor) + .build(); + + this.disableXpnHostProjectCallable = + callableFactory.createUnaryCallable( + disableXpnHostProjectTransportSettings, + settings.disableXpnHostProjectSettings(), + clientContext); + this.disableXpnResourceProjectCallable = + callableFactory.createUnaryCallable( + disableXpnResourceProjectTransportSettings, + settings.disableXpnResourceProjectSettings(), + clientContext); + this.enableXpnHostProjectCallable = + callableFactory.createUnaryCallable( + enableXpnHostProjectTransportSettings, + settings.enableXpnHostProjectSettings(), + clientContext); + this.enableXpnResourceProjectCallable = + callableFactory.createUnaryCallable( + enableXpnResourceProjectTransportSettings, + settings.enableXpnResourceProjectSettings(), + clientContext); + this.getProjectCallable = + callableFactory.createUnaryCallable( + getProjectTransportSettings, settings.getProjectSettings(), clientContext); + this.getXpnHostProjectCallable = + callableFactory.createUnaryCallable( + getXpnHostProjectTransportSettings, + settings.getXpnHostProjectSettings(), + clientContext); + this.getXpnResourcesProjectsCallable = + callableFactory.createUnaryCallable( + getXpnResourcesProjectsTransportSettings, + settings.getXpnResourcesProjectsSettings(), + clientContext); + this.getXpnResourcesProjectsPagedCallable = + callableFactory.createPagedCallable( + getXpnResourcesProjectsTransportSettings, + settings.getXpnResourcesProjectsSettings(), + clientContext); + this.listXpnHostsProjectsCallable = + callableFactory.createUnaryCallable( + listXpnHostsProjectsTransportSettings, + settings.listXpnHostsProjectsSettings(), + clientContext); + this.listXpnHostsProjectsPagedCallable = + callableFactory.createPagedCallable( + listXpnHostsProjectsTransportSettings, + settings.listXpnHostsProjectsSettings(), + clientContext); + this.moveDiskProjectCallable = + callableFactory.createUnaryCallable( + moveDiskProjectTransportSettings, settings.moveDiskProjectSettings(), clientContext); + this.moveInstanceProjectCallable = + callableFactory.createUnaryCallable( + moveInstanceProjectTransportSettings, + settings.moveInstanceProjectSettings(), + clientContext); + this.setCommonInstanceMetadataProjectCallable = + callableFactory.createUnaryCallable( + setCommonInstanceMetadataProjectTransportSettings, + settings.setCommonInstanceMetadataProjectSettings(), + clientContext); + this.setUsageExportBucketProjectCallable = + callableFactory.createUnaryCallable( + setUsageExportBucketProjectTransportSettings, + settings.setUsageExportBucketProjectSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + disableXpnHostProjectCallable() { + return disableXpnHostProjectCallable; + } + + @BetaApi + public UnaryCallable + disableXpnResourceProjectCallable() { + return disableXpnResourceProjectCallable; + } + + @BetaApi + public UnaryCallable enableXpnHostProjectCallable() { + return enableXpnHostProjectCallable; + } + + @BetaApi + public UnaryCallable + enableXpnResourceProjectCallable() { + return enableXpnResourceProjectCallable; + } + + @BetaApi + public UnaryCallable getProjectCallable() { + return getProjectCallable; + } + + @BetaApi + public UnaryCallable getXpnHostProjectCallable() { + return getXpnHostProjectCallable; + } + + @BetaApi + public UnaryCallable + getXpnResourcesProjectsPagedCallable() { + return getXpnResourcesProjectsPagedCallable; + } + + @BetaApi + public UnaryCallable + getXpnResourcesProjectsCallable() { + return getXpnResourcesProjectsCallable; + } + + @BetaApi + public UnaryCallable + listXpnHostsProjectsPagedCallable() { + return listXpnHostsProjectsPagedCallable; + } + + @BetaApi + public UnaryCallable + listXpnHostsProjectsCallable() { + return listXpnHostsProjectsCallable; + } + + @BetaApi + public UnaryCallable moveDiskProjectCallable() { + return moveDiskProjectCallable; + } + + @BetaApi + public UnaryCallable moveInstanceProjectCallable() { + return moveInstanceProjectCallable; + } + + @BetaApi + public UnaryCallable + setCommonInstanceMetadataProjectCallable() { + return setCommonInstanceMetadataProjectCallable; + } + + @BetaApi + public UnaryCallable + setUsageExportBucketProjectCallable() { + return setUsageExportBucketProjectCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionAutoscalerCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionAutoscalerCallableFactory.java new file mode 100644 index 000000000000..d91f04332155 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionAutoscalerCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonRegionAutoscalerCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionAutoscalerStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionAutoscalerStub.java new file mode 100644 index 000000000000..14edae389a0e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionAutoscalerStub.java @@ -0,0 +1,380 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionAutoscalerClient.ListRegionAutoscalersPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.Autoscaler; +import com.google.cloud.compute.v1.DeleteRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.GetRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.InsertRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.ListRegionAutoscalersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.ProjectRegionAutoscalerName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.RegionAutoscalerList; +import com.google.cloud.compute.v1.UpdateRegionAutoscalerHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonRegionAutoscalerStub extends RegionAutoscalerStub { + @InternalApi + public static final ApiMethodDescriptor + deleteRegionAutoscalerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionAutoscalers.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/autoscalers/{autoscaler}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionAutoscalerName.newFactory()) + .setResourceNameField("autoscaler") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getRegionAutoscalerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionAutoscalers.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/autoscalers/{autoscaler}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionAutoscalerName.newFactory()) + .setResourceNameField("autoscaler") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Autoscaler.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertRegionAutoscalerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionAutoscalers.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/autoscalers")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listRegionAutoscalersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionAutoscalers.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/autoscalers")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(RegionAutoscalerList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchRegionAutoscalerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionAutoscalers.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/autoscalers")) + .setQueryParams(Sets.newHashSet("autoscaler", "requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateRegionAutoscalerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionAutoscalers.update") + .setHttpMethod(HttpMethods.PUT) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/autoscalers")) + .setQueryParams(Sets.newHashSet("autoscaler", "requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteRegionAutoscalerCallable; + private final UnaryCallable + getRegionAutoscalerCallable; + private final UnaryCallable + insertRegionAutoscalerCallable; + private final UnaryCallable + listRegionAutoscalersCallable; + private final UnaryCallable + listRegionAutoscalersPagedCallable; + private final UnaryCallable + patchRegionAutoscalerCallable; + private final UnaryCallable + updateRegionAutoscalerCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonRegionAutoscalerStub create(RegionAutoscalerStubSettings settings) + throws IOException { + return new HttpJsonRegionAutoscalerStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonRegionAutoscalerStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonRegionAutoscalerStub( + RegionAutoscalerStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonRegionAutoscalerStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonRegionAutoscalerStub( + RegionAutoscalerStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonRegionAutoscalerStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionAutoscalerStub( + RegionAutoscalerStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonRegionAutoscalerCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonRegionAutoscalerStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionAutoscalerStub( + RegionAutoscalerStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteRegionAutoscalerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRegionAutoscalerMethodDescriptor) + .build(); + HttpJsonCallSettings + getRegionAutoscalerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegionAutoscalerMethodDescriptor) + .build(); + HttpJsonCallSettings + insertRegionAutoscalerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertRegionAutoscalerMethodDescriptor) + .build(); + HttpJsonCallSettings + listRegionAutoscalersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listRegionAutoscalersMethodDescriptor) + .build(); + HttpJsonCallSettings + patchRegionAutoscalerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchRegionAutoscalerMethodDescriptor) + .build(); + HttpJsonCallSettings + updateRegionAutoscalerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateRegionAutoscalerMethodDescriptor) + .build(); + + this.deleteRegionAutoscalerCallable = + callableFactory.createUnaryCallable( + deleteRegionAutoscalerTransportSettings, + settings.deleteRegionAutoscalerSettings(), + clientContext); + this.getRegionAutoscalerCallable = + callableFactory.createUnaryCallable( + getRegionAutoscalerTransportSettings, + settings.getRegionAutoscalerSettings(), + clientContext); + this.insertRegionAutoscalerCallable = + callableFactory.createUnaryCallable( + insertRegionAutoscalerTransportSettings, + settings.insertRegionAutoscalerSettings(), + clientContext); + this.listRegionAutoscalersCallable = + callableFactory.createUnaryCallable( + listRegionAutoscalersTransportSettings, + settings.listRegionAutoscalersSettings(), + clientContext); + this.listRegionAutoscalersPagedCallable = + callableFactory.createPagedCallable( + listRegionAutoscalersTransportSettings, + settings.listRegionAutoscalersSettings(), + clientContext); + this.patchRegionAutoscalerCallable = + callableFactory.createUnaryCallable( + patchRegionAutoscalerTransportSettings, + settings.patchRegionAutoscalerSettings(), + clientContext); + this.updateRegionAutoscalerCallable = + callableFactory.createUnaryCallable( + updateRegionAutoscalerTransportSettings, + settings.updateRegionAutoscalerSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + deleteRegionAutoscalerCallable() { + return deleteRegionAutoscalerCallable; + } + + @BetaApi + public UnaryCallable getRegionAutoscalerCallable() { + return getRegionAutoscalerCallable; + } + + @BetaApi + public UnaryCallable + insertRegionAutoscalerCallable() { + return insertRegionAutoscalerCallable; + } + + @BetaApi + public UnaryCallable + listRegionAutoscalersPagedCallable() { + return listRegionAutoscalersPagedCallable; + } + + @BetaApi + public UnaryCallable + listRegionAutoscalersCallable() { + return listRegionAutoscalersCallable; + } + + @BetaApi + public UnaryCallable + patchRegionAutoscalerCallable() { + return patchRegionAutoscalerCallable; + } + + @BetaApi + public UnaryCallable + updateRegionAutoscalerCallable() { + return updateRegionAutoscalerCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionBackendServiceCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionBackendServiceCallableFactory.java new file mode 100644 index 000000000000..48330cb23652 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionBackendServiceCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonRegionBackendServiceCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionBackendServiceStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionBackendServiceStub.java new file mode 100644 index 000000000000..dda6e4aa0ab3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionBackendServiceStub.java @@ -0,0 +1,429 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionBackendServiceClient.ListRegionBackendServicesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.BackendService; +import com.google.cloud.compute.v1.BackendServiceGroupHealth; +import com.google.cloud.compute.v1.BackendServiceList; +import com.google.cloud.compute.v1.DeleteRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetHealthRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.InsertRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.ListRegionBackendServicesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.ProjectRegionBackendServiceName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.UpdateRegionBackendServiceHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonRegionBackendServiceStub extends RegionBackendServiceStub { + @InternalApi + public static final ApiMethodDescriptor + deleteRegionBackendServiceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionBackendServices.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/backendServices/{backendService}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionBackendServiceName.newFactory()) + .setResourceNameField("backendService") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getRegionBackendServiceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionBackendServices.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/backendServices/{backendService}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionBackendServiceName.newFactory()) + .setResourceNameField("backendService") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(BackendService.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + GetHealthRegionBackendServiceHttpRequest, BackendServiceGroupHealth> + getHealthRegionBackendServiceMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.regionBackendServices.getHealth") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/backendServices/{backendService}/getHealth")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionBackendServiceName.newFactory()) + .setResourceNameField("backendService") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(BackendServiceGroupHealth.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertRegionBackendServiceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionBackendServices.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/backendServices")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listRegionBackendServicesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionBackendServices.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/backendServices")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(BackendServiceList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchRegionBackendServiceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionBackendServices.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/backendServices/{backendService}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionBackendServiceName.newFactory()) + .setResourceNameField("backendService") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateRegionBackendServiceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionBackendServices.update") + .setHttpMethod(HttpMethods.PUT) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/backendServices/{backendService}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionBackendServiceName.newFactory()) + .setResourceNameField("backendService") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteRegionBackendServiceCallable; + private final UnaryCallable + getRegionBackendServiceCallable; + private final UnaryCallable + getHealthRegionBackendServiceCallable; + private final UnaryCallable + insertRegionBackendServiceCallable; + private final UnaryCallable + listRegionBackendServicesCallable; + private final UnaryCallable< + ListRegionBackendServicesHttpRequest, ListRegionBackendServicesPagedResponse> + listRegionBackendServicesPagedCallable; + private final UnaryCallable + patchRegionBackendServiceCallable; + private final UnaryCallable + updateRegionBackendServiceCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonRegionBackendServiceStub create( + RegionBackendServiceStubSettings settings) throws IOException { + return new HttpJsonRegionBackendServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonRegionBackendServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonRegionBackendServiceStub( + RegionBackendServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonRegionBackendServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonRegionBackendServiceStub( + RegionBackendServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonRegionBackendServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionBackendServiceStub( + RegionBackendServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonRegionBackendServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonRegionBackendServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionBackendServiceStub( + RegionBackendServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteRegionBackendServiceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRegionBackendServiceMethodDescriptor) + .build(); + HttpJsonCallSettings + getRegionBackendServiceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegionBackendServiceMethodDescriptor) + .build(); + HttpJsonCallSettings + getHealthRegionBackendServiceTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getHealthRegionBackendServiceMethodDescriptor) + .build(); + HttpJsonCallSettings + insertRegionBackendServiceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertRegionBackendServiceMethodDescriptor) + .build(); + HttpJsonCallSettings + listRegionBackendServicesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listRegionBackendServicesMethodDescriptor) + .build(); + HttpJsonCallSettings + patchRegionBackendServiceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchRegionBackendServiceMethodDescriptor) + .build(); + HttpJsonCallSettings + updateRegionBackendServiceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateRegionBackendServiceMethodDescriptor) + .build(); + + this.deleteRegionBackendServiceCallable = + callableFactory.createUnaryCallable( + deleteRegionBackendServiceTransportSettings, + settings.deleteRegionBackendServiceSettings(), + clientContext); + this.getRegionBackendServiceCallable = + callableFactory.createUnaryCallable( + getRegionBackendServiceTransportSettings, + settings.getRegionBackendServiceSettings(), + clientContext); + this.getHealthRegionBackendServiceCallable = + callableFactory.createUnaryCallable( + getHealthRegionBackendServiceTransportSettings, + settings.getHealthRegionBackendServiceSettings(), + clientContext); + this.insertRegionBackendServiceCallable = + callableFactory.createUnaryCallable( + insertRegionBackendServiceTransportSettings, + settings.insertRegionBackendServiceSettings(), + clientContext); + this.listRegionBackendServicesCallable = + callableFactory.createUnaryCallable( + listRegionBackendServicesTransportSettings, + settings.listRegionBackendServicesSettings(), + clientContext); + this.listRegionBackendServicesPagedCallable = + callableFactory.createPagedCallable( + listRegionBackendServicesTransportSettings, + settings.listRegionBackendServicesSettings(), + clientContext); + this.patchRegionBackendServiceCallable = + callableFactory.createUnaryCallable( + patchRegionBackendServiceTransportSettings, + settings.patchRegionBackendServiceSettings(), + clientContext); + this.updateRegionBackendServiceCallable = + callableFactory.createUnaryCallable( + updateRegionBackendServiceTransportSettings, + settings.updateRegionBackendServiceSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + deleteRegionBackendServiceCallable() { + return deleteRegionBackendServiceCallable; + } + + @BetaApi + public UnaryCallable + getRegionBackendServiceCallable() { + return getRegionBackendServiceCallable; + } + + @BetaApi + public UnaryCallable + getHealthRegionBackendServiceCallable() { + return getHealthRegionBackendServiceCallable; + } + + @BetaApi + public UnaryCallable + insertRegionBackendServiceCallable() { + return insertRegionBackendServiceCallable; + } + + @BetaApi + public UnaryCallable + listRegionBackendServicesPagedCallable() { + return listRegionBackendServicesPagedCallable; + } + + @BetaApi + public UnaryCallable + listRegionBackendServicesCallable() { + return listRegionBackendServicesCallable; + } + + @BetaApi + public UnaryCallable + patchRegionBackendServiceCallable() { + return patchRegionBackendServiceCallable; + } + + @BetaApi + public UnaryCallable + updateRegionBackendServiceCallable() { + return updateRegionBackendServiceCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionCallableFactory.java new file mode 100644 index 000000000000..6c2a461e2d6e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonRegionCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionCommitmentCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionCommitmentCallableFactory.java new file mode 100644 index 000000000000..5654591bd723 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionCommitmentCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonRegionCommitmentCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionCommitmentStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionCommitmentStub.java new file mode 100644 index 000000000000..5dfe80b2b250 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionCommitmentStub.java @@ -0,0 +1,322 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionCommitmentClient.AggregatedListRegionCommitmentsPagedResponse; +import static com.google.cloud.compute.v1.RegionCommitmentClient.ListRegionCommitmentsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListRegionCommitmentsHttpRequest; +import com.google.cloud.compute.v1.Commitment; +import com.google.cloud.compute.v1.CommitmentAggregatedList; +import com.google.cloud.compute.v1.CommitmentList; +import com.google.cloud.compute.v1.GetRegionCommitmentHttpRequest; +import com.google.cloud.compute.v1.InsertRegionCommitmentHttpRequest; +import com.google.cloud.compute.v1.ListRegionCommitmentsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectRegionCommitmentName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonRegionCommitmentStub extends RegionCommitmentStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList> + aggregatedListRegionCommitmentsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.regionCommitments.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/commitments")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(CommitmentAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getRegionCommitmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionCommitments.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/commitments/{commitment}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionCommitmentName.newFactory()) + .setResourceNameField("commitment") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Commitment.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertRegionCommitmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionCommitments.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/commitments")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listRegionCommitmentsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionCommitments.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/commitments")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(CommitmentList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + aggregatedListRegionCommitmentsCallable; + private final UnaryCallable< + AggregatedListRegionCommitmentsHttpRequest, AggregatedListRegionCommitmentsPagedResponse> + aggregatedListRegionCommitmentsPagedCallable; + private final UnaryCallable + getRegionCommitmentCallable; + private final UnaryCallable + insertRegionCommitmentCallable; + private final UnaryCallable + listRegionCommitmentsCallable; + private final UnaryCallable + listRegionCommitmentsPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonRegionCommitmentStub create(RegionCommitmentStubSettings settings) + throws IOException { + return new HttpJsonRegionCommitmentStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonRegionCommitmentStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonRegionCommitmentStub( + RegionCommitmentStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonRegionCommitmentStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonRegionCommitmentStub( + RegionCommitmentStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonRegionCommitmentStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionCommitmentStub( + RegionCommitmentStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonRegionCommitmentCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonRegionCommitmentStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionCommitmentStub( + RegionCommitmentStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListRegionCommitmentsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListRegionCommitmentsMethodDescriptor) + .build(); + HttpJsonCallSettings + getRegionCommitmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegionCommitmentMethodDescriptor) + .build(); + HttpJsonCallSettings + insertRegionCommitmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertRegionCommitmentMethodDescriptor) + .build(); + HttpJsonCallSettings + listRegionCommitmentsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRegionCommitmentsMethodDescriptor) + .build(); + + this.aggregatedListRegionCommitmentsCallable = + callableFactory.createUnaryCallable( + aggregatedListRegionCommitmentsTransportSettings, + settings.aggregatedListRegionCommitmentsSettings(), + clientContext); + this.aggregatedListRegionCommitmentsPagedCallable = + callableFactory.createPagedCallable( + aggregatedListRegionCommitmentsTransportSettings, + settings.aggregatedListRegionCommitmentsSettings(), + clientContext); + this.getRegionCommitmentCallable = + callableFactory.createUnaryCallable( + getRegionCommitmentTransportSettings, + settings.getRegionCommitmentSettings(), + clientContext); + this.insertRegionCommitmentCallable = + callableFactory.createUnaryCallable( + insertRegionCommitmentTransportSettings, + settings.insertRegionCommitmentSettings(), + clientContext); + this.listRegionCommitmentsCallable = + callableFactory.createUnaryCallable( + listRegionCommitmentsTransportSettings, + settings.listRegionCommitmentsSettings(), + clientContext); + this.listRegionCommitmentsPagedCallable = + callableFactory.createPagedCallable( + listRegionCommitmentsTransportSettings, + settings.listRegionCommitmentsSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable< + AggregatedListRegionCommitmentsHttpRequest, AggregatedListRegionCommitmentsPagedResponse> + aggregatedListRegionCommitmentsPagedCallable() { + return aggregatedListRegionCommitmentsPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListRegionCommitmentsCallable() { + return aggregatedListRegionCommitmentsCallable; + } + + @BetaApi + public UnaryCallable getRegionCommitmentCallable() { + return getRegionCommitmentCallable; + } + + @BetaApi + public UnaryCallable + insertRegionCommitmentCallable() { + return insertRegionCommitmentCallable; + } + + @BetaApi + public UnaryCallable + listRegionCommitmentsPagedCallable() { + return listRegionCommitmentsPagedCallable; + } + + @BetaApi + public UnaryCallable + listRegionCommitmentsCallable() { + return listRegionCommitmentsCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskCallableFactory.java new file mode 100644 index 000000000000..ee8812df9c2c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonRegionDiskCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskStub.java new file mode 100644 index 000000000000..da608a53ae8c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskStub.java @@ -0,0 +1,434 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionDiskClient.ListRegionDisksPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.CreateSnapshotRegionDiskHttpRequest; +import com.google.cloud.compute.v1.DeleteRegionDiskHttpRequest; +import com.google.cloud.compute.v1.Disk; +import com.google.cloud.compute.v1.DiskList; +import com.google.cloud.compute.v1.GetRegionDiskHttpRequest; +import com.google.cloud.compute.v1.InsertRegionDiskHttpRequest; +import com.google.cloud.compute.v1.ListRegionDisksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectRegionDiskName; +import com.google.cloud.compute.v1.ProjectRegionDiskResourceName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.ResizeRegionDiskHttpRequest; +import com.google.cloud.compute.v1.SetLabelsRegionDiskHttpRequest; +import com.google.cloud.compute.v1.TestIamPermissionsRegionDiskHttpRequest; +import com.google.cloud.compute.v1.TestPermissionsResponse; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonRegionDiskStub extends RegionDiskStub { + @InternalApi + public static final ApiMethodDescriptor + createSnapshotRegionDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionDisks.createSnapshot") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/disks/{disk}/createSnapshot")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionDiskName.newFactory()) + .setResourceNameField("disk") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteRegionDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionDisks.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/disks/{disk}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionDiskName.newFactory()) + .setResourceNameField("disk") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getRegionDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionDisks.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/disks/{disk}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionDiskName.newFactory()) + .setResourceNameField("disk") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Disk.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertRegionDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionDisks.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions/{region}/disks")) + .setQueryParams(Sets.newHashSet("requestId", "sourceImage")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listRegionDisksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionDisks.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions/{region}/disks")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(DiskList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + resizeRegionDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionDisks.resize") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/disks/{disk}/resize")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionDiskName.newFactory()) + .setResourceNameField("disk") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setLabelsRegionDiskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionDisks.setLabels") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/disks/{resource}/setLabels")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionDiskResourceName.newFactory()) + .setResourceNameField("resource") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + TestIamPermissionsRegionDiskHttpRequest, TestPermissionsResponse> + testIamPermissionsRegionDiskMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.regionDisks.testIamPermissions") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/disks/{resource}/testIamPermissions")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionDiskResourceName.newFactory()) + .setResourceNameField("resource") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TestPermissionsResponse.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + createSnapshotRegionDiskCallable; + private final UnaryCallable deleteRegionDiskCallable; + private final UnaryCallable getRegionDiskCallable; + private final UnaryCallable insertRegionDiskCallable; + private final UnaryCallable listRegionDisksCallable; + private final UnaryCallable + listRegionDisksPagedCallable; + private final UnaryCallable resizeRegionDiskCallable; + private final UnaryCallable + setLabelsRegionDiskCallable; + private final UnaryCallable + testIamPermissionsRegionDiskCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonRegionDiskStub create(RegionDiskStubSettings settings) + throws IOException { + return new HttpJsonRegionDiskStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonRegionDiskStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonRegionDiskStub(RegionDiskStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonRegionDiskStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonRegionDiskStub( + RegionDiskStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonRegionDiskStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonRegionDiskStub(RegionDiskStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonRegionDiskCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonRegionDiskStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonRegionDiskStub( + RegionDiskStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + createSnapshotRegionDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createSnapshotRegionDiskMethodDescriptor) + .build(); + HttpJsonCallSettings deleteRegionDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRegionDiskMethodDescriptor) + .build(); + HttpJsonCallSettings getRegionDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegionDiskMethodDescriptor) + .build(); + HttpJsonCallSettings insertRegionDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertRegionDiskMethodDescriptor) + .build(); + HttpJsonCallSettings listRegionDisksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRegionDisksMethodDescriptor) + .build(); + HttpJsonCallSettings resizeRegionDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(resizeRegionDiskMethodDescriptor) + .build(); + HttpJsonCallSettings + setLabelsRegionDiskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setLabelsRegionDiskMethodDescriptor) + .build(); + HttpJsonCallSettings + testIamPermissionsRegionDiskTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(testIamPermissionsRegionDiskMethodDescriptor) + .build(); + + this.createSnapshotRegionDiskCallable = + callableFactory.createUnaryCallable( + createSnapshotRegionDiskTransportSettings, + settings.createSnapshotRegionDiskSettings(), + clientContext); + this.deleteRegionDiskCallable = + callableFactory.createUnaryCallable( + deleteRegionDiskTransportSettings, settings.deleteRegionDiskSettings(), clientContext); + this.getRegionDiskCallable = + callableFactory.createUnaryCallable( + getRegionDiskTransportSettings, settings.getRegionDiskSettings(), clientContext); + this.insertRegionDiskCallable = + callableFactory.createUnaryCallable( + insertRegionDiskTransportSettings, settings.insertRegionDiskSettings(), clientContext); + this.listRegionDisksCallable = + callableFactory.createUnaryCallable( + listRegionDisksTransportSettings, settings.listRegionDisksSettings(), clientContext); + this.listRegionDisksPagedCallable = + callableFactory.createPagedCallable( + listRegionDisksTransportSettings, settings.listRegionDisksSettings(), clientContext); + this.resizeRegionDiskCallable = + callableFactory.createUnaryCallable( + resizeRegionDiskTransportSettings, settings.resizeRegionDiskSettings(), clientContext); + this.setLabelsRegionDiskCallable = + callableFactory.createUnaryCallable( + setLabelsRegionDiskTransportSettings, + settings.setLabelsRegionDiskSettings(), + clientContext); + this.testIamPermissionsRegionDiskCallable = + callableFactory.createUnaryCallable( + testIamPermissionsRegionDiskTransportSettings, + settings.testIamPermissionsRegionDiskSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + createSnapshotRegionDiskCallable() { + return createSnapshotRegionDiskCallable; + } + + @BetaApi + public UnaryCallable deleteRegionDiskCallable() { + return deleteRegionDiskCallable; + } + + @BetaApi + public UnaryCallable getRegionDiskCallable() { + return getRegionDiskCallable; + } + + @BetaApi + public UnaryCallable insertRegionDiskCallable() { + return insertRegionDiskCallable; + } + + @BetaApi + public UnaryCallable + listRegionDisksPagedCallable() { + return listRegionDisksPagedCallable; + } + + @BetaApi + public UnaryCallable listRegionDisksCallable() { + return listRegionDisksCallable; + } + + @BetaApi + public UnaryCallable resizeRegionDiskCallable() { + return resizeRegionDiskCallable; + } + + @BetaApi + public UnaryCallable setLabelsRegionDiskCallable() { + return setLabelsRegionDiskCallable; + } + + @BetaApi + public UnaryCallable + testIamPermissionsRegionDiskCallable() { + return testIamPermissionsRegionDiskCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskTypeCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskTypeCallableFactory.java new file mode 100644 index 000000000000..c6e1622f287e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskTypeCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonRegionDiskTypeCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskTypeStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskTypeStub.java new file mode 100644 index 000000000000..ea333312e0fa --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskTypeStub.java @@ -0,0 +1,218 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionDiskTypeClient.ListRegionDiskTypesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DiskType; +import com.google.cloud.compute.v1.GetRegionDiskTypeHttpRequest; +import com.google.cloud.compute.v1.ListRegionDiskTypesHttpRequest; +import com.google.cloud.compute.v1.ProjectRegionDiskTypeName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.RegionDiskTypeList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonRegionDiskTypeStub extends RegionDiskTypeStub { + @InternalApi + public static final ApiMethodDescriptor + getRegionDiskTypeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionDiskTypes.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/diskTypes/{diskType}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionDiskTypeName.newFactory()) + .setResourceNameField("diskType") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(DiskType.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listRegionDiskTypesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionDiskTypes.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions/{region}/diskTypes")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(RegionDiskTypeList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable getRegionDiskTypeCallable; + private final UnaryCallable + listRegionDiskTypesCallable; + private final UnaryCallable + listRegionDiskTypesPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonRegionDiskTypeStub create(RegionDiskTypeStubSettings settings) + throws IOException { + return new HttpJsonRegionDiskTypeStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonRegionDiskTypeStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonRegionDiskTypeStub( + RegionDiskTypeStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonRegionDiskTypeStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonRegionDiskTypeStub( + RegionDiskTypeStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonRegionDiskTypeStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionDiskTypeStub( + RegionDiskTypeStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonRegionDiskTypeCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonRegionDiskTypeStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionDiskTypeStub( + RegionDiskTypeStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + getRegionDiskTypeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegionDiskTypeMethodDescriptor) + .build(); + HttpJsonCallSettings + listRegionDiskTypesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRegionDiskTypesMethodDescriptor) + .build(); + + this.getRegionDiskTypeCallable = + callableFactory.createUnaryCallable( + getRegionDiskTypeTransportSettings, + settings.getRegionDiskTypeSettings(), + clientContext); + this.listRegionDiskTypesCallable = + callableFactory.createUnaryCallable( + listRegionDiskTypesTransportSettings, + settings.listRegionDiskTypesSettings(), + clientContext); + this.listRegionDiskTypesPagedCallable = + callableFactory.createPagedCallable( + listRegionDiskTypesTransportSettings, + settings.listRegionDiskTypesSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable getRegionDiskTypeCallable() { + return getRegionDiskTypeCallable; + } + + @BetaApi + public UnaryCallable + listRegionDiskTypesPagedCallable() { + return listRegionDiskTypesPagedCallable; + } + + @BetaApi + public UnaryCallable + listRegionDiskTypesCallable() { + return listRegionDiskTypesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupCallableFactory.java new file mode 100644 index 000000000000..6bc9048c077d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonRegionInstanceGroupCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupManagerCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupManagerCallableFactory.java new file mode 100644 index 000000000000..adec8f036bd9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupManagerCallableFactory.java @@ -0,0 +1,66 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonRegionInstanceGroupManagerCallableFactory + implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupManagerStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupManagerStub.java new file mode 100644 index 000000000000..cb4fbae5818d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupManagerStub.java @@ -0,0 +1,644 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionInstanceGroupManagerClient.ListRegionInstanceGroupManagersPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AbandonInstancesRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.DeleteInstancesRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.DeleteRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.GetRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InsertRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InstanceGroupManager; +import com.google.cloud.compute.v1.ListManagedInstancesRegionInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.ListRegionInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectRegionInstanceGroupManagerName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.RecreateInstancesRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.RegionInstanceGroupManagerList; +import com.google.cloud.compute.v1.RegionInstanceGroupManagersListInstancesResponse; +import com.google.cloud.compute.v1.ResizeRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetInstanceTemplateRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetTargetPoolsRegionInstanceGroupManagerHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonRegionInstanceGroupManagerStub extends RegionInstanceGroupManagerStub { + @InternalApi + public static final ApiMethodDescriptor< + AbandonInstancesRegionInstanceGroupManagerHttpRequest, Operation> + abandonInstancesRegionInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.regionInstanceGroupManagers.abandonInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/abandonInstances")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteRegionInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionInstanceGroupManagers.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + DeleteInstancesRegionInstanceGroupManagerHttpRequest, Operation> + deleteInstancesRegionInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.regionInstanceGroupManagers.deleteInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/deleteInstances")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + GetRegionInstanceGroupManagerHttpRequest, InstanceGroupManager> + getRegionInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.regionInstanceGroupManagers.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceGroupManager.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertRegionInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionInstanceGroupManagers.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/instanceGroupManagers")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList> + listRegionInstanceGroupManagersMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("compute.regionInstanceGroupManagers.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/instanceGroupManagers")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(RegionInstanceGroupManagerList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("compute.regionInstanceGroupManagers.listManagedInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/listManagedInstances")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "order_by", "pageToken")) + .setResourceNameFactory(ProjectRegionInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser + .newBuilder() + .setResponseInstance( + RegionInstanceGroupManagersListInstancesResponse.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + RecreateInstancesRegionInstanceGroupManagerHttpRequest, Operation> + recreateInstancesRegionInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.regionInstanceGroupManagers.recreateInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/recreateInstances")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + resizeRegionInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionInstanceGroupManagers.resize") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/resize")) + .setQueryParams(Sets.newHashSet("requestId", "size")) + .setResourceNameFactory(ProjectRegionInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest, Operation> + setInstanceTemplateRegionInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.regionInstanceGroupManagers.setInstanceTemplate") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/setInstanceTemplate")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + SetTargetPoolsRegionInstanceGroupManagerHttpRequest, Operation> + setTargetPoolsRegionInstanceGroupManagerMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.regionInstanceGroupManagers.setTargetPools") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}/setTargetPools")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionInstanceGroupManagerName.newFactory()) + .setResourceNameField("instanceGroupManager") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + abandonInstancesRegionInstanceGroupManagerCallable; + private final UnaryCallable + deleteRegionInstanceGroupManagerCallable; + private final UnaryCallable + deleteInstancesRegionInstanceGroupManagerCallable; + private final UnaryCallable + getRegionInstanceGroupManagerCallable; + private final UnaryCallable + insertRegionInstanceGroupManagerCallable; + private final UnaryCallable< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList> + listRegionInstanceGroupManagersCallable; + private final UnaryCallable< + ListRegionInstanceGroupManagersHttpRequest, ListRegionInstanceGroupManagersPagedResponse> + listRegionInstanceGroupManagersPagedCallable; + private final UnaryCallable< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersCallable; + private final UnaryCallable + recreateInstancesRegionInstanceGroupManagerCallable; + private final UnaryCallable + resizeRegionInstanceGroupManagerCallable; + private final UnaryCallable + setInstanceTemplateRegionInstanceGroupManagerCallable; + private final UnaryCallable + setTargetPoolsRegionInstanceGroupManagerCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonRegionInstanceGroupManagerStub create( + RegionInstanceGroupManagerStubSettings settings) throws IOException { + return new HttpJsonRegionInstanceGroupManagerStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonRegionInstanceGroupManagerStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonRegionInstanceGroupManagerStub( + RegionInstanceGroupManagerStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonRegionInstanceGroupManagerStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonRegionInstanceGroupManagerStub( + RegionInstanceGroupManagerStubSettings.newBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonRegionInstanceGroupManagerStub, using the given settings. + * This is protected so that it is easy to make a subclass, but otherwise, the static factory + * methods should be preferred. + */ + protected HttpJsonRegionInstanceGroupManagerStub( + RegionInstanceGroupManagerStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonRegionInstanceGroupManagerCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonRegionInstanceGroupManagerStub, using the given settings. + * This is protected so that it is easy to make a subclass, but otherwise, the static factory + * methods should be preferred. + */ + protected HttpJsonRegionInstanceGroupManagerStub( + RegionInstanceGroupManagerStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + abandonInstancesRegionInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(abandonInstancesRegionInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteRegionInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(deleteRegionInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteInstancesRegionInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(deleteInstancesRegionInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + getRegionInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getRegionInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + insertRegionInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(insertRegionInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + listRegionInstanceGroupManagersTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listRegionInstanceGroupManagersMethodDescriptor) + .build(); + HttpJsonCallSettings< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor( + listManagedInstancesRegionInstanceGroupManagersMethodDescriptor) + .build(); + HttpJsonCallSettings + recreateInstancesRegionInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(recreateInstancesRegionInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + resizeRegionInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(resizeRegionInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + setInstanceTemplateRegionInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(setInstanceTemplateRegionInstanceGroupManagerMethodDescriptor) + .build(); + HttpJsonCallSettings + setTargetPoolsRegionInstanceGroupManagerTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(setTargetPoolsRegionInstanceGroupManagerMethodDescriptor) + .build(); + + this.abandonInstancesRegionInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + abandonInstancesRegionInstanceGroupManagerTransportSettings, + settings.abandonInstancesRegionInstanceGroupManagerSettings(), + clientContext); + this.deleteRegionInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + deleteRegionInstanceGroupManagerTransportSettings, + settings.deleteRegionInstanceGroupManagerSettings(), + clientContext); + this.deleteInstancesRegionInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + deleteInstancesRegionInstanceGroupManagerTransportSettings, + settings.deleteInstancesRegionInstanceGroupManagerSettings(), + clientContext); + this.getRegionInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + getRegionInstanceGroupManagerTransportSettings, + settings.getRegionInstanceGroupManagerSettings(), + clientContext); + this.insertRegionInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + insertRegionInstanceGroupManagerTransportSettings, + settings.insertRegionInstanceGroupManagerSettings(), + clientContext); + this.listRegionInstanceGroupManagersCallable = + callableFactory.createUnaryCallable( + listRegionInstanceGroupManagersTransportSettings, + settings.listRegionInstanceGroupManagersSettings(), + clientContext); + this.listRegionInstanceGroupManagersPagedCallable = + callableFactory.createPagedCallable( + listRegionInstanceGroupManagersTransportSettings, + settings.listRegionInstanceGroupManagersSettings(), + clientContext); + this.listManagedInstancesRegionInstanceGroupManagersCallable = + callableFactory.createUnaryCallable( + listManagedInstancesRegionInstanceGroupManagersTransportSettings, + settings.listManagedInstancesRegionInstanceGroupManagersSettings(), + clientContext); + this.recreateInstancesRegionInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + recreateInstancesRegionInstanceGroupManagerTransportSettings, + settings.recreateInstancesRegionInstanceGroupManagerSettings(), + clientContext); + this.resizeRegionInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + resizeRegionInstanceGroupManagerTransportSettings, + settings.resizeRegionInstanceGroupManagerSettings(), + clientContext); + this.setInstanceTemplateRegionInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + setInstanceTemplateRegionInstanceGroupManagerTransportSettings, + settings.setInstanceTemplateRegionInstanceGroupManagerSettings(), + clientContext); + this.setTargetPoolsRegionInstanceGroupManagerCallable = + callableFactory.createUnaryCallable( + setTargetPoolsRegionInstanceGroupManagerTransportSettings, + settings.setTargetPoolsRegionInstanceGroupManagerSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + abandonInstancesRegionInstanceGroupManagerCallable() { + return abandonInstancesRegionInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + deleteRegionInstanceGroupManagerCallable() { + return deleteRegionInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + deleteInstancesRegionInstanceGroupManagerCallable() { + return deleteInstancesRegionInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + getRegionInstanceGroupManagerCallable() { + return getRegionInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + insertRegionInstanceGroupManagerCallable() { + return insertRegionInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable< + ListRegionInstanceGroupManagersHttpRequest, ListRegionInstanceGroupManagersPagedResponse> + listRegionInstanceGroupManagersPagedCallable() { + return listRegionInstanceGroupManagersPagedCallable; + } + + @BetaApi + public UnaryCallable + listRegionInstanceGroupManagersCallable() { + return listRegionInstanceGroupManagersCallable; + } + + @BetaApi + public UnaryCallable< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersCallable() { + return listManagedInstancesRegionInstanceGroupManagersCallable; + } + + @BetaApi + public UnaryCallable + recreateInstancesRegionInstanceGroupManagerCallable() { + return recreateInstancesRegionInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + resizeRegionInstanceGroupManagerCallable() { + return resizeRegionInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + setInstanceTemplateRegionInstanceGroupManagerCallable() { + return setInstanceTemplateRegionInstanceGroupManagerCallable; + } + + @BetaApi + public UnaryCallable + setTargetPoolsRegionInstanceGroupManagerCallable() { + return setTargetPoolsRegionInstanceGroupManagerCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupStub.java new file mode 100644 index 000000000000..a3449b0d5f30 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionInstanceGroupStub.java @@ -0,0 +1,338 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionInstanceGroupClient.ListInstancesRegionInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.RegionInstanceGroupClient.ListRegionInstanceGroupsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.GetRegionInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.InstanceGroup; +import com.google.cloud.compute.v1.ListInstancesRegionInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.ListRegionInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectRegionInstanceGroupName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.RegionInstanceGroupList; +import com.google.cloud.compute.v1.RegionInstanceGroupsListInstances; +import com.google.cloud.compute.v1.SetNamedPortsRegionInstanceGroupHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonRegionInstanceGroupStub extends RegionInstanceGroupStub { + @InternalApi + public static final ApiMethodDescriptor + getRegionInstanceGroupMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionInstanceGroups.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroups/{instanceGroup}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionInstanceGroupName.newFactory()) + .setResourceNameField("instanceGroup") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(InstanceGroup.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList> + listRegionInstanceGroupsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.regionInstanceGroups.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/instanceGroups")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(RegionInstanceGroupList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances> + listInstancesRegionInstanceGroupsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("compute.regionInstanceGroups.listInstances") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroups/{instanceGroup}/listInstances")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionInstanceGroupName.newFactory()) + .setResourceNameField("instanceGroup") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(RegionInstanceGroupsListInstances.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setNamedPortsRegionInstanceGroupMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionInstanceGroups.setNamedPorts") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/instanceGroups/{instanceGroup}/setNamedPorts")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionInstanceGroupName.newFactory()) + .setResourceNameField("instanceGroup") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + getRegionInstanceGroupCallable; + private final UnaryCallable + listRegionInstanceGroupsCallable; + private final UnaryCallable< + ListRegionInstanceGroupsHttpRequest, ListRegionInstanceGroupsPagedResponse> + listRegionInstanceGroupsPagedCallable; + private final UnaryCallable< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances> + listInstancesRegionInstanceGroupsCallable; + private final UnaryCallable< + ListInstancesRegionInstanceGroupsHttpRequest, + ListInstancesRegionInstanceGroupsPagedResponse> + listInstancesRegionInstanceGroupsPagedCallable; + private final UnaryCallable + setNamedPortsRegionInstanceGroupCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonRegionInstanceGroupStub create( + RegionInstanceGroupStubSettings settings) throws IOException { + return new HttpJsonRegionInstanceGroupStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonRegionInstanceGroupStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonRegionInstanceGroupStub( + RegionInstanceGroupStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonRegionInstanceGroupStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonRegionInstanceGroupStub( + RegionInstanceGroupStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonRegionInstanceGroupStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionInstanceGroupStub( + RegionInstanceGroupStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonRegionInstanceGroupCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonRegionInstanceGroupStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionInstanceGroupStub( + RegionInstanceGroupStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + getRegionInstanceGroupTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegionInstanceGroupMethodDescriptor) + .build(); + HttpJsonCallSettings + listRegionInstanceGroupsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listRegionInstanceGroupsMethodDescriptor) + .build(); + HttpJsonCallSettings< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances> + listInstancesRegionInstanceGroupsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listInstancesRegionInstanceGroupsMethodDescriptor) + .build(); + HttpJsonCallSettings + setNamedPortsRegionInstanceGroupTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(setNamedPortsRegionInstanceGroupMethodDescriptor) + .build(); + + this.getRegionInstanceGroupCallable = + callableFactory.createUnaryCallable( + getRegionInstanceGroupTransportSettings, + settings.getRegionInstanceGroupSettings(), + clientContext); + this.listRegionInstanceGroupsCallable = + callableFactory.createUnaryCallable( + listRegionInstanceGroupsTransportSettings, + settings.listRegionInstanceGroupsSettings(), + clientContext); + this.listRegionInstanceGroupsPagedCallable = + callableFactory.createPagedCallable( + listRegionInstanceGroupsTransportSettings, + settings.listRegionInstanceGroupsSettings(), + clientContext); + this.listInstancesRegionInstanceGroupsCallable = + callableFactory.createUnaryCallable( + listInstancesRegionInstanceGroupsTransportSettings, + settings.listInstancesRegionInstanceGroupsSettings(), + clientContext); + this.listInstancesRegionInstanceGroupsPagedCallable = + callableFactory.createPagedCallable( + listInstancesRegionInstanceGroupsTransportSettings, + settings.listInstancesRegionInstanceGroupsSettings(), + clientContext); + this.setNamedPortsRegionInstanceGroupCallable = + callableFactory.createUnaryCallable( + setNamedPortsRegionInstanceGroupTransportSettings, + settings.setNamedPortsRegionInstanceGroupSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + getRegionInstanceGroupCallable() { + return getRegionInstanceGroupCallable; + } + + @BetaApi + public UnaryCallable + listRegionInstanceGroupsPagedCallable() { + return listRegionInstanceGroupsPagedCallable; + } + + @BetaApi + public UnaryCallable + listRegionInstanceGroupsCallable() { + return listRegionInstanceGroupsCallable; + } + + @BetaApi + public UnaryCallable< + ListInstancesRegionInstanceGroupsHttpRequest, + ListInstancesRegionInstanceGroupsPagedResponse> + listInstancesRegionInstanceGroupsPagedCallable() { + return listInstancesRegionInstanceGroupsPagedCallable; + } + + @BetaApi + public UnaryCallable< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances> + listInstancesRegionInstanceGroupsCallable() { + return listInstancesRegionInstanceGroupsCallable; + } + + @BetaApi + public UnaryCallable + setNamedPortsRegionInstanceGroupCallable() { + return setNamedPortsRegionInstanceGroupCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionOperationCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionOperationCallableFactory.java new file mode 100644 index 000000000000..4d229d0d4f04 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionOperationCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonRegionOperationCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionOperationStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionOperationStub.java new file mode 100644 index 000000000000..b29c529b77b9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionOperationStub.java @@ -0,0 +1,251 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionOperationClient.ListRegionOperationsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteRegionOperationHttpRequest; +import com.google.cloud.compute.v1.GetRegionOperationHttpRequest; +import com.google.cloud.compute.v1.ListRegionOperationsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.OperationList; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.ProjectRegionOperationName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonRegionOperationStub extends RegionOperationStub { + @InternalApi + public static final ApiMethodDescriptor + deleteRegionOperationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionOperations.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/operations/{operation}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionOperationName.newFactory()) + .setResourceNameField("operation") + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getRegionOperationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionOperations.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/operations/{operation}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionOperationName.newFactory()) + .setResourceNameField("operation") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listRegionOperationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regionOperations.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions/{region}/operations")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(OperationList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable deleteRegionOperationCallable; + private final UnaryCallable getRegionOperationCallable; + private final UnaryCallable + listRegionOperationsCallable; + private final UnaryCallable + listRegionOperationsPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonRegionOperationStub create(RegionOperationStubSettings settings) + throws IOException { + return new HttpJsonRegionOperationStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonRegionOperationStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonRegionOperationStub( + RegionOperationStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonRegionOperationStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonRegionOperationStub( + RegionOperationStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonRegionOperationStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionOperationStub( + RegionOperationStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonRegionOperationCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonRegionOperationStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonRegionOperationStub( + RegionOperationStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteRegionOperationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRegionOperationMethodDescriptor) + .build(); + HttpJsonCallSettings + getRegionOperationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegionOperationMethodDescriptor) + .build(); + HttpJsonCallSettings + listRegionOperationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRegionOperationsMethodDescriptor) + .build(); + + this.deleteRegionOperationCallable = + callableFactory.createUnaryCallable( + deleteRegionOperationTransportSettings, + settings.deleteRegionOperationSettings(), + clientContext); + this.getRegionOperationCallable = + callableFactory.createUnaryCallable( + getRegionOperationTransportSettings, + settings.getRegionOperationSettings(), + clientContext); + this.listRegionOperationsCallable = + callableFactory.createUnaryCallable( + listRegionOperationsTransportSettings, + settings.listRegionOperationsSettings(), + clientContext); + this.listRegionOperationsPagedCallable = + callableFactory.createPagedCallable( + listRegionOperationsTransportSettings, + settings.listRegionOperationsSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteRegionOperationCallable() { + return deleteRegionOperationCallable; + } + + @BetaApi + public UnaryCallable getRegionOperationCallable() { + return getRegionOperationCallable; + } + + @BetaApi + public UnaryCallable + listRegionOperationsPagedCallable() { + return listRegionOperationsPagedCallable; + } + + @BetaApi + public UnaryCallable + listRegionOperationsCallable() { + return listRegionOperationsCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionStub.java new file mode 100644 index 000000000000..873fb2367dac --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionStub.java @@ -0,0 +1,203 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionClient.ListRegionsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.GetRegionHttpRequest; +import com.google.cloud.compute.v1.ListRegionsHttpRequest; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.Region; +import com.google.cloud.compute.v1.RegionList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonRegionStub extends RegionStub { + @InternalApi + public static final ApiMethodDescriptor getRegionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regions.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions/{region}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Region.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listRegionsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.regions.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(RegionList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable getRegionCallable; + private final UnaryCallable listRegionsCallable; + private final UnaryCallable + listRegionsPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonRegionStub create(RegionStubSettings settings) throws IOException { + return new HttpJsonRegionStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonRegionStub create(ClientContext clientContext) throws IOException { + return new HttpJsonRegionStub(RegionStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonRegionStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonRegionStub( + RegionStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonRegionStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonRegionStub(RegionStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonRegionCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonRegionStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonRegionStub( + RegionStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings getRegionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegionMethodDescriptor) + .build(); + HttpJsonCallSettings listRegionsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRegionsMethodDescriptor) + .build(); + + this.getRegionCallable = + callableFactory.createUnaryCallable( + getRegionTransportSettings, settings.getRegionSettings(), clientContext); + this.listRegionsCallable = + callableFactory.createUnaryCallable( + listRegionsTransportSettings, settings.listRegionsSettings(), clientContext); + this.listRegionsPagedCallable = + callableFactory.createPagedCallable( + listRegionsTransportSettings, settings.listRegionsSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable getRegionCallable() { + return getRegionCallable; + } + + @BetaApi + public UnaryCallable + listRegionsPagedCallable() { + return listRegionsPagedCallable; + } + + @BetaApi + public UnaryCallable listRegionsCallable() { + return listRegionsCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouteCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouteCallableFactory.java new file mode 100644 index 000000000000..5f56c2801b66 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouteCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonRouteCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouteStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouteStub.java new file mode 100644 index 000000000000..1e148d400c27 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouteStub.java @@ -0,0 +1,269 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RouteClient.ListRoutesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteRouteHttpRequest; +import com.google.cloud.compute.v1.GetRouteHttpRequest; +import com.google.cloud.compute.v1.InsertRouteHttpRequest; +import com.google.cloud.compute.v1.ListRoutesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalRouteName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.Route; +import com.google.cloud.compute.v1.RouteList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonRouteStub extends RouteStub { + @InternalApi + public static final ApiMethodDescriptor + deleteRouteMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routes.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/routes/{route}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalRouteName.newFactory()) + .setResourceNameField("route") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor getRouteMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routes.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/routes/{route}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalRouteName.newFactory()) + .setResourceNameField("route") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Route.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertRouteMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routes.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/routes")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listRoutesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routes.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/routes")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(RouteList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable deleteRouteCallable; + private final UnaryCallable getRouteCallable; + private final UnaryCallable insertRouteCallable; + private final UnaryCallable listRoutesCallable; + private final UnaryCallable + listRoutesPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonRouteStub create(RouteStubSettings settings) throws IOException { + return new HttpJsonRouteStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonRouteStub create(ClientContext clientContext) throws IOException { + return new HttpJsonRouteStub(RouteStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonRouteStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonRouteStub( + RouteStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonRouteStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonRouteStub(RouteStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonRouteCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonRouteStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonRouteStub( + RouteStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings deleteRouteTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRouteMethodDescriptor) + .build(); + HttpJsonCallSettings getRouteTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRouteMethodDescriptor) + .build(); + HttpJsonCallSettings insertRouteTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertRouteMethodDescriptor) + .build(); + HttpJsonCallSettings listRoutesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRoutesMethodDescriptor) + .build(); + + this.deleteRouteCallable = + callableFactory.createUnaryCallable( + deleteRouteTransportSettings, settings.deleteRouteSettings(), clientContext); + this.getRouteCallable = + callableFactory.createUnaryCallable( + getRouteTransportSettings, settings.getRouteSettings(), clientContext); + this.insertRouteCallable = + callableFactory.createUnaryCallable( + insertRouteTransportSettings, settings.insertRouteSettings(), clientContext); + this.listRoutesCallable = + callableFactory.createUnaryCallable( + listRoutesTransportSettings, settings.listRoutesSettings(), clientContext); + this.listRoutesPagedCallable = + callableFactory.createPagedCallable( + listRoutesTransportSettings, settings.listRoutesSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteRouteCallable() { + return deleteRouteCallable; + } + + @BetaApi + public UnaryCallable getRouteCallable() { + return getRouteCallable; + } + + @BetaApi + public UnaryCallable insertRouteCallable() { + return insertRouteCallable; + } + + @BetaApi + public UnaryCallable listRoutesPagedCallable() { + return listRoutesPagedCallable; + } + + @BetaApi + public UnaryCallable listRoutesCallable() { + return listRoutesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouterCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouterCallableFactory.java new file mode 100644 index 000000000000..003c575887c0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouterCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonRouterCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouterStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouterStub.java new file mode 100644 index 000000000000..f47074367384 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRouterStub.java @@ -0,0 +1,476 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RouterClient.AggregatedListRoutersPagedResponse; +import static com.google.cloud.compute.v1.RouterClient.ListRoutersPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListRoutersHttpRequest; +import com.google.cloud.compute.v1.DeleteRouterHttpRequest; +import com.google.cloud.compute.v1.GetRouterHttpRequest; +import com.google.cloud.compute.v1.GetRouterStatusRouterHttpRequest; +import com.google.cloud.compute.v1.InsertRouterHttpRequest; +import com.google.cloud.compute.v1.ListRoutersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchRouterHttpRequest; +import com.google.cloud.compute.v1.PreviewRouterHttpRequest; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.ProjectRegionRouterName; +import com.google.cloud.compute.v1.Router; +import com.google.cloud.compute.v1.RouterAggregatedList; +import com.google.cloud.compute.v1.RouterList; +import com.google.cloud.compute.v1.RouterStatusResponse; +import com.google.cloud.compute.v1.RoutersPreviewResponse; +import com.google.cloud.compute.v1.UpdateRouterHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonRouterStub extends RouterStub { + @InternalApi + public static final ApiMethodDescriptor + aggregatedListRoutersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routers.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/routers")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(RouterAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteRouterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routers.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/routers/{router}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionRouterName.newFactory()) + .setResourceNameField("router") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor getRouterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routers.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/routers/{router}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionRouterName.newFactory()) + .setResourceNameField("router") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Router.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getRouterStatusRouterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routers.getRouterStatus") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/routers/{router}/getRouterStatus")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionRouterName.newFactory()) + .setResourceNameField("router") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(RouterStatusResponse.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertRouterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routers.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions/{region}/routers")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listRoutersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routers.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions/{region}/routers")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(RouterList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchRouterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routers.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/routers/{router}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionRouterName.newFactory()) + .setResourceNameField("router") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + previewRouterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routers.preview") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/routers/{router}/preview")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionRouterName.newFactory()) + .setResourceNameField("router") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(RoutersPreviewResponse.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateRouterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.routers.update") + .setHttpMethod(HttpMethods.PUT) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/routers/{router}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionRouterName.newFactory()) + .setResourceNameField("router") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + aggregatedListRoutersCallable; + private final UnaryCallable + aggregatedListRoutersPagedCallable; + private final UnaryCallable deleteRouterCallable; + private final UnaryCallable getRouterCallable; + private final UnaryCallable + getRouterStatusRouterCallable; + private final UnaryCallable insertRouterCallable; + private final UnaryCallable listRoutersCallable; + private final UnaryCallable + listRoutersPagedCallable; + private final UnaryCallable patchRouterCallable; + private final UnaryCallable + previewRouterCallable; + private final UnaryCallable updateRouterCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonRouterStub create(RouterStubSettings settings) throws IOException { + return new HttpJsonRouterStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonRouterStub create(ClientContext clientContext) throws IOException { + return new HttpJsonRouterStub(RouterStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonRouterStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonRouterStub( + RouterStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonRouterStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonRouterStub(RouterStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonRouterCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonRouterStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonRouterStub( + RouterStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListRoutersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListRoutersMethodDescriptor) + .build(); + HttpJsonCallSettings deleteRouterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRouterMethodDescriptor) + .build(); + HttpJsonCallSettings getRouterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRouterMethodDescriptor) + .build(); + HttpJsonCallSettings + getRouterStatusRouterTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getRouterStatusRouterMethodDescriptor) + .build(); + HttpJsonCallSettings insertRouterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertRouterMethodDescriptor) + .build(); + HttpJsonCallSettings listRoutersTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRoutersMethodDescriptor) + .build(); + HttpJsonCallSettings patchRouterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchRouterMethodDescriptor) + .build(); + HttpJsonCallSettings + previewRouterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(previewRouterMethodDescriptor) + .build(); + HttpJsonCallSettings updateRouterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateRouterMethodDescriptor) + .build(); + + this.aggregatedListRoutersCallable = + callableFactory.createUnaryCallable( + aggregatedListRoutersTransportSettings, + settings.aggregatedListRoutersSettings(), + clientContext); + this.aggregatedListRoutersPagedCallable = + callableFactory.createPagedCallable( + aggregatedListRoutersTransportSettings, + settings.aggregatedListRoutersSettings(), + clientContext); + this.deleteRouterCallable = + callableFactory.createUnaryCallable( + deleteRouterTransportSettings, settings.deleteRouterSettings(), clientContext); + this.getRouterCallable = + callableFactory.createUnaryCallable( + getRouterTransportSettings, settings.getRouterSettings(), clientContext); + this.getRouterStatusRouterCallable = + callableFactory.createUnaryCallable( + getRouterStatusRouterTransportSettings, + settings.getRouterStatusRouterSettings(), + clientContext); + this.insertRouterCallable = + callableFactory.createUnaryCallable( + insertRouterTransportSettings, settings.insertRouterSettings(), clientContext); + this.listRoutersCallable = + callableFactory.createUnaryCallable( + listRoutersTransportSettings, settings.listRoutersSettings(), clientContext); + this.listRoutersPagedCallable = + callableFactory.createPagedCallable( + listRoutersTransportSettings, settings.listRoutersSettings(), clientContext); + this.patchRouterCallable = + callableFactory.createUnaryCallable( + patchRouterTransportSettings, settings.patchRouterSettings(), clientContext); + this.previewRouterCallable = + callableFactory.createUnaryCallable( + previewRouterTransportSettings, settings.previewRouterSettings(), clientContext); + this.updateRouterCallable = + callableFactory.createUnaryCallable( + updateRouterTransportSettings, settings.updateRouterSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + aggregatedListRoutersPagedCallable() { + return aggregatedListRoutersPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListRoutersCallable() { + return aggregatedListRoutersCallable; + } + + @BetaApi + public UnaryCallable deleteRouterCallable() { + return deleteRouterCallable; + } + + @BetaApi + public UnaryCallable getRouterCallable() { + return getRouterCallable; + } + + @BetaApi + public UnaryCallable + getRouterStatusRouterCallable() { + return getRouterStatusRouterCallable; + } + + @BetaApi + public UnaryCallable insertRouterCallable() { + return insertRouterCallable; + } + + @BetaApi + public UnaryCallable + listRoutersPagedCallable() { + return listRoutersPagedCallable; + } + + @BetaApi + public UnaryCallable listRoutersCallable() { + return listRoutersCallable; + } + + @BetaApi + public UnaryCallable patchRouterCallable() { + return patchRouterCallable; + } + + @BetaApi + public UnaryCallable previewRouterCallable() { + return previewRouterCallable; + } + + @BetaApi + public UnaryCallable updateRouterCallable() { + return updateRouterCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSnapshotCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSnapshotCallableFactory.java new file mode 100644 index 000000000000..c1390a782351 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSnapshotCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonSnapshotCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSnapshotStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSnapshotStub.java new file mode 100644 index 000000000000..5cc1d823aa4c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSnapshotStub.java @@ -0,0 +1,277 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SnapshotClient.ListSnapshotsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteSnapshotHttpRequest; +import com.google.cloud.compute.v1.GetSnapshotHttpRequest; +import com.google.cloud.compute.v1.ListSnapshotsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalSnapshotName; +import com.google.cloud.compute.v1.ProjectGlobalSnapshotResourceName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.SetLabelsSnapshotHttpRequest; +import com.google.cloud.compute.v1.Snapshot; +import com.google.cloud.compute.v1.SnapshotList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonSnapshotStub extends SnapshotStub { + @InternalApi + public static final ApiMethodDescriptor + deleteSnapshotMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.snapshots.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/snapshots/{snapshot}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalSnapshotName.newFactory()) + .setResourceNameField("snapshot") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getSnapshotMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.snapshots.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/snapshots/{snapshot}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalSnapshotName.newFactory()) + .setResourceNameField("snapshot") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Snapshot.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listSnapshotsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.snapshots.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/snapshots")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(SnapshotList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setLabelsSnapshotMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.snapshots.setLabels") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/snapshots/{resource}/setLabels")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalSnapshotResourceName.newFactory()) + .setResourceNameField("resource") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable deleteSnapshotCallable; + private final UnaryCallable getSnapshotCallable; + private final UnaryCallable listSnapshotsCallable; + private final UnaryCallable + listSnapshotsPagedCallable; + private final UnaryCallable setLabelsSnapshotCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonSnapshotStub create(SnapshotStubSettings settings) + throws IOException { + return new HttpJsonSnapshotStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonSnapshotStub create(ClientContext clientContext) throws IOException { + return new HttpJsonSnapshotStub(SnapshotStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonSnapshotStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonSnapshotStub( + SnapshotStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonSnapshotStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSnapshotStub(SnapshotStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonSnapshotCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonSnapshotStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSnapshotStub( + SnapshotStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings deleteSnapshotTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteSnapshotMethodDescriptor) + .build(); + HttpJsonCallSettings getSnapshotTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getSnapshotMethodDescriptor) + .build(); + HttpJsonCallSettings listSnapshotsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listSnapshotsMethodDescriptor) + .build(); + HttpJsonCallSettings + setLabelsSnapshotTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setLabelsSnapshotMethodDescriptor) + .build(); + + this.deleteSnapshotCallable = + callableFactory.createUnaryCallable( + deleteSnapshotTransportSettings, settings.deleteSnapshotSettings(), clientContext); + this.getSnapshotCallable = + callableFactory.createUnaryCallable( + getSnapshotTransportSettings, settings.getSnapshotSettings(), clientContext); + this.listSnapshotsCallable = + callableFactory.createUnaryCallable( + listSnapshotsTransportSettings, settings.listSnapshotsSettings(), clientContext); + this.listSnapshotsPagedCallable = + callableFactory.createPagedCallable( + listSnapshotsTransportSettings, settings.listSnapshotsSettings(), clientContext); + this.setLabelsSnapshotCallable = + callableFactory.createUnaryCallable( + setLabelsSnapshotTransportSettings, + settings.setLabelsSnapshotSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteSnapshotCallable() { + return deleteSnapshotCallable; + } + + @BetaApi + public UnaryCallable getSnapshotCallable() { + return getSnapshotCallable; + } + + @BetaApi + public UnaryCallable + listSnapshotsPagedCallable() { + return listSnapshotsPagedCallable; + } + + @BetaApi + public UnaryCallable listSnapshotsCallable() { + return listSnapshotsCallable; + } + + @BetaApi + public UnaryCallable setLabelsSnapshotCallable() { + return setLabelsSnapshotCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslCertificateCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslCertificateCallableFactory.java new file mode 100644 index 000000000000..de7ede7ad904 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslCertificateCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonSslCertificateCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslCertificateStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslCertificateStub.java new file mode 100644 index 000000000000..e1745d8b7bc4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslCertificateStub.java @@ -0,0 +1,295 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SslCertificateClient.ListSslCertificatesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteSslCertificateHttpRequest; +import com.google.cloud.compute.v1.GetSslCertificateHttpRequest; +import com.google.cloud.compute.v1.InsertSslCertificateHttpRequest; +import com.google.cloud.compute.v1.ListSslCertificatesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalSslCertificateName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.SslCertificate; +import com.google.cloud.compute.v1.SslCertificateList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonSslCertificateStub extends SslCertificateStub { + @InternalApi + public static final ApiMethodDescriptor + deleteSslCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.sslCertificates.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/sslCertificates/{sslCertificate}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalSslCertificateName.newFactory()) + .setResourceNameField("sslCertificate") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getSslCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.sslCertificates.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/sslCertificates/{sslCertificate}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalSslCertificateName.newFactory()) + .setResourceNameField("sslCertificate") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(SslCertificate.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertSslCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.sslCertificates.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/sslCertificates")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listSslCertificatesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.sslCertificates.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/sslCertificates")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(SslCertificateList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteSslCertificateCallable; + private final UnaryCallable + getSslCertificateCallable; + private final UnaryCallable + insertSslCertificateCallable; + private final UnaryCallable + listSslCertificatesCallable; + private final UnaryCallable + listSslCertificatesPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonSslCertificateStub create(SslCertificateStubSettings settings) + throws IOException { + return new HttpJsonSslCertificateStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonSslCertificateStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonSslCertificateStub( + SslCertificateStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonSslCertificateStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonSslCertificateStub( + SslCertificateStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonSslCertificateStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonSslCertificateStub( + SslCertificateStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonSslCertificateCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonSslCertificateStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonSslCertificateStub( + SslCertificateStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteSslCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteSslCertificateMethodDescriptor) + .build(); + HttpJsonCallSettings + getSslCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getSslCertificateMethodDescriptor) + .build(); + HttpJsonCallSettings + insertSslCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertSslCertificateMethodDescriptor) + .build(); + HttpJsonCallSettings + listSslCertificatesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listSslCertificatesMethodDescriptor) + .build(); + + this.deleteSslCertificateCallable = + callableFactory.createUnaryCallable( + deleteSslCertificateTransportSettings, + settings.deleteSslCertificateSettings(), + clientContext); + this.getSslCertificateCallable = + callableFactory.createUnaryCallable( + getSslCertificateTransportSettings, + settings.getSslCertificateSettings(), + clientContext); + this.insertSslCertificateCallable = + callableFactory.createUnaryCallable( + insertSslCertificateTransportSettings, + settings.insertSslCertificateSettings(), + clientContext); + this.listSslCertificatesCallable = + callableFactory.createUnaryCallable( + listSslCertificatesTransportSettings, + settings.listSslCertificatesSettings(), + clientContext); + this.listSslCertificatesPagedCallable = + callableFactory.createPagedCallable( + listSslCertificatesTransportSettings, + settings.listSslCertificatesSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteSslCertificateCallable() { + return deleteSslCertificateCallable; + } + + @BetaApi + public UnaryCallable getSslCertificateCallable() { + return getSslCertificateCallable; + } + + @BetaApi + public UnaryCallable insertSslCertificateCallable() { + return insertSslCertificateCallable; + } + + @BetaApi + public UnaryCallable + listSslCertificatesPagedCallable() { + return listSslCertificatesPagedCallable; + } + + @BetaApi + public UnaryCallable + listSslCertificatesCallable() { + return listSslCertificatesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslPolicyCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslPolicyCallableFactory.java new file mode 100644 index 000000000000..e3c7f47d3b12 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslPolicyCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonSslPolicyCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslPolicyStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslPolicyStub.java new file mode 100644 index 000000000000..7d2aa520fa59 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSslPolicyStub.java @@ -0,0 +1,363 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SslPolicyClient.ListSslPoliciesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteSslPolicyHttpRequest; +import com.google.cloud.compute.v1.GetSslPolicyHttpRequest; +import com.google.cloud.compute.v1.InsertSslPolicyHttpRequest; +import com.google.cloud.compute.v1.ListAvailableFeaturesSslPoliciesHttpRequest; +import com.google.cloud.compute.v1.ListSslPoliciesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchSslPolicyHttpRequest; +import com.google.cloud.compute.v1.ProjectGlobalSslPolicyName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.SslPoliciesList; +import com.google.cloud.compute.v1.SslPoliciesListAvailableFeaturesResponse; +import com.google.cloud.compute.v1.SslPolicy; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonSslPolicyStub extends SslPolicyStub { + @InternalApi + public static final ApiMethodDescriptor + deleteSslPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.sslPolicies.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/sslPolicies/{sslPolicy}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalSslPolicyName.newFactory()) + .setResourceNameField("sslPolicy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getSslPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.sslPolicies.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/sslPolicies/{sslPolicy}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalSslPolicyName.newFactory()) + .setResourceNameField("sslPolicy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(SslPolicy.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertSslPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.sslPolicies.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/sslPolicies")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listSslPoliciesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.sslPolicies.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/sslPolicies")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(SslPoliciesList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("compute.sslPolicies.listAvailableFeatures") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/sslPolicies/listAvailableFeatures")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser + .newBuilder() + .setResponseInstance( + SslPoliciesListAvailableFeaturesResponse.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchSslPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.sslPolicies.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/sslPolicies/{sslPolicy}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalSslPolicyName.newFactory()) + .setResourceNameField("sslPolicy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable deleteSslPolicyCallable; + private final UnaryCallable getSslPolicyCallable; + private final UnaryCallable insertSslPolicyCallable; + private final UnaryCallable listSslPoliciesCallable; + private final UnaryCallable + listSslPoliciesPagedCallable; + private final UnaryCallable< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesCallable; + private final UnaryCallable patchSslPolicyCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonSslPolicyStub create(SslPolicyStubSettings settings) + throws IOException { + return new HttpJsonSslPolicyStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonSslPolicyStub create(ClientContext clientContext) throws IOException { + return new HttpJsonSslPolicyStub(SslPolicyStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonSslPolicyStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonSslPolicyStub( + SslPolicyStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonSslPolicyStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSslPolicyStub(SslPolicyStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonSslPolicyCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonSslPolicyStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSslPolicyStub( + SslPolicyStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings deleteSslPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteSslPolicyMethodDescriptor) + .build(); + HttpJsonCallSettings getSslPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getSslPolicyMethodDescriptor) + .build(); + HttpJsonCallSettings insertSslPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertSslPolicyMethodDescriptor) + .build(); + HttpJsonCallSettings + listSslPoliciesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listSslPoliciesMethodDescriptor) + .build(); + HttpJsonCallSettings< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listAvailableFeaturesSslPoliciesMethodDescriptor) + .build(); + HttpJsonCallSettings patchSslPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchSslPolicyMethodDescriptor) + .build(); + + this.deleteSslPolicyCallable = + callableFactory.createUnaryCallable( + deleteSslPolicyTransportSettings, settings.deleteSslPolicySettings(), clientContext); + this.getSslPolicyCallable = + callableFactory.createUnaryCallable( + getSslPolicyTransportSettings, settings.getSslPolicySettings(), clientContext); + this.insertSslPolicyCallable = + callableFactory.createUnaryCallable( + insertSslPolicyTransportSettings, settings.insertSslPolicySettings(), clientContext); + this.listSslPoliciesCallable = + callableFactory.createUnaryCallable( + listSslPoliciesTransportSettings, settings.listSslPoliciesSettings(), clientContext); + this.listSslPoliciesPagedCallable = + callableFactory.createPagedCallable( + listSslPoliciesTransportSettings, settings.listSslPoliciesSettings(), clientContext); + this.listAvailableFeaturesSslPoliciesCallable = + callableFactory.createUnaryCallable( + listAvailableFeaturesSslPoliciesTransportSettings, + settings.listAvailableFeaturesSslPoliciesSettings(), + clientContext); + this.patchSslPolicyCallable = + callableFactory.createUnaryCallable( + patchSslPolicyTransportSettings, settings.patchSslPolicySettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteSslPolicyCallable() { + return deleteSslPolicyCallable; + } + + @BetaApi + public UnaryCallable getSslPolicyCallable() { + return getSslPolicyCallable; + } + + @BetaApi + public UnaryCallable insertSslPolicyCallable() { + return insertSslPolicyCallable; + } + + @BetaApi + public UnaryCallable + listSslPoliciesPagedCallable() { + return listSslPoliciesPagedCallable; + } + + @BetaApi + public UnaryCallable listSslPoliciesCallable() { + return listSslPoliciesCallable; + } + + @BetaApi + public UnaryCallable< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesCallable() { + return listAvailableFeaturesSslPoliciesCallable; + } + + @BetaApi + public UnaryCallable patchSslPolicyCallable() { + return patchSslPolicyCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSubnetworkCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSubnetworkCallableFactory.java new file mode 100644 index 000000000000..061b00e19d90 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSubnetworkCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonSubnetworkCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSubnetworkStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSubnetworkStub.java new file mode 100644 index 000000000000..c49c72f72b9b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonSubnetworkStub.java @@ -0,0 +1,457 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SubnetworkClient.AggregatedListSubnetworksPagedResponse; +import static com.google.cloud.compute.v1.SubnetworkClient.ListSubnetworksPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListSubnetworksHttpRequest; +import com.google.cloud.compute.v1.DeleteSubnetworkHttpRequest; +import com.google.cloud.compute.v1.ExpandIpCidrRangeSubnetworkHttpRequest; +import com.google.cloud.compute.v1.GetSubnetworkHttpRequest; +import com.google.cloud.compute.v1.InsertSubnetworkHttpRequest; +import com.google.cloud.compute.v1.ListSubnetworksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchSubnetworkHttpRequest; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.ProjectRegionSubnetworkName; +import com.google.cloud.compute.v1.SetPrivateIpGoogleAccessSubnetworkHttpRequest; +import com.google.cloud.compute.v1.Subnetwork; +import com.google.cloud.compute.v1.SubnetworkAggregatedList; +import com.google.cloud.compute.v1.SubnetworkList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonSubnetworkStub extends SubnetworkStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList> + aggregatedListSubnetworksMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.subnetworks.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/subnetworks")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(SubnetworkAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteSubnetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.subnetworks.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/subnetworks/{subnetwork}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionSubnetworkName.newFactory()) + .setResourceNameField("subnetwork") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + expandIpCidrRangeSubnetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.subnetworks.expandIpCidrRange") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/subnetworks/{subnetwork}/expandIpCidrRange")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionSubnetworkName.newFactory()) + .setResourceNameField("subnetwork") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getSubnetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.subnetworks.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/subnetworks/{subnetwork}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionSubnetworkName.newFactory()) + .setResourceNameField("subnetwork") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Subnetwork.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertSubnetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.subnetworks.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/subnetworks")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listSubnetworksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.subnetworks.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/subnetworks")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(SubnetworkList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchSubnetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.subnetworks.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/subnetworks/{subnetwork}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionSubnetworkName.newFactory()) + .setResourceNameField("subnetwork") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setPrivateIpGoogleAccessSubnetworkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.subnetworks.setPrivateIpGoogleAccess") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/subnetworks/{subnetwork}/setPrivateIpGoogleAccess")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionSubnetworkName.newFactory()) + .setResourceNameField("subnetwork") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + aggregatedListSubnetworksCallable; + private final UnaryCallable< + AggregatedListSubnetworksHttpRequest, AggregatedListSubnetworksPagedResponse> + aggregatedListSubnetworksPagedCallable; + private final UnaryCallable deleteSubnetworkCallable; + private final UnaryCallable + expandIpCidrRangeSubnetworkCallable; + private final UnaryCallable getSubnetworkCallable; + private final UnaryCallable insertSubnetworkCallable; + private final UnaryCallable listSubnetworksCallable; + private final UnaryCallable + listSubnetworksPagedCallable; + private final UnaryCallable patchSubnetworkCallable; + private final UnaryCallable + setPrivateIpGoogleAccessSubnetworkCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonSubnetworkStub create(SubnetworkStubSettings settings) + throws IOException { + return new HttpJsonSubnetworkStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonSubnetworkStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonSubnetworkStub(SubnetworkStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonSubnetworkStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonSubnetworkStub( + SubnetworkStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonSubnetworkStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSubnetworkStub(SubnetworkStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonSubnetworkCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonSubnetworkStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSubnetworkStub( + SubnetworkStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListSubnetworksTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListSubnetworksMethodDescriptor) + .build(); + HttpJsonCallSettings deleteSubnetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteSubnetworkMethodDescriptor) + .build(); + HttpJsonCallSettings + expandIpCidrRangeSubnetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(expandIpCidrRangeSubnetworkMethodDescriptor) + .build(); + HttpJsonCallSettings getSubnetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getSubnetworkMethodDescriptor) + .build(); + HttpJsonCallSettings insertSubnetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertSubnetworkMethodDescriptor) + .build(); + HttpJsonCallSettings + listSubnetworksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listSubnetworksMethodDescriptor) + .build(); + HttpJsonCallSettings patchSubnetworkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchSubnetworkMethodDescriptor) + .build(); + HttpJsonCallSettings + setPrivateIpGoogleAccessSubnetworkTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(setPrivateIpGoogleAccessSubnetworkMethodDescriptor) + .build(); + + this.aggregatedListSubnetworksCallable = + callableFactory.createUnaryCallable( + aggregatedListSubnetworksTransportSettings, + settings.aggregatedListSubnetworksSettings(), + clientContext); + this.aggregatedListSubnetworksPagedCallable = + callableFactory.createPagedCallable( + aggregatedListSubnetworksTransportSettings, + settings.aggregatedListSubnetworksSettings(), + clientContext); + this.deleteSubnetworkCallable = + callableFactory.createUnaryCallable( + deleteSubnetworkTransportSettings, settings.deleteSubnetworkSettings(), clientContext); + this.expandIpCidrRangeSubnetworkCallable = + callableFactory.createUnaryCallable( + expandIpCidrRangeSubnetworkTransportSettings, + settings.expandIpCidrRangeSubnetworkSettings(), + clientContext); + this.getSubnetworkCallable = + callableFactory.createUnaryCallable( + getSubnetworkTransportSettings, settings.getSubnetworkSettings(), clientContext); + this.insertSubnetworkCallable = + callableFactory.createUnaryCallable( + insertSubnetworkTransportSettings, settings.insertSubnetworkSettings(), clientContext); + this.listSubnetworksCallable = + callableFactory.createUnaryCallable( + listSubnetworksTransportSettings, settings.listSubnetworksSettings(), clientContext); + this.listSubnetworksPagedCallable = + callableFactory.createPagedCallable( + listSubnetworksTransportSettings, settings.listSubnetworksSettings(), clientContext); + this.patchSubnetworkCallable = + callableFactory.createUnaryCallable( + patchSubnetworkTransportSettings, settings.patchSubnetworkSettings(), clientContext); + this.setPrivateIpGoogleAccessSubnetworkCallable = + callableFactory.createUnaryCallable( + setPrivateIpGoogleAccessSubnetworkTransportSettings, + settings.setPrivateIpGoogleAccessSubnetworkSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + aggregatedListSubnetworksPagedCallable() { + return aggregatedListSubnetworksPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListSubnetworksCallable() { + return aggregatedListSubnetworksCallable; + } + + @BetaApi + public UnaryCallable deleteSubnetworkCallable() { + return deleteSubnetworkCallable; + } + + @BetaApi + public UnaryCallable + expandIpCidrRangeSubnetworkCallable() { + return expandIpCidrRangeSubnetworkCallable; + } + + @BetaApi + public UnaryCallable getSubnetworkCallable() { + return getSubnetworkCallable; + } + + @BetaApi + public UnaryCallable insertSubnetworkCallable() { + return insertSubnetworkCallable; + } + + @BetaApi + public UnaryCallable + listSubnetworksPagedCallable() { + return listSubnetworksPagedCallable; + } + + @BetaApi + public UnaryCallable listSubnetworksCallable() { + return listSubnetworksCallable; + } + + @BetaApi + public UnaryCallable patchSubnetworkCallable() { + return patchSubnetworkCallable; + } + + @BetaApi + public UnaryCallable + setPrivateIpGoogleAccessSubnetworkCallable() { + return setPrivateIpGoogleAccessSubnetworkCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpProxyCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpProxyCallableFactory.java new file mode 100644 index 000000000000..06dccd590665 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpProxyCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonTargetHttpProxyCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpProxyStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpProxyStub.java new file mode 100644 index 000000000000..9b774747118b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpProxyStub.java @@ -0,0 +1,341 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetHttpProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalTargetHttpProxyName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectTargetHttpProxyName; +import com.google.cloud.compute.v1.SetUrlMapTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.TargetHttpProxy; +import com.google.cloud.compute.v1.TargetHttpProxyList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonTargetHttpProxyStub extends TargetHttpProxyStub { + @InternalApi + public static final ApiMethodDescriptor + deleteTargetHttpProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpProxies.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/targetHttpProxies/{targetHttpProxy}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalTargetHttpProxyName.newFactory()) + .setResourceNameField("targetHttpProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getTargetHttpProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpProxies.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/targetHttpProxies/{targetHttpProxy}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalTargetHttpProxyName.newFactory()) + .setResourceNameField("targetHttpProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetHttpProxy.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertTargetHttpProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpProxies.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/targetHttpProxies")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listTargetHttpProxiesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpProxies.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/targetHttpProxies")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetHttpProxyList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setUrlMapTargetHttpProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpProxies.setUrlMap") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/targetHttpProxies/{targetHttpProxy}/setUrlMap")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectTargetHttpProxyName.newFactory()) + .setResourceNameField("targetHttpProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteTargetHttpProxyCallable; + private final UnaryCallable + getTargetHttpProxyCallable; + private final UnaryCallable + insertTargetHttpProxyCallable; + private final UnaryCallable + listTargetHttpProxiesCallable; + private final UnaryCallable + listTargetHttpProxiesPagedCallable; + private final UnaryCallable + setUrlMapTargetHttpProxyCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonTargetHttpProxyStub create(TargetHttpProxyStubSettings settings) + throws IOException { + return new HttpJsonTargetHttpProxyStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonTargetHttpProxyStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonTargetHttpProxyStub( + TargetHttpProxyStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonTargetHttpProxyStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonTargetHttpProxyStub( + TargetHttpProxyStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonTargetHttpProxyStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetHttpProxyStub( + TargetHttpProxyStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonTargetHttpProxyCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonTargetHttpProxyStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetHttpProxyStub( + TargetHttpProxyStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteTargetHttpProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteTargetHttpProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + getTargetHttpProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getTargetHttpProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + insertTargetHttpProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertTargetHttpProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + listTargetHttpProxiesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listTargetHttpProxiesMethodDescriptor) + .build(); + HttpJsonCallSettings + setUrlMapTargetHttpProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setUrlMapTargetHttpProxyMethodDescriptor) + .build(); + + this.deleteTargetHttpProxyCallable = + callableFactory.createUnaryCallable( + deleteTargetHttpProxyTransportSettings, + settings.deleteTargetHttpProxySettings(), + clientContext); + this.getTargetHttpProxyCallable = + callableFactory.createUnaryCallable( + getTargetHttpProxyTransportSettings, + settings.getTargetHttpProxySettings(), + clientContext); + this.insertTargetHttpProxyCallable = + callableFactory.createUnaryCallable( + insertTargetHttpProxyTransportSettings, + settings.insertTargetHttpProxySettings(), + clientContext); + this.listTargetHttpProxiesCallable = + callableFactory.createUnaryCallable( + listTargetHttpProxiesTransportSettings, + settings.listTargetHttpProxiesSettings(), + clientContext); + this.listTargetHttpProxiesPagedCallable = + callableFactory.createPagedCallable( + listTargetHttpProxiesTransportSettings, + settings.listTargetHttpProxiesSettings(), + clientContext); + this.setUrlMapTargetHttpProxyCallable = + callableFactory.createUnaryCallable( + setUrlMapTargetHttpProxyTransportSettings, + settings.setUrlMapTargetHttpProxySettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + deleteTargetHttpProxyCallable() { + return deleteTargetHttpProxyCallable; + } + + @BetaApi + public UnaryCallable + getTargetHttpProxyCallable() { + return getTargetHttpProxyCallable; + } + + @BetaApi + public UnaryCallable + insertTargetHttpProxyCallable() { + return insertTargetHttpProxyCallable; + } + + @BetaApi + public UnaryCallable + listTargetHttpProxiesPagedCallable() { + return listTargetHttpProxiesPagedCallable; + } + + @BetaApi + public UnaryCallable + listTargetHttpProxiesCallable() { + return listTargetHttpProxiesCallable; + } + + @BetaApi + public UnaryCallable + setUrlMapTargetHttpProxyCallable() { + return setUrlMapTargetHttpProxyCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpsProxyCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpsProxyCallableFactory.java new file mode 100644 index 000000000000..8648d3de3d4d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpsProxyCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonTargetHttpsProxyCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpsProxyStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpsProxyStub.java new file mode 100644 index 000000000000..1e017d23839e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetHttpsProxyStub.java @@ -0,0 +1,426 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetHttpsProxyClient.ListTargetHttpsProxiesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetHttpsProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalTargetHttpsProxyName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectTargetHttpsProxyName; +import com.google.cloud.compute.v1.SetSslCertificatesTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.SetSslPolicyTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.SetUrlMapTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.TargetHttpsProxy; +import com.google.cloud.compute.v1.TargetHttpsProxyList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonTargetHttpsProxyStub extends TargetHttpsProxyStub { + @InternalApi + public static final ApiMethodDescriptor + deleteTargetHttpsProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpsProxies.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/targetHttpsProxies/{targetHttpsProxy}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalTargetHttpsProxyName.newFactory()) + .setResourceNameField("targetHttpsProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getTargetHttpsProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpsProxies.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/targetHttpsProxies/{targetHttpsProxy}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalTargetHttpsProxyName.newFactory()) + .setResourceNameField("targetHttpsProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetHttpsProxy.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertTargetHttpsProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpsProxies.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/targetHttpsProxies")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listTargetHttpsProxiesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpsProxies.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/targetHttpsProxies")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetHttpsProxyList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setSslCertificatesTargetHttpsProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpsProxies.setSslCertificates") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/targetHttpsProxies/{targetHttpsProxy}/setSslCertificates")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectTargetHttpsProxyName.newFactory()) + .setResourceNameField("targetHttpsProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setSslPolicyTargetHttpsProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpsProxies.setSslPolicy") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/targetHttpsProxies/{targetHttpsProxy}/setSslPolicy")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalTargetHttpsProxyName.newFactory()) + .setResourceNameField("targetHttpsProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setUrlMapTargetHttpsProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetHttpsProxies.setUrlMap") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/targetHttpsProxies/{targetHttpsProxy}/setUrlMap")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectTargetHttpsProxyName.newFactory()) + .setResourceNameField("targetHttpsProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteTargetHttpsProxyCallable; + private final UnaryCallable + getTargetHttpsProxyCallable; + private final UnaryCallable + insertTargetHttpsProxyCallable; + private final UnaryCallable + listTargetHttpsProxiesCallable; + private final UnaryCallable< + ListTargetHttpsProxiesHttpRequest, ListTargetHttpsProxiesPagedResponse> + listTargetHttpsProxiesPagedCallable; + private final UnaryCallable + setSslCertificatesTargetHttpsProxyCallable; + private final UnaryCallable + setSslPolicyTargetHttpsProxyCallable; + private final UnaryCallable + setUrlMapTargetHttpsProxyCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonTargetHttpsProxyStub create(TargetHttpsProxyStubSettings settings) + throws IOException { + return new HttpJsonTargetHttpsProxyStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonTargetHttpsProxyStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonTargetHttpsProxyStub( + TargetHttpsProxyStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonTargetHttpsProxyStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonTargetHttpsProxyStub( + TargetHttpsProxyStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonTargetHttpsProxyStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetHttpsProxyStub( + TargetHttpsProxyStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonTargetHttpsProxyCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonTargetHttpsProxyStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetHttpsProxyStub( + TargetHttpsProxyStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteTargetHttpsProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteTargetHttpsProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + getTargetHttpsProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getTargetHttpsProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + insertTargetHttpsProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertTargetHttpsProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + listTargetHttpsProxiesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listTargetHttpsProxiesMethodDescriptor) + .build(); + HttpJsonCallSettings + setSslCertificatesTargetHttpsProxyTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(setSslCertificatesTargetHttpsProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + setSslPolicyTargetHttpsProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setSslPolicyTargetHttpsProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + setUrlMapTargetHttpsProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setUrlMapTargetHttpsProxyMethodDescriptor) + .build(); + + this.deleteTargetHttpsProxyCallable = + callableFactory.createUnaryCallable( + deleteTargetHttpsProxyTransportSettings, + settings.deleteTargetHttpsProxySettings(), + clientContext); + this.getTargetHttpsProxyCallable = + callableFactory.createUnaryCallable( + getTargetHttpsProxyTransportSettings, + settings.getTargetHttpsProxySettings(), + clientContext); + this.insertTargetHttpsProxyCallable = + callableFactory.createUnaryCallable( + insertTargetHttpsProxyTransportSettings, + settings.insertTargetHttpsProxySettings(), + clientContext); + this.listTargetHttpsProxiesCallable = + callableFactory.createUnaryCallable( + listTargetHttpsProxiesTransportSettings, + settings.listTargetHttpsProxiesSettings(), + clientContext); + this.listTargetHttpsProxiesPagedCallable = + callableFactory.createPagedCallable( + listTargetHttpsProxiesTransportSettings, + settings.listTargetHttpsProxiesSettings(), + clientContext); + this.setSslCertificatesTargetHttpsProxyCallable = + callableFactory.createUnaryCallable( + setSslCertificatesTargetHttpsProxyTransportSettings, + settings.setSslCertificatesTargetHttpsProxySettings(), + clientContext); + this.setSslPolicyTargetHttpsProxyCallable = + callableFactory.createUnaryCallable( + setSslPolicyTargetHttpsProxyTransportSettings, + settings.setSslPolicyTargetHttpsProxySettings(), + clientContext); + this.setUrlMapTargetHttpsProxyCallable = + callableFactory.createUnaryCallable( + setUrlMapTargetHttpsProxyTransportSettings, + settings.setUrlMapTargetHttpsProxySettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + deleteTargetHttpsProxyCallable() { + return deleteTargetHttpsProxyCallable; + } + + @BetaApi + public UnaryCallable + getTargetHttpsProxyCallable() { + return getTargetHttpsProxyCallable; + } + + @BetaApi + public UnaryCallable + insertTargetHttpsProxyCallable() { + return insertTargetHttpsProxyCallable; + } + + @BetaApi + public UnaryCallable + listTargetHttpsProxiesPagedCallable() { + return listTargetHttpsProxiesPagedCallable; + } + + @BetaApi + public UnaryCallable + listTargetHttpsProxiesCallable() { + return listTargetHttpsProxiesCallable; + } + + @BetaApi + public UnaryCallable + setSslCertificatesTargetHttpsProxyCallable() { + return setSslCertificatesTargetHttpsProxyCallable; + } + + @BetaApi + public UnaryCallable + setSslPolicyTargetHttpsProxyCallable() { + return setSslPolicyTargetHttpsProxyCallable; + } + + @BetaApi + public UnaryCallable + setUrlMapTargetHttpsProxyCallable() { + return setUrlMapTargetHttpsProxyCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetInstanceCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetInstanceCallableFactory.java new file mode 100644 index 000000000000..59045c2cfc38 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetInstanceCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonTargetInstanceCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetInstanceStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetInstanceStub.java new file mode 100644 index 000000000000..6c72a4757756 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetInstanceStub.java @@ -0,0 +1,362 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetInstanceClient.AggregatedListTargetInstancesPagedResponse; +import static com.google.cloud.compute.v1.TargetInstanceClient.ListTargetInstancesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListTargetInstancesHttpRequest; +import com.google.cloud.compute.v1.DeleteTargetInstanceHttpRequest; +import com.google.cloud.compute.v1.GetTargetInstanceHttpRequest; +import com.google.cloud.compute.v1.InsertTargetInstanceHttpRequest; +import com.google.cloud.compute.v1.ListTargetInstancesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectZoneName; +import com.google.cloud.compute.v1.ProjectZoneTargetInstanceName; +import com.google.cloud.compute.v1.TargetInstance; +import com.google.cloud.compute.v1.TargetInstanceAggregatedList; +import com.google.cloud.compute.v1.TargetInstanceList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonTargetInstanceStub extends TargetInstanceStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList> + aggregatedListTargetInstancesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.targetInstances.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/targetInstances")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetInstanceAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteTargetInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetInstances.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/targetInstances/{targetInstance}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneTargetInstanceName.newFactory()) + .setResourceNameField("targetInstance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getTargetInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetInstances.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/zones/{zone}/targetInstances/{targetInstance}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneTargetInstanceName.newFactory()) + .setResourceNameField("targetInstance") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetInstance.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertTargetInstanceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetInstances.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/targetInstances")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listTargetInstancesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetInstances.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/targetInstances")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetInstanceList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList> + aggregatedListTargetInstancesCallable; + private final UnaryCallable< + AggregatedListTargetInstancesHttpRequest, AggregatedListTargetInstancesPagedResponse> + aggregatedListTargetInstancesPagedCallable; + private final UnaryCallable + deleteTargetInstanceCallable; + private final UnaryCallable + getTargetInstanceCallable; + private final UnaryCallable + insertTargetInstanceCallable; + private final UnaryCallable + listTargetInstancesCallable; + private final UnaryCallable + listTargetInstancesPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonTargetInstanceStub create(TargetInstanceStubSettings settings) + throws IOException { + return new HttpJsonTargetInstanceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonTargetInstanceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonTargetInstanceStub( + TargetInstanceStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonTargetInstanceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonTargetInstanceStub( + TargetInstanceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonTargetInstanceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetInstanceStub( + TargetInstanceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonTargetInstanceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonTargetInstanceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetInstanceStub( + TargetInstanceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListTargetInstancesTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(aggregatedListTargetInstancesMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteTargetInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteTargetInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + getTargetInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getTargetInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + insertTargetInstanceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertTargetInstanceMethodDescriptor) + .build(); + HttpJsonCallSettings + listTargetInstancesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listTargetInstancesMethodDescriptor) + .build(); + + this.aggregatedListTargetInstancesCallable = + callableFactory.createUnaryCallable( + aggregatedListTargetInstancesTransportSettings, + settings.aggregatedListTargetInstancesSettings(), + clientContext); + this.aggregatedListTargetInstancesPagedCallable = + callableFactory.createPagedCallable( + aggregatedListTargetInstancesTransportSettings, + settings.aggregatedListTargetInstancesSettings(), + clientContext); + this.deleteTargetInstanceCallable = + callableFactory.createUnaryCallable( + deleteTargetInstanceTransportSettings, + settings.deleteTargetInstanceSettings(), + clientContext); + this.getTargetInstanceCallable = + callableFactory.createUnaryCallable( + getTargetInstanceTransportSettings, + settings.getTargetInstanceSettings(), + clientContext); + this.insertTargetInstanceCallable = + callableFactory.createUnaryCallable( + insertTargetInstanceTransportSettings, + settings.insertTargetInstanceSettings(), + clientContext); + this.listTargetInstancesCallable = + callableFactory.createUnaryCallable( + listTargetInstancesTransportSettings, + settings.listTargetInstancesSettings(), + clientContext); + this.listTargetInstancesPagedCallable = + callableFactory.createPagedCallable( + listTargetInstancesTransportSettings, + settings.listTargetInstancesSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable< + AggregatedListTargetInstancesHttpRequest, AggregatedListTargetInstancesPagedResponse> + aggregatedListTargetInstancesPagedCallable() { + return aggregatedListTargetInstancesPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListTargetInstancesCallable() { + return aggregatedListTargetInstancesCallable; + } + + @BetaApi + public UnaryCallable deleteTargetInstanceCallable() { + return deleteTargetInstanceCallable; + } + + @BetaApi + public UnaryCallable getTargetInstanceCallable() { + return getTargetInstanceCallable; + } + + @BetaApi + public UnaryCallable insertTargetInstanceCallable() { + return insertTargetInstanceCallable; + } + + @BetaApi + public UnaryCallable + listTargetInstancesPagedCallable() { + return listTargetInstancesPagedCallable; + } + + @BetaApi + public UnaryCallable + listTargetInstancesCallable() { + return listTargetInstancesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetPoolCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetPoolCallableFactory.java new file mode 100644 index 000000000000..cd90fcb13ba4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetPoolCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonTargetPoolCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetPoolStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetPoolStub.java new file mode 100644 index 000000000000..4f7711c7a176 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetPoolStub.java @@ -0,0 +1,581 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetPoolClient.AggregatedListTargetPoolsPagedResponse; +import static com.google.cloud.compute.v1.TargetPoolClient.ListTargetPoolsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AddHealthCheckTargetPoolHttpRequest; +import com.google.cloud.compute.v1.AddInstanceTargetPoolHttpRequest; +import com.google.cloud.compute.v1.AggregatedListTargetPoolsHttpRequest; +import com.google.cloud.compute.v1.DeleteTargetPoolHttpRequest; +import com.google.cloud.compute.v1.GetHealthTargetPoolHttpRequest; +import com.google.cloud.compute.v1.GetTargetPoolHttpRequest; +import com.google.cloud.compute.v1.InsertTargetPoolHttpRequest; +import com.google.cloud.compute.v1.ListTargetPoolsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.ProjectRegionTargetPoolName; +import com.google.cloud.compute.v1.RemoveHealthCheckTargetPoolHttpRequest; +import com.google.cloud.compute.v1.RemoveInstanceTargetPoolHttpRequest; +import com.google.cloud.compute.v1.SetBackupTargetPoolHttpRequest; +import com.google.cloud.compute.v1.TargetPool; +import com.google.cloud.compute.v1.TargetPoolAggregatedList; +import com.google.cloud.compute.v1.TargetPoolInstanceHealth; +import com.google.cloud.compute.v1.TargetPoolList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonTargetPoolStub extends TargetPoolStub { + @InternalApi + public static final ApiMethodDescriptor + addHealthCheckTargetPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetPools.addHealthCheck") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/targetPools/{targetPool}/addHealthCheck")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionTargetPoolName.newFactory()) + .setResourceNameField("targetPool") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + addInstanceTargetPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetPools.addInstance") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/targetPools/{targetPool}/addInstance")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionTargetPoolName.newFactory()) + .setResourceNameField("targetPool") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList> + aggregatedListTargetPoolsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.targetPools.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/targetPools")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetPoolAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteTargetPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetPools.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/targetPools/{targetPool}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionTargetPoolName.newFactory()) + .setResourceNameField("targetPool") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getTargetPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetPools.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/targetPools/{targetPool}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionTargetPoolName.newFactory()) + .setResourceNameField("targetPool") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetPool.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getHealthTargetPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetPools.getHealth") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/targetPools/{targetPool}/getHealth")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionTargetPoolName.newFactory()) + .setResourceNameField("targetPool") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetPoolInstanceHealth.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertTargetPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetPools.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/targetPools")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listTargetPoolsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetPools.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/targetPools")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetPoolList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + removeHealthCheckTargetPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetPools.removeHealthCheck") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/targetPools/{targetPool}/removeHealthCheck")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionTargetPoolName.newFactory()) + .setResourceNameField("targetPool") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + removeInstanceTargetPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetPools.removeInstance") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/targetPools/{targetPool}/removeInstance")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionTargetPoolName.newFactory()) + .setResourceNameField("targetPool") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setBackupTargetPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetPools.setBackup") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/targetPools/{targetPool}/setBackup")) + .setQueryParams(Sets.newHashSet("failoverRatio", "requestId")) + .setResourceNameFactory(ProjectRegionTargetPoolName.newFactory()) + .setResourceNameField("targetPool") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + addHealthCheckTargetPoolCallable; + private final UnaryCallable + addInstanceTargetPoolCallable; + private final UnaryCallable + aggregatedListTargetPoolsCallable; + private final UnaryCallable< + AggregatedListTargetPoolsHttpRequest, AggregatedListTargetPoolsPagedResponse> + aggregatedListTargetPoolsPagedCallable; + private final UnaryCallable deleteTargetPoolCallable; + private final UnaryCallable getTargetPoolCallable; + private final UnaryCallable + getHealthTargetPoolCallable; + private final UnaryCallable insertTargetPoolCallable; + private final UnaryCallable listTargetPoolsCallable; + private final UnaryCallable + listTargetPoolsPagedCallable; + private final UnaryCallable + removeHealthCheckTargetPoolCallable; + private final UnaryCallable + removeInstanceTargetPoolCallable; + private final UnaryCallable + setBackupTargetPoolCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonTargetPoolStub create(TargetPoolStubSettings settings) + throws IOException { + return new HttpJsonTargetPoolStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonTargetPoolStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonTargetPoolStub(TargetPoolStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonTargetPoolStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonTargetPoolStub( + TargetPoolStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonTargetPoolStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonTargetPoolStub(TargetPoolStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonTargetPoolCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonTargetPoolStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonTargetPoolStub( + TargetPoolStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + addHealthCheckTargetPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(addHealthCheckTargetPoolMethodDescriptor) + .build(); + HttpJsonCallSettings + addInstanceTargetPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(addInstanceTargetPoolMethodDescriptor) + .build(); + HttpJsonCallSettings + aggregatedListTargetPoolsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListTargetPoolsMethodDescriptor) + .build(); + HttpJsonCallSettings deleteTargetPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteTargetPoolMethodDescriptor) + .build(); + HttpJsonCallSettings getTargetPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getTargetPoolMethodDescriptor) + .build(); + HttpJsonCallSettings + getHealthTargetPoolTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getHealthTargetPoolMethodDescriptor) + .build(); + HttpJsonCallSettings insertTargetPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertTargetPoolMethodDescriptor) + .build(); + HttpJsonCallSettings + listTargetPoolsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listTargetPoolsMethodDescriptor) + .build(); + HttpJsonCallSettings + removeHealthCheckTargetPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(removeHealthCheckTargetPoolMethodDescriptor) + .build(); + HttpJsonCallSettings + removeInstanceTargetPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(removeInstanceTargetPoolMethodDescriptor) + .build(); + HttpJsonCallSettings + setBackupTargetPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setBackupTargetPoolMethodDescriptor) + .build(); + + this.addHealthCheckTargetPoolCallable = + callableFactory.createUnaryCallable( + addHealthCheckTargetPoolTransportSettings, + settings.addHealthCheckTargetPoolSettings(), + clientContext); + this.addInstanceTargetPoolCallable = + callableFactory.createUnaryCallable( + addInstanceTargetPoolTransportSettings, + settings.addInstanceTargetPoolSettings(), + clientContext); + this.aggregatedListTargetPoolsCallable = + callableFactory.createUnaryCallable( + aggregatedListTargetPoolsTransportSettings, + settings.aggregatedListTargetPoolsSettings(), + clientContext); + this.aggregatedListTargetPoolsPagedCallable = + callableFactory.createPagedCallable( + aggregatedListTargetPoolsTransportSettings, + settings.aggregatedListTargetPoolsSettings(), + clientContext); + this.deleteTargetPoolCallable = + callableFactory.createUnaryCallable( + deleteTargetPoolTransportSettings, settings.deleteTargetPoolSettings(), clientContext); + this.getTargetPoolCallable = + callableFactory.createUnaryCallable( + getTargetPoolTransportSettings, settings.getTargetPoolSettings(), clientContext); + this.getHealthTargetPoolCallable = + callableFactory.createUnaryCallable( + getHealthTargetPoolTransportSettings, + settings.getHealthTargetPoolSettings(), + clientContext); + this.insertTargetPoolCallable = + callableFactory.createUnaryCallable( + insertTargetPoolTransportSettings, settings.insertTargetPoolSettings(), clientContext); + this.listTargetPoolsCallable = + callableFactory.createUnaryCallable( + listTargetPoolsTransportSettings, settings.listTargetPoolsSettings(), clientContext); + this.listTargetPoolsPagedCallable = + callableFactory.createPagedCallable( + listTargetPoolsTransportSettings, settings.listTargetPoolsSettings(), clientContext); + this.removeHealthCheckTargetPoolCallable = + callableFactory.createUnaryCallable( + removeHealthCheckTargetPoolTransportSettings, + settings.removeHealthCheckTargetPoolSettings(), + clientContext); + this.removeInstanceTargetPoolCallable = + callableFactory.createUnaryCallable( + removeInstanceTargetPoolTransportSettings, + settings.removeInstanceTargetPoolSettings(), + clientContext); + this.setBackupTargetPoolCallable = + callableFactory.createUnaryCallable( + setBackupTargetPoolTransportSettings, + settings.setBackupTargetPoolSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + addHealthCheckTargetPoolCallable() { + return addHealthCheckTargetPoolCallable; + } + + @BetaApi + public UnaryCallable + addInstanceTargetPoolCallable() { + return addInstanceTargetPoolCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListTargetPoolsPagedCallable() { + return aggregatedListTargetPoolsPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListTargetPoolsCallable() { + return aggregatedListTargetPoolsCallable; + } + + @BetaApi + public UnaryCallable deleteTargetPoolCallable() { + return deleteTargetPoolCallable; + } + + @BetaApi + public UnaryCallable getTargetPoolCallable() { + return getTargetPoolCallable; + } + + @BetaApi + public UnaryCallable + getHealthTargetPoolCallable() { + return getHealthTargetPoolCallable; + } + + @BetaApi + public UnaryCallable insertTargetPoolCallable() { + return insertTargetPoolCallable; + } + + @BetaApi + public UnaryCallable + listTargetPoolsPagedCallable() { + return listTargetPoolsPagedCallable; + } + + @BetaApi + public UnaryCallable listTargetPoolsCallable() { + return listTargetPoolsCallable; + } + + @BetaApi + public UnaryCallable + removeHealthCheckTargetPoolCallable() { + return removeHealthCheckTargetPoolCallable; + } + + @BetaApi + public UnaryCallable + removeInstanceTargetPoolCallable() { + return removeInstanceTargetPoolCallable; + } + + @BetaApi + public UnaryCallable setBackupTargetPoolCallable() { + return setBackupTargetPoolCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetSslProxyCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetSslProxyCallableFactory.java new file mode 100644 index 000000000000..f21ed3ad7be5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetSslProxyCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonTargetSslProxyCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetSslProxyStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetSslProxyStub.java new file mode 100644 index 000000000000..ed85e9da385d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetSslProxyStub.java @@ -0,0 +1,459 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetSslProxyClient.ListTargetSslProxiesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetSslProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalTargetSslProxyName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.SetBackendServiceTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.SetProxyHeaderTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.SetSslCertificatesTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.SetSslPolicyTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.TargetSslProxy; +import com.google.cloud.compute.v1.TargetSslProxyList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonTargetSslProxyStub extends TargetSslProxyStub { + @InternalApi + public static final ApiMethodDescriptor + deleteTargetSslProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetSslProxies.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/targetSslProxies/{targetSslProxy}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalTargetSslProxyName.newFactory()) + .setResourceNameField("targetSslProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getTargetSslProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetSslProxies.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/targetSslProxies/{targetSslProxy}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalTargetSslProxyName.newFactory()) + .setResourceNameField("targetSslProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetSslProxy.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertTargetSslProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetSslProxies.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/targetSslProxies")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listTargetSslProxiesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetSslProxies.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/targetSslProxies")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetSslProxyList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setBackendServiceTargetSslProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetSslProxies.setBackendService") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/targetSslProxies/{targetSslProxy}/setBackendService")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalTargetSslProxyName.newFactory()) + .setResourceNameField("targetSslProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setProxyHeaderTargetSslProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetSslProxies.setProxyHeader") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/targetSslProxies/{targetSslProxy}/setProxyHeader")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalTargetSslProxyName.newFactory()) + .setResourceNameField("targetSslProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setSslCertificatesTargetSslProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetSslProxies.setSslCertificates") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/targetSslProxies/{targetSslProxy}/setSslCertificates")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalTargetSslProxyName.newFactory()) + .setResourceNameField("targetSslProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setSslPolicyTargetSslProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetSslProxies.setSslPolicy") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/targetSslProxies/{targetSslProxy}/setSslPolicy")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalTargetSslProxyName.newFactory()) + .setResourceNameField("targetSslProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteTargetSslProxyCallable; + private final UnaryCallable + getTargetSslProxyCallable; + private final UnaryCallable + insertTargetSslProxyCallable; + private final UnaryCallable + listTargetSslProxiesCallable; + private final UnaryCallable + listTargetSslProxiesPagedCallable; + private final UnaryCallable + setBackendServiceTargetSslProxyCallable; + private final UnaryCallable + setProxyHeaderTargetSslProxyCallable; + private final UnaryCallable + setSslCertificatesTargetSslProxyCallable; + private final UnaryCallable + setSslPolicyTargetSslProxyCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonTargetSslProxyStub create(TargetSslProxyStubSettings settings) + throws IOException { + return new HttpJsonTargetSslProxyStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonTargetSslProxyStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonTargetSslProxyStub( + TargetSslProxyStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonTargetSslProxyStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonTargetSslProxyStub( + TargetSslProxyStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonTargetSslProxyStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetSslProxyStub( + TargetSslProxyStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonTargetSslProxyCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonTargetSslProxyStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetSslProxyStub( + TargetSslProxyStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteTargetSslProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteTargetSslProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + getTargetSslProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getTargetSslProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + insertTargetSslProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertTargetSslProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + listTargetSslProxiesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listTargetSslProxiesMethodDescriptor) + .build(); + HttpJsonCallSettings + setBackendServiceTargetSslProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setBackendServiceTargetSslProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + setProxyHeaderTargetSslProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setProxyHeaderTargetSslProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + setSslCertificatesTargetSslProxyTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(setSslCertificatesTargetSslProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + setSslPolicyTargetSslProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setSslPolicyTargetSslProxyMethodDescriptor) + .build(); + + this.deleteTargetSslProxyCallable = + callableFactory.createUnaryCallable( + deleteTargetSslProxyTransportSettings, + settings.deleteTargetSslProxySettings(), + clientContext); + this.getTargetSslProxyCallable = + callableFactory.createUnaryCallable( + getTargetSslProxyTransportSettings, + settings.getTargetSslProxySettings(), + clientContext); + this.insertTargetSslProxyCallable = + callableFactory.createUnaryCallable( + insertTargetSslProxyTransportSettings, + settings.insertTargetSslProxySettings(), + clientContext); + this.listTargetSslProxiesCallable = + callableFactory.createUnaryCallable( + listTargetSslProxiesTransportSettings, + settings.listTargetSslProxiesSettings(), + clientContext); + this.listTargetSslProxiesPagedCallable = + callableFactory.createPagedCallable( + listTargetSslProxiesTransportSettings, + settings.listTargetSslProxiesSettings(), + clientContext); + this.setBackendServiceTargetSslProxyCallable = + callableFactory.createUnaryCallable( + setBackendServiceTargetSslProxyTransportSettings, + settings.setBackendServiceTargetSslProxySettings(), + clientContext); + this.setProxyHeaderTargetSslProxyCallable = + callableFactory.createUnaryCallable( + setProxyHeaderTargetSslProxyTransportSettings, + settings.setProxyHeaderTargetSslProxySettings(), + clientContext); + this.setSslCertificatesTargetSslProxyCallable = + callableFactory.createUnaryCallable( + setSslCertificatesTargetSslProxyTransportSettings, + settings.setSslCertificatesTargetSslProxySettings(), + clientContext); + this.setSslPolicyTargetSslProxyCallable = + callableFactory.createUnaryCallable( + setSslPolicyTargetSslProxyTransportSettings, + settings.setSslPolicyTargetSslProxySettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteTargetSslProxyCallable() { + return deleteTargetSslProxyCallable; + } + + @BetaApi + public UnaryCallable getTargetSslProxyCallable() { + return getTargetSslProxyCallable; + } + + @BetaApi + public UnaryCallable insertTargetSslProxyCallable() { + return insertTargetSslProxyCallable; + } + + @BetaApi + public UnaryCallable + listTargetSslProxiesPagedCallable() { + return listTargetSslProxiesPagedCallable; + } + + @BetaApi + public UnaryCallable + listTargetSslProxiesCallable() { + return listTargetSslProxiesCallable; + } + + @BetaApi + public UnaryCallable + setBackendServiceTargetSslProxyCallable() { + return setBackendServiceTargetSslProxyCallable; + } + + @BetaApi + public UnaryCallable + setProxyHeaderTargetSslProxyCallable() { + return setProxyHeaderTargetSslProxyCallable; + } + + @BetaApi + public UnaryCallable + setSslCertificatesTargetSslProxyCallable() { + return setSslCertificatesTargetSslProxyCallable; + } + + @BetaApi + public UnaryCallable + setSslPolicyTargetSslProxyCallable() { + return setSslPolicyTargetSslProxyCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetTcpProxyCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetTcpProxyCallableFactory.java new file mode 100644 index 000000000000..02ba0c5f433d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetTcpProxyCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonTargetTcpProxyCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetTcpProxyStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetTcpProxyStub.java new file mode 100644 index 000000000000..f9730e9be9ad --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetTcpProxyStub.java @@ -0,0 +1,377 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetTcpProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectGlobalTargetTcpProxyName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.SetBackendServiceTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.SetProxyHeaderTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.TargetTcpProxy; +import com.google.cloud.compute.v1.TargetTcpProxyList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonTargetTcpProxyStub extends TargetTcpProxyStub { + @InternalApi + public static final ApiMethodDescriptor + deleteTargetTcpProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetTcpProxies.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/targetTcpProxies/{targetTcpProxy}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalTargetTcpProxyName.newFactory()) + .setResourceNameField("targetTcpProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getTargetTcpProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetTcpProxies.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/targetTcpProxies/{targetTcpProxy}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalTargetTcpProxyName.newFactory()) + .setResourceNameField("targetTcpProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetTcpProxy.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertTargetTcpProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetTcpProxies.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/targetTcpProxies")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listTargetTcpProxiesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetTcpProxies.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/targetTcpProxies")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetTcpProxyList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setBackendServiceTargetTcpProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetTcpProxies.setBackendService") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/targetTcpProxies/{targetTcpProxy}/setBackendService")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalTargetTcpProxyName.newFactory()) + .setResourceNameField("targetTcpProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + setProxyHeaderTargetTcpProxyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetTcpProxies.setProxyHeader") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/global/targetTcpProxies/{targetTcpProxy}/setProxyHeader")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalTargetTcpProxyName.newFactory()) + .setResourceNameField("targetTcpProxy") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + deleteTargetTcpProxyCallable; + private final UnaryCallable + getTargetTcpProxyCallable; + private final UnaryCallable + insertTargetTcpProxyCallable; + private final UnaryCallable + listTargetTcpProxiesCallable; + private final UnaryCallable + listTargetTcpProxiesPagedCallable; + private final UnaryCallable + setBackendServiceTargetTcpProxyCallable; + private final UnaryCallable + setProxyHeaderTargetTcpProxyCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonTargetTcpProxyStub create(TargetTcpProxyStubSettings settings) + throws IOException { + return new HttpJsonTargetTcpProxyStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonTargetTcpProxyStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonTargetTcpProxyStub( + TargetTcpProxyStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonTargetTcpProxyStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonTargetTcpProxyStub( + TargetTcpProxyStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonTargetTcpProxyStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetTcpProxyStub( + TargetTcpProxyStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonTargetTcpProxyCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonTargetTcpProxyStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetTcpProxyStub( + TargetTcpProxyStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteTargetTcpProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteTargetTcpProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + getTargetTcpProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getTargetTcpProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + insertTargetTcpProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertTargetTcpProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + listTargetTcpProxiesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listTargetTcpProxiesMethodDescriptor) + .build(); + HttpJsonCallSettings + setBackendServiceTargetTcpProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setBackendServiceTargetTcpProxyMethodDescriptor) + .build(); + HttpJsonCallSettings + setProxyHeaderTargetTcpProxyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setProxyHeaderTargetTcpProxyMethodDescriptor) + .build(); + + this.deleteTargetTcpProxyCallable = + callableFactory.createUnaryCallable( + deleteTargetTcpProxyTransportSettings, + settings.deleteTargetTcpProxySettings(), + clientContext); + this.getTargetTcpProxyCallable = + callableFactory.createUnaryCallable( + getTargetTcpProxyTransportSettings, + settings.getTargetTcpProxySettings(), + clientContext); + this.insertTargetTcpProxyCallable = + callableFactory.createUnaryCallable( + insertTargetTcpProxyTransportSettings, + settings.insertTargetTcpProxySettings(), + clientContext); + this.listTargetTcpProxiesCallable = + callableFactory.createUnaryCallable( + listTargetTcpProxiesTransportSettings, + settings.listTargetTcpProxiesSettings(), + clientContext); + this.listTargetTcpProxiesPagedCallable = + callableFactory.createPagedCallable( + listTargetTcpProxiesTransportSettings, + settings.listTargetTcpProxiesSettings(), + clientContext); + this.setBackendServiceTargetTcpProxyCallable = + callableFactory.createUnaryCallable( + setBackendServiceTargetTcpProxyTransportSettings, + settings.setBackendServiceTargetTcpProxySettings(), + clientContext); + this.setProxyHeaderTargetTcpProxyCallable = + callableFactory.createUnaryCallable( + setProxyHeaderTargetTcpProxyTransportSettings, + settings.setProxyHeaderTargetTcpProxySettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteTargetTcpProxyCallable() { + return deleteTargetTcpProxyCallable; + } + + @BetaApi + public UnaryCallable getTargetTcpProxyCallable() { + return getTargetTcpProxyCallable; + } + + @BetaApi + public UnaryCallable insertTargetTcpProxyCallable() { + return insertTargetTcpProxyCallable; + } + + @BetaApi + public UnaryCallable + listTargetTcpProxiesPagedCallable() { + return listTargetTcpProxiesPagedCallable; + } + + @BetaApi + public UnaryCallable + listTargetTcpProxiesCallable() { + return listTargetTcpProxiesCallable; + } + + @BetaApi + public UnaryCallable + setBackendServiceTargetTcpProxyCallable() { + return setBackendServiceTargetTcpProxyCallable; + } + + @BetaApi + public UnaryCallable + setProxyHeaderTargetTcpProxyCallable() { + return setProxyHeaderTargetTcpProxyCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetVpnGatewayCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetVpnGatewayCallableFactory.java new file mode 100644 index 000000000000..17d1d515a875 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetVpnGatewayCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonTargetVpnGatewayCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetVpnGatewayStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetVpnGatewayStub.java new file mode 100644 index 000000000000..fecf358a7ac4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonTargetVpnGatewayStub.java @@ -0,0 +1,368 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse; +import static com.google.cloud.compute.v1.TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListTargetVpnGatewaysHttpRequest; +import com.google.cloud.compute.v1.DeleteTargetVpnGatewayHttpRequest; +import com.google.cloud.compute.v1.GetTargetVpnGatewayHttpRequest; +import com.google.cloud.compute.v1.InsertTargetVpnGatewayHttpRequest; +import com.google.cloud.compute.v1.ListTargetVpnGatewaysHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.ProjectRegionTargetVpnGatewayName; +import com.google.cloud.compute.v1.TargetVpnGateway; +import com.google.cloud.compute.v1.TargetVpnGatewayAggregatedList; +import com.google.cloud.compute.v1.TargetVpnGatewayList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonTargetVpnGatewayStub extends TargetVpnGatewayStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList> + aggregatedListTargetVpnGatewaysMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("compute.targetVpnGateways.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter + .newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/aggregated/targetVpnGateways")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetVpnGatewayAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteTargetVpnGatewayMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetVpnGateways.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/targetVpnGateways/{targetVpnGateway}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionTargetVpnGatewayName.newFactory()) + .setResourceNameField("targetVpnGateway") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getTargetVpnGatewayMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetVpnGateways.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create( + "{project}/regions/{region}/targetVpnGateways/{targetVpnGateway}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionTargetVpnGatewayName.newFactory()) + .setResourceNameField("targetVpnGateway") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetVpnGateway.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertTargetVpnGatewayMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetVpnGateways.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/targetVpnGateways")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listTargetVpnGatewaysMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.targetVpnGateways.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/targetVpnGateways")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(TargetVpnGatewayList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList> + aggregatedListTargetVpnGatewaysCallable; + private final UnaryCallable< + AggregatedListTargetVpnGatewaysHttpRequest, AggregatedListTargetVpnGatewaysPagedResponse> + aggregatedListTargetVpnGatewaysPagedCallable; + private final UnaryCallable + deleteTargetVpnGatewayCallable; + private final UnaryCallable + getTargetVpnGatewayCallable; + private final UnaryCallable + insertTargetVpnGatewayCallable; + private final UnaryCallable + listTargetVpnGatewaysCallable; + private final UnaryCallable + listTargetVpnGatewaysPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonTargetVpnGatewayStub create(TargetVpnGatewayStubSettings settings) + throws IOException { + return new HttpJsonTargetVpnGatewayStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonTargetVpnGatewayStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonTargetVpnGatewayStub( + TargetVpnGatewayStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonTargetVpnGatewayStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonTargetVpnGatewayStub( + TargetVpnGatewayStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonTargetVpnGatewayStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetVpnGatewayStub( + TargetVpnGatewayStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonTargetVpnGatewayCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonTargetVpnGatewayStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonTargetVpnGatewayStub( + TargetVpnGatewayStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListTargetVpnGatewaysTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(aggregatedListTargetVpnGatewaysMethodDescriptor) + .build(); + HttpJsonCallSettings + deleteTargetVpnGatewayTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteTargetVpnGatewayMethodDescriptor) + .build(); + HttpJsonCallSettings + getTargetVpnGatewayTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getTargetVpnGatewayMethodDescriptor) + .build(); + HttpJsonCallSettings + insertTargetVpnGatewayTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertTargetVpnGatewayMethodDescriptor) + .build(); + HttpJsonCallSettings + listTargetVpnGatewaysTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listTargetVpnGatewaysMethodDescriptor) + .build(); + + this.aggregatedListTargetVpnGatewaysCallable = + callableFactory.createUnaryCallable( + aggregatedListTargetVpnGatewaysTransportSettings, + settings.aggregatedListTargetVpnGatewaysSettings(), + clientContext); + this.aggregatedListTargetVpnGatewaysPagedCallable = + callableFactory.createPagedCallable( + aggregatedListTargetVpnGatewaysTransportSettings, + settings.aggregatedListTargetVpnGatewaysSettings(), + clientContext); + this.deleteTargetVpnGatewayCallable = + callableFactory.createUnaryCallable( + deleteTargetVpnGatewayTransportSettings, + settings.deleteTargetVpnGatewaySettings(), + clientContext); + this.getTargetVpnGatewayCallable = + callableFactory.createUnaryCallable( + getTargetVpnGatewayTransportSettings, + settings.getTargetVpnGatewaySettings(), + clientContext); + this.insertTargetVpnGatewayCallable = + callableFactory.createUnaryCallable( + insertTargetVpnGatewayTransportSettings, + settings.insertTargetVpnGatewaySettings(), + clientContext); + this.listTargetVpnGatewaysCallable = + callableFactory.createUnaryCallable( + listTargetVpnGatewaysTransportSettings, + settings.listTargetVpnGatewaysSettings(), + clientContext); + this.listTargetVpnGatewaysPagedCallable = + callableFactory.createPagedCallable( + listTargetVpnGatewaysTransportSettings, + settings.listTargetVpnGatewaysSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable< + AggregatedListTargetVpnGatewaysHttpRequest, AggregatedListTargetVpnGatewaysPagedResponse> + aggregatedListTargetVpnGatewaysPagedCallable() { + return aggregatedListTargetVpnGatewaysPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListTargetVpnGatewaysCallable() { + return aggregatedListTargetVpnGatewaysCallable; + } + + @BetaApi + public UnaryCallable + deleteTargetVpnGatewayCallable() { + return deleteTargetVpnGatewayCallable; + } + + @BetaApi + public UnaryCallable + getTargetVpnGatewayCallable() { + return getTargetVpnGatewayCallable; + } + + @BetaApi + public UnaryCallable + insertTargetVpnGatewayCallable() { + return insertTargetVpnGatewayCallable; + } + + @BetaApi + public UnaryCallable + listTargetVpnGatewaysPagedCallable() { + return listTargetVpnGatewaysPagedCallable; + } + + @BetaApi + public UnaryCallable + listTargetVpnGatewaysCallable() { + return listTargetVpnGatewaysCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonUrlMapCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonUrlMapCallableFactory.java new file mode 100644 index 000000000000..9567bd5ddb95 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonUrlMapCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonUrlMapCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonUrlMapStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonUrlMapStub.java new file mode 100644 index 000000000000..e50d38214193 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonUrlMapStub.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.UrlMapClient.ListUrlMapsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteUrlMapHttpRequest; +import com.google.cloud.compute.v1.GetUrlMapHttpRequest; +import com.google.cloud.compute.v1.InsertUrlMapHttpRequest; +import com.google.cloud.compute.v1.InvalidateCacheUrlMapHttpRequest; +import com.google.cloud.compute.v1.ListUrlMapsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchUrlMapHttpRequest; +import com.google.cloud.compute.v1.ProjectGlobalUrlMapName; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.UpdateUrlMapHttpRequest; +import com.google.cloud.compute.v1.UrlMap; +import com.google.cloud.compute.v1.UrlMapList; +import com.google.cloud.compute.v1.UrlMapsValidateResponse; +import com.google.cloud.compute.v1.ValidateUrlMapHttpRequest; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonUrlMapStub extends UrlMapStub { + @InternalApi + public static final ApiMethodDescriptor + deleteUrlMapMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.urlMaps.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/urlMaps/{urlMap}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalUrlMapName.newFactory()) + .setResourceNameField("urlMap") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor getUrlMapMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.urlMaps.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/urlMaps/{urlMap}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalUrlMapName.newFactory()) + .setResourceNameField("urlMap") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(UrlMap.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertUrlMapMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.urlMaps.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/urlMaps")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + invalidateCacheUrlMapMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.urlMaps.invalidateCache") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/urlMaps/{urlMap}/invalidateCache")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalUrlMapName.newFactory()) + .setResourceNameField("urlMap") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listUrlMapsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.urlMaps.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/urlMaps")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(UrlMapList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + patchUrlMapMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.urlMaps.patch") + .setHttpMethod(HttpMethods.PATCH) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/urlMaps/{urlMap}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalUrlMapName.newFactory()) + .setResourceNameField("urlMap") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + updateUrlMapMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.urlMaps.update") + .setHttpMethod(HttpMethods.PUT) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/global/urlMaps/{urlMap}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectGlobalUrlMapName.newFactory()) + .setResourceNameField("urlMap") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + validateUrlMapMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.urlMaps.validate") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/global/urlMaps/{urlMap}/validate")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectGlobalUrlMapName.newFactory()) + .setResourceNameField("urlMap") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(UrlMapsValidateResponse.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable deleteUrlMapCallable; + private final UnaryCallable getUrlMapCallable; + private final UnaryCallable insertUrlMapCallable; + private final UnaryCallable + invalidateCacheUrlMapCallable; + private final UnaryCallable listUrlMapsCallable; + private final UnaryCallable + listUrlMapsPagedCallable; + private final UnaryCallable patchUrlMapCallable; + private final UnaryCallable updateUrlMapCallable; + private final UnaryCallable + validateUrlMapCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonUrlMapStub create(UrlMapStubSettings settings) throws IOException { + return new HttpJsonUrlMapStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonUrlMapStub create(ClientContext clientContext) throws IOException { + return new HttpJsonUrlMapStub(UrlMapStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonUrlMapStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonUrlMapStub( + UrlMapStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonUrlMapStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonUrlMapStub(UrlMapStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonUrlMapCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonUrlMapStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonUrlMapStub( + UrlMapStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings deleteUrlMapTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteUrlMapMethodDescriptor) + .build(); + HttpJsonCallSettings getUrlMapTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getUrlMapMethodDescriptor) + .build(); + HttpJsonCallSettings insertUrlMapTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertUrlMapMethodDescriptor) + .build(); + HttpJsonCallSettings + invalidateCacheUrlMapTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(invalidateCacheUrlMapMethodDescriptor) + .build(); + HttpJsonCallSettings listUrlMapsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listUrlMapsMethodDescriptor) + .build(); + HttpJsonCallSettings patchUrlMapTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(patchUrlMapMethodDescriptor) + .build(); + HttpJsonCallSettings updateUrlMapTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateUrlMapMethodDescriptor) + .build(); + HttpJsonCallSettings + validateUrlMapTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(validateUrlMapMethodDescriptor) + .build(); + + this.deleteUrlMapCallable = + callableFactory.createUnaryCallable( + deleteUrlMapTransportSettings, settings.deleteUrlMapSettings(), clientContext); + this.getUrlMapCallable = + callableFactory.createUnaryCallable( + getUrlMapTransportSettings, settings.getUrlMapSettings(), clientContext); + this.insertUrlMapCallable = + callableFactory.createUnaryCallable( + insertUrlMapTransportSettings, settings.insertUrlMapSettings(), clientContext); + this.invalidateCacheUrlMapCallable = + callableFactory.createUnaryCallable( + invalidateCacheUrlMapTransportSettings, + settings.invalidateCacheUrlMapSettings(), + clientContext); + this.listUrlMapsCallable = + callableFactory.createUnaryCallable( + listUrlMapsTransportSettings, settings.listUrlMapsSettings(), clientContext); + this.listUrlMapsPagedCallable = + callableFactory.createPagedCallable( + listUrlMapsTransportSettings, settings.listUrlMapsSettings(), clientContext); + this.patchUrlMapCallable = + callableFactory.createUnaryCallable( + patchUrlMapTransportSettings, settings.patchUrlMapSettings(), clientContext); + this.updateUrlMapCallable = + callableFactory.createUnaryCallable( + updateUrlMapTransportSettings, settings.updateUrlMapSettings(), clientContext); + this.validateUrlMapCallable = + callableFactory.createUnaryCallable( + validateUrlMapTransportSettings, settings.validateUrlMapSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteUrlMapCallable() { + return deleteUrlMapCallable; + } + + @BetaApi + public UnaryCallable getUrlMapCallable() { + return getUrlMapCallable; + } + + @BetaApi + public UnaryCallable insertUrlMapCallable() { + return insertUrlMapCallable; + } + + @BetaApi + public UnaryCallable + invalidateCacheUrlMapCallable() { + return invalidateCacheUrlMapCallable; + } + + @BetaApi + public UnaryCallable + listUrlMapsPagedCallable() { + return listUrlMapsPagedCallable; + } + + @BetaApi + public UnaryCallable listUrlMapsCallable() { + return listUrlMapsCallable; + } + + @BetaApi + public UnaryCallable patchUrlMapCallable() { + return patchUrlMapCallable; + } + + @BetaApi + public UnaryCallable updateUrlMapCallable() { + return updateUrlMapCallable; + } + + @BetaApi + public UnaryCallable + validateUrlMapCallable() { + return validateUrlMapCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonVpnTunnelCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonVpnTunnelCallableFactory.java new file mode 100644 index 000000000000..2d0cdcfdb55c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonVpnTunnelCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonVpnTunnelCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonVpnTunnelStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonVpnTunnelStub.java new file mode 100644 index 000000000000..f5c8756cc4a8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonVpnTunnelStub.java @@ -0,0 +1,333 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.VpnTunnelClient.AggregatedListVpnTunnelsPagedResponse; +import static com.google.cloud.compute.v1.VpnTunnelClient.ListVpnTunnelsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.AggregatedListVpnTunnelsHttpRequest; +import com.google.cloud.compute.v1.DeleteVpnTunnelHttpRequest; +import com.google.cloud.compute.v1.GetVpnTunnelHttpRequest; +import com.google.cloud.compute.v1.InsertVpnTunnelHttpRequest; +import com.google.cloud.compute.v1.ListVpnTunnelsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectRegionName; +import com.google.cloud.compute.v1.ProjectRegionVpnTunnelName; +import com.google.cloud.compute.v1.VpnTunnel; +import com.google.cloud.compute.v1.VpnTunnelAggregatedList; +import com.google.cloud.compute.v1.VpnTunnelList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonVpnTunnelStub extends VpnTunnelStub { + @InternalApi + public static final ApiMethodDescriptor< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList> + aggregatedListVpnTunnelsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("compute.vpnTunnels.aggregatedList") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/aggregated/vpnTunnels")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(VpnTunnelAggregatedList.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + deleteVpnTunnelMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.vpnTunnels.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/vpnTunnels/{vpnTunnel}")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionVpnTunnelName.newFactory()) + .setResourceNameField("vpnTunnel") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getVpnTunnelMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.vpnTunnels.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/regions/{region}/vpnTunnels/{vpnTunnel}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectRegionVpnTunnelName.newFactory()) + .setResourceNameField("vpnTunnel") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(VpnTunnel.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + insertVpnTunnelMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.vpnTunnels.insert") + .setHttpMethod(HttpMethods.POST) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions/{region}/vpnTunnels")) + .setQueryParams(Sets.newHashSet("requestId")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listVpnTunnelsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.vpnTunnels.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/regions/{region}/vpnTunnels")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectRegionName.newFactory()) + .setResourceNameField("region") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(VpnTunnelList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + aggregatedListVpnTunnelsCallable; + private final UnaryCallable< + AggregatedListVpnTunnelsHttpRequest, AggregatedListVpnTunnelsPagedResponse> + aggregatedListVpnTunnelsPagedCallable; + private final UnaryCallable deleteVpnTunnelCallable; + private final UnaryCallable getVpnTunnelCallable; + private final UnaryCallable insertVpnTunnelCallable; + private final UnaryCallable listVpnTunnelsCallable; + private final UnaryCallable + listVpnTunnelsPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonVpnTunnelStub create(VpnTunnelStubSettings settings) + throws IOException { + return new HttpJsonVpnTunnelStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonVpnTunnelStub create(ClientContext clientContext) throws IOException { + return new HttpJsonVpnTunnelStub(VpnTunnelStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonVpnTunnelStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonVpnTunnelStub( + VpnTunnelStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonVpnTunnelStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonVpnTunnelStub(VpnTunnelStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonVpnTunnelCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonVpnTunnelStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonVpnTunnelStub( + VpnTunnelStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + aggregatedListVpnTunnelsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(aggregatedListVpnTunnelsMethodDescriptor) + .build(); + HttpJsonCallSettings deleteVpnTunnelTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteVpnTunnelMethodDescriptor) + .build(); + HttpJsonCallSettings getVpnTunnelTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getVpnTunnelMethodDescriptor) + .build(); + HttpJsonCallSettings insertVpnTunnelTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(insertVpnTunnelMethodDescriptor) + .build(); + HttpJsonCallSettings listVpnTunnelsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listVpnTunnelsMethodDescriptor) + .build(); + + this.aggregatedListVpnTunnelsCallable = + callableFactory.createUnaryCallable( + aggregatedListVpnTunnelsTransportSettings, + settings.aggregatedListVpnTunnelsSettings(), + clientContext); + this.aggregatedListVpnTunnelsPagedCallable = + callableFactory.createPagedCallable( + aggregatedListVpnTunnelsTransportSettings, + settings.aggregatedListVpnTunnelsSettings(), + clientContext); + this.deleteVpnTunnelCallable = + callableFactory.createUnaryCallable( + deleteVpnTunnelTransportSettings, settings.deleteVpnTunnelSettings(), clientContext); + this.getVpnTunnelCallable = + callableFactory.createUnaryCallable( + getVpnTunnelTransportSettings, settings.getVpnTunnelSettings(), clientContext); + this.insertVpnTunnelCallable = + callableFactory.createUnaryCallable( + insertVpnTunnelTransportSettings, settings.insertVpnTunnelSettings(), clientContext); + this.listVpnTunnelsCallable = + callableFactory.createUnaryCallable( + listVpnTunnelsTransportSettings, settings.listVpnTunnelsSettings(), clientContext); + this.listVpnTunnelsPagedCallable = + callableFactory.createPagedCallable( + listVpnTunnelsTransportSettings, settings.listVpnTunnelsSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable + aggregatedListVpnTunnelsPagedCallable() { + return aggregatedListVpnTunnelsPagedCallable; + } + + @BetaApi + public UnaryCallable + aggregatedListVpnTunnelsCallable() { + return aggregatedListVpnTunnelsCallable; + } + + @BetaApi + public UnaryCallable deleteVpnTunnelCallable() { + return deleteVpnTunnelCallable; + } + + @BetaApi + public UnaryCallable getVpnTunnelCallable() { + return getVpnTunnelCallable; + } + + @BetaApi + public UnaryCallable insertVpnTunnelCallable() { + return insertVpnTunnelCallable; + } + + @BetaApi + public UnaryCallable + listVpnTunnelsPagedCallable() { + return listVpnTunnelsPagedCallable; + } + + @BetaApi + public UnaryCallable listVpnTunnelsCallable() { + return listVpnTunnelsCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneCallableFactory.java new file mode 100644 index 000000000000..03605bbea89c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonZoneCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneOperationCallableFactory.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneOperationCallableFactory.java new file mode 100644 index 000000000000..ecd6e00616c9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneOperationCallableFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP callable factory implementation for compute. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class HttpJsonZoneOperationCallableFactory implements HttpJsonStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, batchingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneOperationStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneOperationStub.java new file mode 100644 index 000000000000..76ecb0954782 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneOperationStub.java @@ -0,0 +1,247 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ZoneOperationClient.ListZoneOperationsPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.DeleteZoneOperationHttpRequest; +import com.google.cloud.compute.v1.GetZoneOperationHttpRequest; +import com.google.cloud.compute.v1.ListZoneOperationsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.OperationList; +import com.google.cloud.compute.v1.ProjectZoneName; +import com.google.cloud.compute.v1.ProjectZoneOperationName; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonZoneOperationStub extends ZoneOperationStub { + @InternalApi + public static final ApiMethodDescriptor + deleteZoneOperationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.zoneOperations.delete") + .setHttpMethod(HttpMethods.DELETE) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/operations/{operation}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneOperationName.newFactory()) + .setResourceNameField("operation") + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + getZoneOperationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.zoneOperations.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate( + PathTemplate.create("{project}/zones/{zone}/operations/{operation}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneOperationName.newFactory()) + .setResourceNameField("operation") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Operation.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listZoneOperationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.zoneOperations.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}/operations")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(OperationList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable deleteZoneOperationCallable; + private final UnaryCallable getZoneOperationCallable; + private final UnaryCallable + listZoneOperationsCallable; + private final UnaryCallable + listZoneOperationsPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonZoneOperationStub create(ZoneOperationStubSettings settings) + throws IOException { + return new HttpJsonZoneOperationStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonZoneOperationStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonZoneOperationStub( + ZoneOperationStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonZoneOperationStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonZoneOperationStub( + ZoneOperationStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonZoneOperationStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonZoneOperationStub( + ZoneOperationStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonZoneOperationCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonZoneOperationStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonZoneOperationStub( + ZoneOperationStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + deleteZoneOperationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteZoneOperationMethodDescriptor) + .build(); + HttpJsonCallSettings getZoneOperationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getZoneOperationMethodDescriptor) + .build(); + HttpJsonCallSettings + listZoneOperationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listZoneOperationsMethodDescriptor) + .build(); + + this.deleteZoneOperationCallable = + callableFactory.createUnaryCallable( + deleteZoneOperationTransportSettings, + settings.deleteZoneOperationSettings(), + clientContext); + this.getZoneOperationCallable = + callableFactory.createUnaryCallable( + getZoneOperationTransportSettings, settings.getZoneOperationSettings(), clientContext); + this.listZoneOperationsCallable = + callableFactory.createUnaryCallable( + listZoneOperationsTransportSettings, + settings.listZoneOperationsSettings(), + clientContext); + this.listZoneOperationsPagedCallable = + callableFactory.createPagedCallable( + listZoneOperationsTransportSettings, + settings.listZoneOperationsSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable deleteZoneOperationCallable() { + return deleteZoneOperationCallable; + } + + @BetaApi + public UnaryCallable getZoneOperationCallable() { + return getZoneOperationCallable; + } + + @BetaApi + public UnaryCallable + listZoneOperationsPagedCallable() { + return listZoneOperationsPagedCallable; + } + + @BetaApi + public UnaryCallable listZoneOperationsCallable() { + return listZoneOperationsCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneStub.java new file mode 100644 index 000000000000..2e5d57eedf72 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonZoneStub.java @@ -0,0 +1,199 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ZoneClient.ListZonesPagedResponse; + +import com.google.api.client.http.HttpMethods; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter; +import com.google.api.gax.httpjson.ApiMessageHttpResponseParser; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.pathtemplate.PathTemplate; +import com.google.cloud.compute.v1.GetZoneHttpRequest; +import com.google.cloud.compute.v1.ListZonesHttpRequest; +import com.google.cloud.compute.v1.ProjectName; +import com.google.cloud.compute.v1.ProjectZoneName; +import com.google.cloud.compute.v1.Zone; +import com.google.cloud.compute.v1.ZoneList; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * HTTP stub implementation for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class HttpJsonZoneStub extends ZoneStub { + @InternalApi + public static final ApiMethodDescriptor getZoneMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.zones.get") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones/{zone}")) + .setQueryParams(Sets.newHashSet()) + .setResourceNameFactory(ProjectZoneName.newFactory()) + .setResourceNameField("zone") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(Zone.getDefaultInstance()) + .build()) + .build(); + + @InternalApi + public static final ApiMethodDescriptor + listZonesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("compute.zones.list") + .setHttpMethod(HttpMethods.GET) + .setRequestFormatter( + ApiMessageHttpRequestFormatter.newBuilder() + .setPathTemplate(PathTemplate.create("{project}/zones")) + .setQueryParams( + Sets.newHashSet("filter", "maxResults", "orderBy", "pageToken")) + .setResourceNameFactory(ProjectName.newFactory()) + .setResourceNameField("project") + .build()) + .setResponseParser( + ApiMessageHttpResponseParser.newBuilder() + .setResponseInstance(ZoneList.getDefaultInstance()) + .build()) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable getZoneCallable; + private final UnaryCallable listZonesCallable; + private final UnaryCallable listZonesPagedCallable; + + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonZoneStub create(ZoneStubSettings settings) throws IOException { + return new HttpJsonZoneStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonZoneStub create(ClientContext clientContext) throws IOException { + return new HttpJsonZoneStub(ZoneStubSettings.newBuilder().build(), clientContext); + } + + public static final HttpJsonZoneStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonZoneStub( + ZoneStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonZoneStub, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected HttpJsonZoneStub(ZoneStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonZoneCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonZoneStub, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected HttpJsonZoneStub( + ZoneStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings getZoneTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getZoneMethodDescriptor) + .build(); + HttpJsonCallSettings listZonesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listZonesMethodDescriptor) + .build(); + + this.getZoneCallable = + callableFactory.createUnaryCallable( + getZoneTransportSettings, settings.getZoneSettings(), clientContext); + this.listZonesCallable = + callableFactory.createUnaryCallable( + listZonesTransportSettings, settings.listZonesSettings(), clientContext); + this.listZonesPagedCallable = + callableFactory.createPagedCallable( + listZonesTransportSettings, settings.listZonesSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi + public UnaryCallable getZoneCallable() { + return getZoneCallable; + } + + @BetaApi + public UnaryCallable listZonesPagedCallable() { + return listZonesPagedCallable; + } + + @BetaApi + public UnaryCallable listZonesCallable() { + return listZonesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpsHealthCheckStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpsHealthCheckStub.java new file mode 100644 index 000000000000..fd8c36e81bdb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpsHealthCheckStub.java @@ -0,0 +1,89 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.HttpsHealthCheckClient.ListHttpsHealthChecksPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.GetHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.HttpsHealthCheck2; +import com.google.cloud.compute.v1.HttpsHealthCheckList; +import com.google.cloud.compute.v1.InsertHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ListHttpsHealthChecksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.UpdateHttpsHealthCheckHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class HttpsHealthCheckStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + deleteHttpsHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: deleteHttpsHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable + getHttpsHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: getHttpsHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable + insertHttpsHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: insertHttpsHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable + listHttpsHealthChecksPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listHttpsHealthChecksPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listHttpsHealthChecksCallable() { + throw new UnsupportedOperationException("Not implemented: listHttpsHealthChecksCallable()"); + } + + @BetaApi + public UnaryCallable + patchHttpsHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: patchHttpsHealthCheckCallable()"); + } + + @BetaApi + public UnaryCallable + updateHttpsHealthCheckCallable() { + throw new UnsupportedOperationException("Not implemented: updateHttpsHealthCheckCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpsHealthCheckStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpsHealthCheckStubSettings.java new file mode 100644 index 000000000000..e32cc939ca47 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpsHealthCheckStubSettings.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.HttpsHealthCheckClient.ListHttpsHealthChecksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.GetHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.HttpsHealthCheck2; +import com.google.cloud.compute.v1.HttpsHealthCheckList; +import com.google.cloud.compute.v1.InsertHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.ListHttpsHealthChecksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchHttpsHealthCheckHttpRequest; +import com.google.cloud.compute.v1.UpdateHttpsHealthCheckHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link HttpsHealthCheckStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteHttpsHealthCheck to 30 seconds: + * + *

+ * 
+ * HttpsHealthCheckStubSettings.Builder httpsHealthCheckSettingsBuilder =
+ *     HttpsHealthCheckStubSettings.newBuilder();
+ * httpsHealthCheckSettingsBuilder.deleteHttpsHealthCheckSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * HttpsHealthCheckStubSettings httpsHealthCheckSettings = httpsHealthCheckSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class HttpsHealthCheckStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteHttpsHealthCheckSettings; + private final UnaryCallSettings + getHttpsHealthCheckSettings; + private final UnaryCallSettings + insertHttpsHealthCheckSettings; + private final PagedCallSettings< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, + ListHttpsHealthChecksPagedResponse> + listHttpsHealthChecksSettings; + private final UnaryCallSettings + patchHttpsHealthCheckSettings; + private final UnaryCallSettings + updateHttpsHealthCheckSettings; + + /** Returns the object with the settings used for calls to deleteHttpsHealthCheck. */ + public UnaryCallSettings + deleteHttpsHealthCheckSettings() { + return deleteHttpsHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to getHttpsHealthCheck. */ + public UnaryCallSettings + getHttpsHealthCheckSettings() { + return getHttpsHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to insertHttpsHealthCheck. */ + public UnaryCallSettings + insertHttpsHealthCheckSettings() { + return insertHttpsHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to listHttpsHealthChecks. */ + public PagedCallSettings< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, + ListHttpsHealthChecksPagedResponse> + listHttpsHealthChecksSettings() { + return listHttpsHealthChecksSettings; + } + + /** Returns the object with the settings used for calls to patchHttpsHealthCheck. */ + public UnaryCallSettings + patchHttpsHealthCheckSettings() { + return patchHttpsHealthCheckSettings; + } + + /** Returns the object with the settings used for calls to updateHttpsHealthCheck. */ + public UnaryCallSettings + updateHttpsHealthCheckSettings() { + return updateHttpsHealthCheckSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public HttpsHealthCheckStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonHttpsHealthCheckStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(HttpsHealthCheckStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected HttpsHealthCheckStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteHttpsHealthCheckSettings = settingsBuilder.deleteHttpsHealthCheckSettings().build(); + getHttpsHealthCheckSettings = settingsBuilder.getHttpsHealthCheckSettings().build(); + insertHttpsHealthCheckSettings = settingsBuilder.insertHttpsHealthCheckSettings().build(); + listHttpsHealthChecksSettings = settingsBuilder.listHttpsHealthChecksSettings().build(); + patchHttpsHealthCheckSettings = settingsBuilder.patchHttpsHealthCheckSettings().build(); + updateHttpsHealthCheckSettings = settingsBuilder.updateHttpsHealthCheckSettings().build(); + } + + private static final PagedListDescriptor< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, HttpsHealthCheck2> + LIST_HTTPS_HEALTH_CHECKS_PAGE_STR_DESC = + new PagedListDescriptor< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, HttpsHealthCheck2>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListHttpsHealthChecksHttpRequest injectToken( + ListHttpsHealthChecksHttpRequest payload, String token) { + return ListHttpsHealthChecksHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListHttpsHealthChecksHttpRequest injectPageSize( + ListHttpsHealthChecksHttpRequest payload, int pageSize) { + return ListHttpsHealthChecksHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListHttpsHealthChecksHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(HttpsHealthCheckList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(HttpsHealthCheckList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, + ListHttpsHealthChecksPagedResponse> + LIST_HTTPS_HEALTH_CHECKS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, + ListHttpsHealthChecksPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListHttpsHealthChecksHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_HTTPS_HEALTH_CHECKS_PAGE_STR_DESC, request, context); + return ListHttpsHealthChecksPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for HttpsHealthCheckStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteHttpsHealthCheckSettings; + private final UnaryCallSettings.Builder + getHttpsHealthCheckSettings; + private final UnaryCallSettings.Builder + insertHttpsHealthCheckSettings; + private final PagedCallSettings.Builder< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, + ListHttpsHealthChecksPagedResponse> + listHttpsHealthChecksSettings; + private final UnaryCallSettings.Builder + patchHttpsHealthCheckSettings; + private final UnaryCallSettings.Builder + updateHttpsHealthCheckSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteHttpsHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getHttpsHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertHttpsHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listHttpsHealthChecksSettings = + PagedCallSettings.newBuilder(LIST_HTTPS_HEALTH_CHECKS_PAGE_STR_FACT); + + patchHttpsHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateHttpsHealthCheckSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteHttpsHealthCheckSettings, + getHttpsHealthCheckSettings, + insertHttpsHealthCheckSettings, + listHttpsHealthChecksSettings, + patchHttpsHealthCheckSettings, + updateHttpsHealthCheckSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteHttpsHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getHttpsHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertHttpsHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listHttpsHealthChecksSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchHttpsHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateHttpsHealthCheckSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(HttpsHealthCheckStubSettings settings) { + super(settings); + + deleteHttpsHealthCheckSettings = settings.deleteHttpsHealthCheckSettings.toBuilder(); + getHttpsHealthCheckSettings = settings.getHttpsHealthCheckSettings.toBuilder(); + insertHttpsHealthCheckSettings = settings.insertHttpsHealthCheckSettings.toBuilder(); + listHttpsHealthChecksSettings = settings.listHttpsHealthChecksSettings.toBuilder(); + patchHttpsHealthCheckSettings = settings.patchHttpsHealthCheckSettings.toBuilder(); + updateHttpsHealthCheckSettings = settings.updateHttpsHealthCheckSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteHttpsHealthCheckSettings, + getHttpsHealthCheckSettings, + insertHttpsHealthCheckSettings, + listHttpsHealthChecksSettings, + patchHttpsHealthCheckSettings, + updateHttpsHealthCheckSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteHttpsHealthCheck. */ + public UnaryCallSettings.Builder + deleteHttpsHealthCheckSettings() { + return deleteHttpsHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to getHttpsHealthCheck. */ + public UnaryCallSettings.Builder + getHttpsHealthCheckSettings() { + return getHttpsHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to insertHttpsHealthCheck. */ + public UnaryCallSettings.Builder + insertHttpsHealthCheckSettings() { + return insertHttpsHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to listHttpsHealthChecks. */ + public PagedCallSettings.Builder< + ListHttpsHealthChecksHttpRequest, HttpsHealthCheckList, + ListHttpsHealthChecksPagedResponse> + listHttpsHealthChecksSettings() { + return listHttpsHealthChecksSettings; + } + + /** Returns the builder for the settings used for calls to patchHttpsHealthCheck. */ + public UnaryCallSettings.Builder + patchHttpsHealthCheckSettings() { + return patchHttpsHealthCheckSettings; + } + + /** Returns the builder for the settings used for calls to updateHttpsHealthCheck. */ + public UnaryCallSettings.Builder + updateHttpsHealthCheckSettings() { + return updateHttpsHealthCheckSettings; + } + + @Override + public HttpsHealthCheckStubSettings build() throws IOException { + return new HttpsHealthCheckStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ImageStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ImageStub.java new file mode 100644 index 000000000000..658201c561cc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ImageStub.java @@ -0,0 +1,87 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ImageClient.ListImagesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteImageHttpRequest; +import com.google.cloud.compute.v1.DeprecateImageHttpRequest; +import com.google.cloud.compute.v1.GetFromFamilyImageHttpRequest; +import com.google.cloud.compute.v1.GetImageHttpRequest; +import com.google.cloud.compute.v1.Image; +import com.google.cloud.compute.v1.ImageList; +import com.google.cloud.compute.v1.InsertImageHttpRequest; +import com.google.cloud.compute.v1.ListImagesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetLabelsImageHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class ImageStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteImageCallable() { + throw new UnsupportedOperationException("Not implemented: deleteImageCallable()"); + } + + @BetaApi + public UnaryCallable deprecateImageCallable() { + throw new UnsupportedOperationException("Not implemented: deprecateImageCallable()"); + } + + @BetaApi + public UnaryCallable getImageCallable() { + throw new UnsupportedOperationException("Not implemented: getImageCallable()"); + } + + @BetaApi + public UnaryCallable getFromFamilyImageCallable() { + throw new UnsupportedOperationException("Not implemented: getFromFamilyImageCallable()"); + } + + @BetaApi + public UnaryCallable insertImageCallable() { + throw new UnsupportedOperationException("Not implemented: insertImageCallable()"); + } + + @BetaApi + public UnaryCallable listImagesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listImagesPagedCallable()"); + } + + @BetaApi + public UnaryCallable listImagesCallable() { + throw new UnsupportedOperationException("Not implemented: listImagesCallable()"); + } + + @BetaApi + public UnaryCallable setLabelsImageCallable() { + throw new UnsupportedOperationException("Not implemented: setLabelsImageCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ImageStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ImageStubSettings.java new file mode 100644 index 000000000000..79e43f7cad0b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ImageStubSettings.java @@ -0,0 +1,498 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ImageClient.ListImagesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteImageHttpRequest; +import com.google.cloud.compute.v1.DeprecateImageHttpRequest; +import com.google.cloud.compute.v1.GetFromFamilyImageHttpRequest; +import com.google.cloud.compute.v1.GetImageHttpRequest; +import com.google.cloud.compute.v1.Image; +import com.google.cloud.compute.v1.ImageList; +import com.google.cloud.compute.v1.InsertImageHttpRequest; +import com.google.cloud.compute.v1.ListImagesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetLabelsImageHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link ImageStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteImage to 30 seconds: + * + *

+ * 
+ * ImageStubSettings.Builder imageSettingsBuilder =
+ *     ImageStubSettings.newBuilder();
+ * imageSettingsBuilder.deleteImageSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * ImageStubSettings imageSettings = imageSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ImageStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings deleteImageSettings; + private final UnaryCallSettings deprecateImageSettings; + private final UnaryCallSettings getImageSettings; + private final UnaryCallSettings getFromFamilyImageSettings; + private final UnaryCallSettings insertImageSettings; + private final PagedCallSettings + listImagesSettings; + private final UnaryCallSettings setLabelsImageSettings; + + /** Returns the object with the settings used for calls to deleteImage. */ + public UnaryCallSettings deleteImageSettings() { + return deleteImageSettings; + } + + /** Returns the object with the settings used for calls to deprecateImage. */ + public UnaryCallSettings deprecateImageSettings() { + return deprecateImageSettings; + } + + /** Returns the object with the settings used for calls to getImage. */ + public UnaryCallSettings getImageSettings() { + return getImageSettings; + } + + /** Returns the object with the settings used for calls to getFromFamilyImage. */ + public UnaryCallSettings getFromFamilyImageSettings() { + return getFromFamilyImageSettings; + } + + /** Returns the object with the settings used for calls to insertImage. */ + public UnaryCallSettings insertImageSettings() { + return insertImageSettings; + } + + /** Returns the object with the settings used for calls to listImages. */ + public PagedCallSettings + listImagesSettings() { + return listImagesSettings; + } + + /** Returns the object with the settings used for calls to setLabelsImage. */ + public UnaryCallSettings setLabelsImageSettings() { + return setLabelsImageSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ImageStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonImageStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(ImageStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ImageStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteImageSettings = settingsBuilder.deleteImageSettings().build(); + deprecateImageSettings = settingsBuilder.deprecateImageSettings().build(); + getImageSettings = settingsBuilder.getImageSettings().build(); + getFromFamilyImageSettings = settingsBuilder.getFromFamilyImageSettings().build(); + insertImageSettings = settingsBuilder.insertImageSettings().build(); + listImagesSettings = settingsBuilder.listImagesSettings().build(); + setLabelsImageSettings = settingsBuilder.setLabelsImageSettings().build(); + } + + private static final PagedListDescriptor + LIST_IMAGES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListImagesHttpRequest injectToken(ListImagesHttpRequest payload, String token) { + return ListImagesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListImagesHttpRequest injectPageSize( + ListImagesHttpRequest payload, int pageSize) { + return ListImagesHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListImagesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(ImageList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ImageList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListImagesHttpRequest, ImageList, ListImagesPagedResponse> + LIST_IMAGES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListImagesHttpRequest, ImageList, ListImagesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListImagesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_IMAGES_PAGE_STR_DESC, request, context); + return ListImagesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for ImageStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder deleteImageSettings; + private final UnaryCallSettings.Builder + deprecateImageSettings; + private final UnaryCallSettings.Builder getImageSettings; + private final UnaryCallSettings.Builder + getFromFamilyImageSettings; + private final UnaryCallSettings.Builder insertImageSettings; + private final PagedCallSettings.Builder< + ListImagesHttpRequest, ImageList, ListImagesPagedResponse> + listImagesSettings; + private final UnaryCallSettings.Builder + setLabelsImageSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteImageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deprecateImageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getImageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getFromFamilyImageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertImageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listImagesSettings = PagedCallSettings.newBuilder(LIST_IMAGES_PAGE_STR_FACT); + + setLabelsImageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteImageSettings, + deprecateImageSettings, + getImageSettings, + getFromFamilyImageSettings, + insertImageSettings, + listImagesSettings, + setLabelsImageSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteImageSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deprecateImageSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getImageSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getFromFamilyImageSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertImageSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listImagesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setLabelsImageSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(ImageStubSettings settings) { + super(settings); + + deleteImageSettings = settings.deleteImageSettings.toBuilder(); + deprecateImageSettings = settings.deprecateImageSettings.toBuilder(); + getImageSettings = settings.getImageSettings.toBuilder(); + getFromFamilyImageSettings = settings.getFromFamilyImageSettings.toBuilder(); + insertImageSettings = settings.insertImageSettings.toBuilder(); + listImagesSettings = settings.listImagesSettings.toBuilder(); + setLabelsImageSettings = settings.setLabelsImageSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteImageSettings, + deprecateImageSettings, + getImageSettings, + getFromFamilyImageSettings, + insertImageSettings, + listImagesSettings, + setLabelsImageSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteImage. */ + public UnaryCallSettings.Builder deleteImageSettings() { + return deleteImageSettings; + } + + /** Returns the builder for the settings used for calls to deprecateImage. */ + public UnaryCallSettings.Builder + deprecateImageSettings() { + return deprecateImageSettings; + } + + /** Returns the builder for the settings used for calls to getImage. */ + public UnaryCallSettings.Builder getImageSettings() { + return getImageSettings; + } + + /** Returns the builder for the settings used for calls to getFromFamilyImage. */ + public UnaryCallSettings.Builder + getFromFamilyImageSettings() { + return getFromFamilyImageSettings; + } + + /** Returns the builder for the settings used for calls to insertImage. */ + public UnaryCallSettings.Builder insertImageSettings() { + return insertImageSettings; + } + + /** Returns the builder for the settings used for calls to listImages. */ + public PagedCallSettings.Builder + listImagesSettings() { + return listImagesSettings; + } + + /** Returns the builder for the settings used for calls to setLabelsImage. */ + public UnaryCallSettings.Builder + setLabelsImageSettings() { + return setLabelsImageSettings; + } + + @Override + public ImageStubSettings build() throws IOException { + return new ImageStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupManagerStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupManagerStub.java new file mode 100644 index 000000000000..335298698f64 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupManagerStub.java @@ -0,0 +1,156 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AbandonInstancesInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.AggregatedListInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.DeleteInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.DeleteInstancesInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.GetInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InstanceGroupManager; +import com.google.cloud.compute.v1.InstanceGroupManagerAggregatedList; +import com.google.cloud.compute.v1.InstanceGroupManagerList; +import com.google.cloud.compute.v1.InstanceGroupManagersListManagedInstancesResponse; +import com.google.cloud.compute.v1.ListInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.ListManagedInstancesInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.RecreateInstancesInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.ResizeInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetInstanceTemplateInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetTargetPoolsInstanceGroupManagerHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class InstanceGroupManagerStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + abandonInstancesInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: abandonInstancesInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable< + AggregatedListInstanceGroupManagersHttpRequest, + AggregatedListInstanceGroupManagersPagedResponse> + aggregatedListInstanceGroupManagersPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListInstanceGroupManagersPagedCallable()"); + } + + @BetaApi + public UnaryCallable< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList> + aggregatedListInstanceGroupManagersCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListInstanceGroupManagersCallable()"); + } + + @BetaApi + public UnaryCallable + deleteInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: deleteInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + deleteInstancesInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: deleteInstancesInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + getInstanceGroupManagerCallable() { + throw new UnsupportedOperationException("Not implemented: getInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + insertInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: insertInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + listInstanceGroupManagersPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInstanceGroupManagersPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listInstanceGroupManagersCallable() { + throw new UnsupportedOperationException("Not implemented: listInstanceGroupManagersCallable()"); + } + + @BetaApi + public UnaryCallable< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersCallable() { + throw new UnsupportedOperationException( + "Not implemented: listManagedInstancesInstanceGroupManagersCallable()"); + } + + @BetaApi + public UnaryCallable + recreateInstancesInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: recreateInstancesInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + resizeInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: resizeInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + setInstanceTemplateInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: setInstanceTemplateInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + setTargetPoolsInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: setTargetPoolsInstanceGroupManagerCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupManagerStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupManagerStubSettings.java new file mode 100644 index 000000000000..44a165ecc5c1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupManagerStubSettings.java @@ -0,0 +1,833 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AbandonInstancesInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.AggregatedListInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.DeleteInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.DeleteInstancesInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.GetInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InstanceGroupManager; +import com.google.cloud.compute.v1.InstanceGroupManagerAggregatedList; +import com.google.cloud.compute.v1.InstanceGroupManagerList; +import com.google.cloud.compute.v1.InstanceGroupManagersListManagedInstancesResponse; +import com.google.cloud.compute.v1.InstanceGroupManagersScopedList; +import com.google.cloud.compute.v1.ListInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.ListManagedInstancesInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.RecreateInstancesInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.ResizeInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetInstanceTemplateInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetTargetPoolsInstanceGroupManagerHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InstanceGroupManagerStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of abandonInstancesInstanceGroupManager to 30 seconds: + * + *

+ * 
+ * InstanceGroupManagerStubSettings.Builder instanceGroupManagerSettingsBuilder =
+ *     InstanceGroupManagerStubSettings.newBuilder();
+ * instanceGroupManagerSettingsBuilder.abandonInstancesInstanceGroupManagerSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InstanceGroupManagerStubSettings instanceGroupManagerSettings = instanceGroupManagerSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceGroupManagerStubSettings + extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + abandonInstancesInstanceGroupManagerSettings; + private final PagedCallSettings< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + AggregatedListInstanceGroupManagersPagedResponse> + aggregatedListInstanceGroupManagersSettings; + private final UnaryCallSettings + deleteInstanceGroupManagerSettings; + private final UnaryCallSettings + deleteInstancesInstanceGroupManagerSettings; + private final UnaryCallSettings + getInstanceGroupManagerSettings; + private final UnaryCallSettings + insertInstanceGroupManagerSettings; + private final PagedCallSettings< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + ListInstanceGroupManagersPagedResponse> + listInstanceGroupManagersSettings; + private final UnaryCallSettings< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersSettings; + private final UnaryCallSettings + recreateInstancesInstanceGroupManagerSettings; + private final UnaryCallSettings + resizeInstanceGroupManagerSettings; + private final UnaryCallSettings + setInstanceTemplateInstanceGroupManagerSettings; + private final UnaryCallSettings + setTargetPoolsInstanceGroupManagerSettings; + + /** + * Returns the object with the settings used for calls to abandonInstancesInstanceGroupManager. + */ + public UnaryCallSettings + abandonInstancesInstanceGroupManagerSettings() { + return abandonInstancesInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to aggregatedListInstanceGroupManagers. */ + public PagedCallSettings< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + AggregatedListInstanceGroupManagersPagedResponse> + aggregatedListInstanceGroupManagersSettings() { + return aggregatedListInstanceGroupManagersSettings; + } + + /** Returns the object with the settings used for calls to deleteInstanceGroupManager. */ + public UnaryCallSettings + deleteInstanceGroupManagerSettings() { + return deleteInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to deleteInstancesInstanceGroupManager. */ + public UnaryCallSettings + deleteInstancesInstanceGroupManagerSettings() { + return deleteInstancesInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to getInstanceGroupManager. */ + public UnaryCallSettings + getInstanceGroupManagerSettings() { + return getInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to insertInstanceGroupManager. */ + public UnaryCallSettings + insertInstanceGroupManagerSettings() { + return insertInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to listInstanceGroupManagers. */ + public PagedCallSettings< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + ListInstanceGroupManagersPagedResponse> + listInstanceGroupManagersSettings() { + return listInstanceGroupManagersSettings; + } + + /** + * Returns the object with the settings used for calls to + * listManagedInstancesInstanceGroupManagers. + */ + public UnaryCallSettings< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersSettings() { + return listManagedInstancesInstanceGroupManagersSettings; + } + + /** + * Returns the object with the settings used for calls to recreateInstancesInstanceGroupManager. + */ + public UnaryCallSettings + recreateInstancesInstanceGroupManagerSettings() { + return recreateInstancesInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to resizeInstanceGroupManager. */ + public UnaryCallSettings + resizeInstanceGroupManagerSettings() { + return resizeInstanceGroupManagerSettings; + } + + /** + * Returns the object with the settings used for calls to setInstanceTemplateInstanceGroupManager. + */ + public UnaryCallSettings + setInstanceTemplateInstanceGroupManagerSettings() { + return setInstanceTemplateInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to setTargetPoolsInstanceGroupManager. */ + public UnaryCallSettings + setTargetPoolsInstanceGroupManagerSettings() { + return setTargetPoolsInstanceGroupManagerSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InstanceGroupManagerStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonInstanceGroupManagerStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(InstanceGroupManagerStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InstanceGroupManagerStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + abandonInstancesInstanceGroupManagerSettings = + settingsBuilder.abandonInstancesInstanceGroupManagerSettings().build(); + aggregatedListInstanceGroupManagersSettings = + settingsBuilder.aggregatedListInstanceGroupManagersSettings().build(); + deleteInstanceGroupManagerSettings = + settingsBuilder.deleteInstanceGroupManagerSettings().build(); + deleteInstancesInstanceGroupManagerSettings = + settingsBuilder.deleteInstancesInstanceGroupManagerSettings().build(); + getInstanceGroupManagerSettings = settingsBuilder.getInstanceGroupManagerSettings().build(); + insertInstanceGroupManagerSettings = + settingsBuilder.insertInstanceGroupManagerSettings().build(); + listInstanceGroupManagersSettings = settingsBuilder.listInstanceGroupManagersSettings().build(); + listManagedInstancesInstanceGroupManagersSettings = + settingsBuilder.listManagedInstancesInstanceGroupManagersSettings().build(); + recreateInstancesInstanceGroupManagerSettings = + settingsBuilder.recreateInstancesInstanceGroupManagerSettings().build(); + resizeInstanceGroupManagerSettings = + settingsBuilder.resizeInstanceGroupManagerSettings().build(); + setInstanceTemplateInstanceGroupManagerSettings = + settingsBuilder.setInstanceTemplateInstanceGroupManagerSettings().build(); + setTargetPoolsInstanceGroupManagerSettings = + settingsBuilder.setTargetPoolsInstanceGroupManagerSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + InstanceGroupManagersScopedList> + AGGREGATED_LIST_INSTANCE_GROUP_MANAGERS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + InstanceGroupManagersScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListInstanceGroupManagersHttpRequest injectToken( + AggregatedListInstanceGroupManagersHttpRequest payload, String token) { + return AggregatedListInstanceGroupManagersHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListInstanceGroupManagersHttpRequest injectPageSize( + AggregatedListInstanceGroupManagersHttpRequest payload, int pageSize) { + return AggregatedListInstanceGroupManagersHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListInstanceGroupManagersHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InstanceGroupManagerAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + InstanceGroupManagerAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, InstanceGroupManager> + LIST_INSTANCE_GROUP_MANAGERS_PAGE_STR_DESC = + new PagedListDescriptor< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + InstanceGroupManager>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInstanceGroupManagersHttpRequest injectToken( + ListInstanceGroupManagersHttpRequest payload, String token) { + return ListInstanceGroupManagersHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListInstanceGroupManagersHttpRequest injectPageSize( + ListInstanceGroupManagersHttpRequest payload, int pageSize) { + return ListInstanceGroupManagersHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListInstanceGroupManagersHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InstanceGroupManagerList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + InstanceGroupManagerList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + AggregatedListInstanceGroupManagersPagedResponse> + AGGREGATED_LIST_INSTANCE_GROUP_MANAGERS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + AggregatedListInstanceGroupManagersPagedResponse>() { + @Override + public ApiFuture + getFuturePagedResponse( + UnaryCallable< + AggregatedListInstanceGroupManagersHttpRequest, + InstanceGroupManagerAggregatedList> + callable, + AggregatedListInstanceGroupManagersHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListInstanceGroupManagersHttpRequest, + InstanceGroupManagerAggregatedList, InstanceGroupManagersScopedList> + pageContext = + PageContext.create( + callable, + AGGREGATED_LIST_INSTANCE_GROUP_MANAGERS_PAGE_STR_DESC, + request, + context); + return AggregatedListInstanceGroupManagersPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + ListInstanceGroupManagersPagedResponse> + LIST_INSTANCE_GROUP_MANAGERS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + ListInstanceGroupManagersPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListInstanceGroupManagersHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + InstanceGroupManager> + pageContext = + PageContext.create( + callable, LIST_INSTANCE_GROUP_MANAGERS_PAGE_STR_DESC, request, context); + return ListInstanceGroupManagersPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + /** Builder for InstanceGroupManagerStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder< + AbandonInstancesInstanceGroupManagerHttpRequest, Operation> + abandonInstancesInstanceGroupManagerSettings; + private final PagedCallSettings.Builder< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + AggregatedListInstanceGroupManagersPagedResponse> + aggregatedListInstanceGroupManagersSettings; + private final UnaryCallSettings.Builder + deleteInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder< + DeleteInstancesInstanceGroupManagerHttpRequest, Operation> + deleteInstancesInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder< + GetInstanceGroupManagerHttpRequest, InstanceGroupManager> + getInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder + insertInstanceGroupManagerSettings; + private final PagedCallSettings.Builder< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + ListInstanceGroupManagersPagedResponse> + listInstanceGroupManagersSettings; + private final UnaryCallSettings.Builder< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersSettings; + private final UnaryCallSettings.Builder< + RecreateInstancesInstanceGroupManagerHttpRequest, Operation> + recreateInstancesInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder + resizeInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder< + SetInstanceTemplateInstanceGroupManagerHttpRequest, Operation> + setInstanceTemplateInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder< + SetTargetPoolsInstanceGroupManagerHttpRequest, Operation> + setTargetPoolsInstanceGroupManagerSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + abandonInstancesInstanceGroupManagerSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + aggregatedListInstanceGroupManagersSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_INSTANCE_GROUP_MANAGERS_PAGE_STR_FACT); + + deleteInstanceGroupManagerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteInstancesInstanceGroupManagerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getInstanceGroupManagerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertInstanceGroupManagerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listInstanceGroupManagersSettings = + PagedCallSettings.newBuilder(LIST_INSTANCE_GROUP_MANAGERS_PAGE_STR_FACT); + + listManagedInstancesInstanceGroupManagersSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + recreateInstancesInstanceGroupManagerSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + resizeInstanceGroupManagerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setInstanceTemplateInstanceGroupManagerSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setTargetPoolsInstanceGroupManagerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + abandonInstancesInstanceGroupManagerSettings, + aggregatedListInstanceGroupManagersSettings, + deleteInstanceGroupManagerSettings, + deleteInstancesInstanceGroupManagerSettings, + getInstanceGroupManagerSettings, + insertInstanceGroupManagerSettings, + listInstanceGroupManagersSettings, + listManagedInstancesInstanceGroupManagersSettings, + recreateInstancesInstanceGroupManagerSettings, + resizeInstanceGroupManagerSettings, + setInstanceTemplateInstanceGroupManagerSettings, + setTargetPoolsInstanceGroupManagerSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .abandonInstancesInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .aggregatedListInstanceGroupManagersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteInstancesInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listInstanceGroupManagersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listManagedInstancesInstanceGroupManagersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .recreateInstancesInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .resizeInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setInstanceTemplateInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setTargetPoolsInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(InstanceGroupManagerStubSettings settings) { + super(settings); + + abandonInstancesInstanceGroupManagerSettings = + settings.abandonInstancesInstanceGroupManagerSettings.toBuilder(); + aggregatedListInstanceGroupManagersSettings = + settings.aggregatedListInstanceGroupManagersSettings.toBuilder(); + deleteInstanceGroupManagerSettings = settings.deleteInstanceGroupManagerSettings.toBuilder(); + deleteInstancesInstanceGroupManagerSettings = + settings.deleteInstancesInstanceGroupManagerSettings.toBuilder(); + getInstanceGroupManagerSettings = settings.getInstanceGroupManagerSettings.toBuilder(); + insertInstanceGroupManagerSettings = settings.insertInstanceGroupManagerSettings.toBuilder(); + listInstanceGroupManagersSettings = settings.listInstanceGroupManagersSettings.toBuilder(); + listManagedInstancesInstanceGroupManagersSettings = + settings.listManagedInstancesInstanceGroupManagersSettings.toBuilder(); + recreateInstancesInstanceGroupManagerSettings = + settings.recreateInstancesInstanceGroupManagerSettings.toBuilder(); + resizeInstanceGroupManagerSettings = settings.resizeInstanceGroupManagerSettings.toBuilder(); + setInstanceTemplateInstanceGroupManagerSettings = + settings.setInstanceTemplateInstanceGroupManagerSettings.toBuilder(); + setTargetPoolsInstanceGroupManagerSettings = + settings.setTargetPoolsInstanceGroupManagerSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + abandonInstancesInstanceGroupManagerSettings, + aggregatedListInstanceGroupManagersSettings, + deleteInstanceGroupManagerSettings, + deleteInstancesInstanceGroupManagerSettings, + getInstanceGroupManagerSettings, + insertInstanceGroupManagerSettings, + listInstanceGroupManagersSettings, + listManagedInstancesInstanceGroupManagersSettings, + recreateInstancesInstanceGroupManagerSettings, + resizeInstanceGroupManagerSettings, + setInstanceTemplateInstanceGroupManagerSettings, + setTargetPoolsInstanceGroupManagerSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** + * Returns the builder for the settings used for calls to abandonInstancesInstanceGroupManager. + */ + public UnaryCallSettings.Builder + abandonInstancesInstanceGroupManagerSettings() { + return abandonInstancesInstanceGroupManagerSettings; + } + + /** + * Returns the builder for the settings used for calls to aggregatedListInstanceGroupManagers. + */ + public PagedCallSettings.Builder< + AggregatedListInstanceGroupManagersHttpRequest, InstanceGroupManagerAggregatedList, + AggregatedListInstanceGroupManagersPagedResponse> + aggregatedListInstanceGroupManagersSettings() { + return aggregatedListInstanceGroupManagersSettings; + } + + /** Returns the builder for the settings used for calls to deleteInstanceGroupManager. */ + public UnaryCallSettings.Builder + deleteInstanceGroupManagerSettings() { + return deleteInstanceGroupManagerSettings; + } + + /** + * Returns the builder for the settings used for calls to deleteInstancesInstanceGroupManager. + */ + public UnaryCallSettings.Builder + deleteInstancesInstanceGroupManagerSettings() { + return deleteInstancesInstanceGroupManagerSettings; + } + + /** Returns the builder for the settings used for calls to getInstanceGroupManager. */ + public UnaryCallSettings.Builder + getInstanceGroupManagerSettings() { + return getInstanceGroupManagerSettings; + } + + /** Returns the builder for the settings used for calls to insertInstanceGroupManager. */ + public UnaryCallSettings.Builder + insertInstanceGroupManagerSettings() { + return insertInstanceGroupManagerSettings; + } + + /** Returns the builder for the settings used for calls to listInstanceGroupManagers. */ + public PagedCallSettings.Builder< + ListInstanceGroupManagersHttpRequest, InstanceGroupManagerList, + ListInstanceGroupManagersPagedResponse> + listInstanceGroupManagersSettings() { + return listInstanceGroupManagersSettings; + } + + /** + * Returns the builder for the settings used for calls to + * listManagedInstancesInstanceGroupManagers. + */ + public UnaryCallSettings.Builder< + ListManagedInstancesInstanceGroupManagersHttpRequest, + InstanceGroupManagersListManagedInstancesResponse> + listManagedInstancesInstanceGroupManagersSettings() { + return listManagedInstancesInstanceGroupManagersSettings; + } + + /** + * Returns the builder for the settings used for calls to recreateInstancesInstanceGroupManager. + */ + public UnaryCallSettings.Builder + recreateInstancesInstanceGroupManagerSettings() { + return recreateInstancesInstanceGroupManagerSettings; + } + + /** Returns the builder for the settings used for calls to resizeInstanceGroupManager. */ + public UnaryCallSettings.Builder + resizeInstanceGroupManagerSettings() { + return resizeInstanceGroupManagerSettings; + } + + /** + * Returns the builder for the settings used for calls to + * setInstanceTemplateInstanceGroupManager. + */ + public UnaryCallSettings.Builder + setInstanceTemplateInstanceGroupManagerSettings() { + return setInstanceTemplateInstanceGroupManagerSettings; + } + + /** + * Returns the builder for the settings used for calls to setTargetPoolsInstanceGroupManager. + */ + public UnaryCallSettings.Builder + setTargetPoolsInstanceGroupManagerSettings() { + return setTargetPoolsInstanceGroupManagerSettings; + } + + @Override + public InstanceGroupManagerStubSettings build() throws IOException { + return new InstanceGroupManagerStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupStub.java new file mode 100644 index 000000000000..077ebf34ec5c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupStub.java @@ -0,0 +1,130 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceGroupClient.AggregatedListInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupClient.ListInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupClient.ListInstancesInstanceGroupsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AddInstancesInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.AggregatedListInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.DeleteInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.GetInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.InstanceGroup; +import com.google.cloud.compute.v1.InstanceGroupAggregatedList; +import com.google.cloud.compute.v1.InstanceGroupList; +import com.google.cloud.compute.v1.InstanceGroupsListInstances; +import com.google.cloud.compute.v1.ListInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.ListInstancesInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.RemoveInstancesInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.SetNamedPortsInstanceGroupHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class InstanceGroupStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + addInstancesInstanceGroupCallable() { + throw new UnsupportedOperationException("Not implemented: addInstancesInstanceGroupCallable()"); + } + + @BetaApi + public UnaryCallable< + AggregatedListInstanceGroupsHttpRequest, AggregatedListInstanceGroupsPagedResponse> + aggregatedListInstanceGroupsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListInstanceGroupsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListInstanceGroupsCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListInstanceGroupsCallable()"); + } + + @BetaApi + public UnaryCallable deleteInstanceGroupCallable() { + throw new UnsupportedOperationException("Not implemented: deleteInstanceGroupCallable()"); + } + + @BetaApi + public UnaryCallable getInstanceGroupCallable() { + throw new UnsupportedOperationException("Not implemented: getInstanceGroupCallable()"); + } + + @BetaApi + public UnaryCallable insertInstanceGroupCallable() { + throw new UnsupportedOperationException("Not implemented: insertInstanceGroupCallable()"); + } + + @BetaApi + public UnaryCallable + listInstanceGroupsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listInstanceGroupsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listInstanceGroupsCallable() { + throw new UnsupportedOperationException("Not implemented: listInstanceGroupsCallable()"); + } + + @BetaApi + public UnaryCallable< + ListInstancesInstanceGroupsHttpRequest, ListInstancesInstanceGroupsPagedResponse> + listInstancesInstanceGroupsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInstancesInstanceGroupsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listInstancesInstanceGroupsCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInstancesInstanceGroupsCallable()"); + } + + @BetaApi + public UnaryCallable + removeInstancesInstanceGroupCallable() { + throw new UnsupportedOperationException( + "Not implemented: removeInstancesInstanceGroupCallable()"); + } + + @BetaApi + public UnaryCallable + setNamedPortsInstanceGroupCallable() { + throw new UnsupportedOperationException( + "Not implemented: setNamedPortsInstanceGroupCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupStubSettings.java new file mode 100644 index 000000000000..320cad8331f7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceGroupStubSettings.java @@ -0,0 +1,756 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceGroupClient.AggregatedListInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupClient.ListInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupClient.ListInstancesInstanceGroupsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AddInstancesInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.AggregatedListInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.DeleteInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.GetInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.InstanceGroup; +import com.google.cloud.compute.v1.InstanceGroupAggregatedList; +import com.google.cloud.compute.v1.InstanceGroupList; +import com.google.cloud.compute.v1.InstanceGroupsListInstances; +import com.google.cloud.compute.v1.InstanceGroupsScopedList; +import com.google.cloud.compute.v1.InstanceWithNamedPorts; +import com.google.cloud.compute.v1.ListInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.ListInstancesInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.RemoveInstancesInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.SetNamedPortsInstanceGroupHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InstanceGroupStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of addInstancesInstanceGroup to 30 seconds: + * + *

+ * 
+ * InstanceGroupStubSettings.Builder instanceGroupSettingsBuilder =
+ *     InstanceGroupStubSettings.newBuilder();
+ * instanceGroupSettingsBuilder.addInstancesInstanceGroupSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InstanceGroupStubSettings instanceGroupSettings = instanceGroupSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceGroupStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + addInstancesInstanceGroupSettings; + private final PagedCallSettings< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + AggregatedListInstanceGroupsPagedResponse> + aggregatedListInstanceGroupsSettings; + private final UnaryCallSettings + deleteInstanceGroupSettings; + private final UnaryCallSettings + getInstanceGroupSettings; + private final UnaryCallSettings + insertInstanceGroupSettings; + private final PagedCallSettings< + ListInstanceGroupsHttpRequest, InstanceGroupList, ListInstanceGroupsPagedResponse> + listInstanceGroupsSettings; + private final PagedCallSettings< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + ListInstancesInstanceGroupsPagedResponse> + listInstancesInstanceGroupsSettings; + private final UnaryCallSettings + removeInstancesInstanceGroupSettings; + private final UnaryCallSettings + setNamedPortsInstanceGroupSettings; + + /** Returns the object with the settings used for calls to addInstancesInstanceGroup. */ + public UnaryCallSettings + addInstancesInstanceGroupSettings() { + return addInstancesInstanceGroupSettings; + } + + /** Returns the object with the settings used for calls to aggregatedListInstanceGroups. */ + public PagedCallSettings< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + AggregatedListInstanceGroupsPagedResponse> + aggregatedListInstanceGroupsSettings() { + return aggregatedListInstanceGroupsSettings; + } + + /** Returns the object with the settings used for calls to deleteInstanceGroup. */ + public UnaryCallSettings + deleteInstanceGroupSettings() { + return deleteInstanceGroupSettings; + } + + /** Returns the object with the settings used for calls to getInstanceGroup. */ + public UnaryCallSettings getInstanceGroupSettings() { + return getInstanceGroupSettings; + } + + /** Returns the object with the settings used for calls to insertInstanceGroup. */ + public UnaryCallSettings + insertInstanceGroupSettings() { + return insertInstanceGroupSettings; + } + + /** Returns the object with the settings used for calls to listInstanceGroups. */ + public PagedCallSettings< + ListInstanceGroupsHttpRequest, InstanceGroupList, ListInstanceGroupsPagedResponse> + listInstanceGroupsSettings() { + return listInstanceGroupsSettings; + } + + /** Returns the object with the settings used for calls to listInstancesInstanceGroups. */ + public PagedCallSettings< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + ListInstancesInstanceGroupsPagedResponse> + listInstancesInstanceGroupsSettings() { + return listInstancesInstanceGroupsSettings; + } + + /** Returns the object with the settings used for calls to removeInstancesInstanceGroup. */ + public UnaryCallSettings + removeInstancesInstanceGroupSettings() { + return removeInstancesInstanceGroupSettings; + } + + /** Returns the object with the settings used for calls to setNamedPortsInstanceGroup. */ + public UnaryCallSettings + setNamedPortsInstanceGroupSettings() { + return setNamedPortsInstanceGroupSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InstanceGroupStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonInstanceGroupStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(InstanceGroupStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InstanceGroupStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + addInstancesInstanceGroupSettings = settingsBuilder.addInstancesInstanceGroupSettings().build(); + aggregatedListInstanceGroupsSettings = + settingsBuilder.aggregatedListInstanceGroupsSettings().build(); + deleteInstanceGroupSettings = settingsBuilder.deleteInstanceGroupSettings().build(); + getInstanceGroupSettings = settingsBuilder.getInstanceGroupSettings().build(); + insertInstanceGroupSettings = settingsBuilder.insertInstanceGroupSettings().build(); + listInstanceGroupsSettings = settingsBuilder.listInstanceGroupsSettings().build(); + listInstancesInstanceGroupsSettings = + settingsBuilder.listInstancesInstanceGroupsSettings().build(); + removeInstancesInstanceGroupSettings = + settingsBuilder.removeInstancesInstanceGroupSettings().build(); + setNamedPortsInstanceGroupSettings = + settingsBuilder.setNamedPortsInstanceGroupSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + InstanceGroupsScopedList> + AGGREGATED_LIST_INSTANCE_GROUPS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + InstanceGroupsScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListInstanceGroupsHttpRequest injectToken( + AggregatedListInstanceGroupsHttpRequest payload, String token) { + return AggregatedListInstanceGroupsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListInstanceGroupsHttpRequest injectPageSize( + AggregatedListInstanceGroupsHttpRequest payload, int pageSize) { + return AggregatedListInstanceGroupsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListInstanceGroupsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InstanceGroupAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + InstanceGroupAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor< + ListInstanceGroupsHttpRequest, InstanceGroupList, InstanceGroup> + LIST_INSTANCE_GROUPS_PAGE_STR_DESC = + new PagedListDescriptor< + ListInstanceGroupsHttpRequest, InstanceGroupList, InstanceGroup>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInstanceGroupsHttpRequest injectToken( + ListInstanceGroupsHttpRequest payload, String token) { + return ListInstanceGroupsHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListInstanceGroupsHttpRequest injectPageSize( + ListInstanceGroupsHttpRequest payload, int pageSize) { + return ListInstanceGroupsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListInstanceGroupsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InstanceGroupList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(InstanceGroupList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListDescriptor< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + InstanceWithNamedPorts> + LIST_INSTANCES_INSTANCE_GROUPS_PAGE_STR_DESC = + new PagedListDescriptor< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + InstanceWithNamedPorts>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInstancesInstanceGroupsHttpRequest injectToken( + ListInstancesInstanceGroupsHttpRequest payload, String token) { + return ListInstancesInstanceGroupsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListInstancesInstanceGroupsHttpRequest injectPageSize( + ListInstancesInstanceGroupsHttpRequest payload, int pageSize) { + return ListInstancesInstanceGroupsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListInstancesInstanceGroupsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InstanceGroupsListInstances payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + InstanceGroupsListInstances payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + AggregatedListInstanceGroupsPagedResponse> + AGGREGATED_LIST_INSTANCE_GROUPS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + AggregatedListInstanceGroupsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + AggregatedListInstanceGroupsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + InstanceGroupsScopedList> + pageContext = + PageContext.create( + callable, + AGGREGATED_LIST_INSTANCE_GROUPS_PAGE_STR_DESC, + request, + context); + return AggregatedListInstanceGroupsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListInstanceGroupsHttpRequest, InstanceGroupList, ListInstanceGroupsPagedResponse> + LIST_INSTANCE_GROUPS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInstanceGroupsHttpRequest, InstanceGroupList, ListInstanceGroupsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListInstanceGroupsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_INSTANCE_GROUPS_PAGE_STR_DESC, request, context); + return ListInstanceGroupsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + ListInstancesInstanceGroupsPagedResponse> + LIST_INSTANCES_INSTANCE_GROUPS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + ListInstancesInstanceGroupsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListInstancesInstanceGroupsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + InstanceWithNamedPorts> + pageContext = + PageContext.create( + callable, LIST_INSTANCES_INSTANCE_GROUPS_PAGE_STR_DESC, request, context); + return ListInstancesInstanceGroupsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + /** Builder for InstanceGroupStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + addInstancesInstanceGroupSettings; + private final PagedCallSettings.Builder< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + AggregatedListInstanceGroupsPagedResponse> + aggregatedListInstanceGroupsSettings; + private final UnaryCallSettings.Builder + deleteInstanceGroupSettings; + private final UnaryCallSettings.Builder + getInstanceGroupSettings; + private final UnaryCallSettings.Builder + insertInstanceGroupSettings; + private final PagedCallSettings.Builder< + ListInstanceGroupsHttpRequest, InstanceGroupList, ListInstanceGroupsPagedResponse> + listInstanceGroupsSettings; + private final PagedCallSettings.Builder< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + ListInstancesInstanceGroupsPagedResponse> + listInstancesInstanceGroupsSettings; + private final UnaryCallSettings.Builder + removeInstancesInstanceGroupSettings; + private final UnaryCallSettings.Builder + setNamedPortsInstanceGroupSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + addInstancesInstanceGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + aggregatedListInstanceGroupsSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_INSTANCE_GROUPS_PAGE_STR_FACT); + + deleteInstanceGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getInstanceGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertInstanceGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listInstanceGroupsSettings = PagedCallSettings.newBuilder(LIST_INSTANCE_GROUPS_PAGE_STR_FACT); + + listInstancesInstanceGroupsSettings = + PagedCallSettings.newBuilder(LIST_INSTANCES_INSTANCE_GROUPS_PAGE_STR_FACT); + + removeInstancesInstanceGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setNamedPortsInstanceGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + addInstancesInstanceGroupSettings, + aggregatedListInstanceGroupsSettings, + deleteInstanceGroupSettings, + getInstanceGroupSettings, + insertInstanceGroupSettings, + listInstanceGroupsSettings, + listInstancesInstanceGroupsSettings, + removeInstancesInstanceGroupSettings, + setNamedPortsInstanceGroupSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .addInstancesInstanceGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .aggregatedListInstanceGroupsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteInstanceGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getInstanceGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertInstanceGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listInstanceGroupsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listInstancesInstanceGroupsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .removeInstancesInstanceGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setNamedPortsInstanceGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(InstanceGroupStubSettings settings) { + super(settings); + + addInstancesInstanceGroupSettings = settings.addInstancesInstanceGroupSettings.toBuilder(); + aggregatedListInstanceGroupsSettings = + settings.aggregatedListInstanceGroupsSettings.toBuilder(); + deleteInstanceGroupSettings = settings.deleteInstanceGroupSettings.toBuilder(); + getInstanceGroupSettings = settings.getInstanceGroupSettings.toBuilder(); + insertInstanceGroupSettings = settings.insertInstanceGroupSettings.toBuilder(); + listInstanceGroupsSettings = settings.listInstanceGroupsSettings.toBuilder(); + listInstancesInstanceGroupsSettings = + settings.listInstancesInstanceGroupsSettings.toBuilder(); + removeInstancesInstanceGroupSettings = + settings.removeInstancesInstanceGroupSettings.toBuilder(); + setNamedPortsInstanceGroupSettings = settings.setNamedPortsInstanceGroupSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + addInstancesInstanceGroupSettings, + aggregatedListInstanceGroupsSettings, + deleteInstanceGroupSettings, + getInstanceGroupSettings, + insertInstanceGroupSettings, + listInstanceGroupsSettings, + listInstancesInstanceGroupsSettings, + removeInstancesInstanceGroupSettings, + setNamedPortsInstanceGroupSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to addInstancesInstanceGroup. */ + public UnaryCallSettings.Builder + addInstancesInstanceGroupSettings() { + return addInstancesInstanceGroupSettings; + } + + /** Returns the builder for the settings used for calls to aggregatedListInstanceGroups. */ + public PagedCallSettings.Builder< + AggregatedListInstanceGroupsHttpRequest, InstanceGroupAggregatedList, + AggregatedListInstanceGroupsPagedResponse> + aggregatedListInstanceGroupsSettings() { + return aggregatedListInstanceGroupsSettings; + } + + /** Returns the builder for the settings used for calls to deleteInstanceGroup. */ + public UnaryCallSettings.Builder + deleteInstanceGroupSettings() { + return deleteInstanceGroupSettings; + } + + /** Returns the builder for the settings used for calls to getInstanceGroup. */ + public UnaryCallSettings.Builder + getInstanceGroupSettings() { + return getInstanceGroupSettings; + } + + /** Returns the builder for the settings used for calls to insertInstanceGroup. */ + public UnaryCallSettings.Builder + insertInstanceGroupSettings() { + return insertInstanceGroupSettings; + } + + /** Returns the builder for the settings used for calls to listInstanceGroups. */ + public PagedCallSettings.Builder< + ListInstanceGroupsHttpRequest, InstanceGroupList, ListInstanceGroupsPagedResponse> + listInstanceGroupsSettings() { + return listInstanceGroupsSettings; + } + + /** Returns the builder for the settings used for calls to listInstancesInstanceGroups. */ + public PagedCallSettings.Builder< + ListInstancesInstanceGroupsHttpRequest, InstanceGroupsListInstances, + ListInstancesInstanceGroupsPagedResponse> + listInstancesInstanceGroupsSettings() { + return listInstancesInstanceGroupsSettings; + } + + /** Returns the builder for the settings used for calls to removeInstancesInstanceGroup. */ + public UnaryCallSettings.Builder + removeInstancesInstanceGroupSettings() { + return removeInstancesInstanceGroupSettings; + } + + /** Returns the builder for the settings used for calls to setNamedPortsInstanceGroup. */ + public UnaryCallSettings.Builder + setNamedPortsInstanceGroupSettings() { + return setNamedPortsInstanceGroupSettings; + } + + @Override + public InstanceGroupStubSettings build() throws IOException { + return new InstanceGroupStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceStub.java new file mode 100644 index 000000000000..4e10ec10ee86 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceStub.java @@ -0,0 +1,249 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceClient.AggregatedListInstancesPagedResponse; +import static com.google.cloud.compute.v1.InstanceClient.ListInstancesPagedResponse; +import static com.google.cloud.compute.v1.InstanceClient.ListReferrersInstancesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AddAccessConfigInstanceHttpRequest; +import com.google.cloud.compute.v1.AggregatedListInstancesHttpRequest; +import com.google.cloud.compute.v1.AttachDiskInstanceHttpRequest; +import com.google.cloud.compute.v1.DeleteAccessConfigInstanceHttpRequest; +import com.google.cloud.compute.v1.DeleteInstanceHttpRequest; +import com.google.cloud.compute.v1.DetachDiskInstanceHttpRequest; +import com.google.cloud.compute.v1.GetInstanceHttpRequest; +import com.google.cloud.compute.v1.GetSerialPortOutputInstanceHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceHttpRequest; +import com.google.cloud.compute.v1.Instance; +import com.google.cloud.compute.v1.InstanceAggregatedList; +import com.google.cloud.compute.v1.InstanceList; +import com.google.cloud.compute.v1.InstanceListReferrers; +import com.google.cloud.compute.v1.ListInstancesHttpRequest; +import com.google.cloud.compute.v1.ListReferrersInstancesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ResetInstanceHttpRequest; +import com.google.cloud.compute.v1.SerialPortOutput; +import com.google.cloud.compute.v1.SetDeletionProtectionInstanceHttpRequest; +import com.google.cloud.compute.v1.SetDiskAutoDeleteInstanceHttpRequest; +import com.google.cloud.compute.v1.SetLabelsInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMachineResourcesInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMachineTypeInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMetadataInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMinCpuPlatformInstanceHttpRequest; +import com.google.cloud.compute.v1.SetSchedulingInstanceHttpRequest; +import com.google.cloud.compute.v1.SetServiceAccountInstanceHttpRequest; +import com.google.cloud.compute.v1.SetTagsInstanceHttpRequest; +import com.google.cloud.compute.v1.StartInstanceHttpRequest; +import com.google.cloud.compute.v1.StartWithEncryptionKeyInstanceHttpRequest; +import com.google.cloud.compute.v1.StopInstanceHttpRequest; +import com.google.cloud.compute.v1.UpdateAccessConfigInstanceHttpRequest; +import com.google.cloud.compute.v1.UpdateNetworkInterfaceInstanceHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class InstanceStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + addAccessConfigInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: addAccessConfigInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListInstancesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListInstancesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListInstancesCallable() { + throw new UnsupportedOperationException("Not implemented: aggregatedListInstancesCallable()"); + } + + @BetaApi + public UnaryCallable attachDiskInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: attachDiskInstanceCallable()"); + } + + @BetaApi + public UnaryCallable deleteInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: deleteInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + deleteAccessConfigInstanceCallable() { + throw new UnsupportedOperationException( + "Not implemented: deleteAccessConfigInstanceCallable()"); + } + + @BetaApi + public UnaryCallable detachDiskInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: detachDiskInstanceCallable()"); + } + + @BetaApi + public UnaryCallable getInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: getInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + getSerialPortOutputInstanceCallable() { + throw new UnsupportedOperationException( + "Not implemented: getSerialPortOutputInstanceCallable()"); + } + + @BetaApi + public UnaryCallable insertInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: insertInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + listInstancesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listInstancesPagedCallable()"); + } + + @BetaApi + public UnaryCallable listInstancesCallable() { + throw new UnsupportedOperationException("Not implemented: listInstancesCallable()"); + } + + @BetaApi + public UnaryCallable + listReferrersInstancesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listReferrersInstancesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listReferrersInstancesCallable() { + throw new UnsupportedOperationException("Not implemented: listReferrersInstancesCallable()"); + } + + @BetaApi + public UnaryCallable resetInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: resetInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + setDeletionProtectionInstanceCallable() { + throw new UnsupportedOperationException( + "Not implemented: setDeletionProtectionInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + setDiskAutoDeleteInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: setDiskAutoDeleteInstanceCallable()"); + } + + @BetaApi + public UnaryCallable setLabelsInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: setLabelsInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + setMachineResourcesInstanceCallable() { + throw new UnsupportedOperationException( + "Not implemented: setMachineResourcesInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + setMachineTypeInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: setMachineTypeInstanceCallable()"); + } + + @BetaApi + public UnaryCallable setMetadataInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: setMetadataInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + setMinCpuPlatformInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: setMinCpuPlatformInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + setSchedulingInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: setSchedulingInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + setServiceAccountInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: setServiceAccountInstanceCallable()"); + } + + @BetaApi + public UnaryCallable setTagsInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: setTagsInstanceCallable()"); + } + + @BetaApi + public UnaryCallable startInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: startInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + startWithEncryptionKeyInstanceCallable() { + throw new UnsupportedOperationException( + "Not implemented: startWithEncryptionKeyInstanceCallable()"); + } + + @BetaApi + public UnaryCallable stopInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: stopInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + updateAccessConfigInstanceCallable() { + throw new UnsupportedOperationException( + "Not implemented: updateAccessConfigInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + updateNetworkInterfaceInstanceCallable() { + throw new UnsupportedOperationException( + "Not implemented: updateNetworkInterfaceInstanceCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceStubSettings.java new file mode 100644 index 000000000000..a43e52f1ddf4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceStubSettings.java @@ -0,0 +1,1223 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceClient.AggregatedListInstancesPagedResponse; +import static com.google.cloud.compute.v1.InstanceClient.ListInstancesPagedResponse; +import static com.google.cloud.compute.v1.InstanceClient.ListReferrersInstancesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AddAccessConfigInstanceHttpRequest; +import com.google.cloud.compute.v1.AggregatedListInstancesHttpRequest; +import com.google.cloud.compute.v1.AttachDiskInstanceHttpRequest; +import com.google.cloud.compute.v1.DeleteAccessConfigInstanceHttpRequest; +import com.google.cloud.compute.v1.DeleteInstanceHttpRequest; +import com.google.cloud.compute.v1.DetachDiskInstanceHttpRequest; +import com.google.cloud.compute.v1.GetInstanceHttpRequest; +import com.google.cloud.compute.v1.GetSerialPortOutputInstanceHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceHttpRequest; +import com.google.cloud.compute.v1.Instance; +import com.google.cloud.compute.v1.InstanceAggregatedList; +import com.google.cloud.compute.v1.InstanceList; +import com.google.cloud.compute.v1.InstanceListReferrers; +import com.google.cloud.compute.v1.InstancesScopedList; +import com.google.cloud.compute.v1.ListInstancesHttpRequest; +import com.google.cloud.compute.v1.ListReferrersInstancesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.Reference; +import com.google.cloud.compute.v1.ResetInstanceHttpRequest; +import com.google.cloud.compute.v1.SerialPortOutput; +import com.google.cloud.compute.v1.SetDeletionProtectionInstanceHttpRequest; +import com.google.cloud.compute.v1.SetDiskAutoDeleteInstanceHttpRequest; +import com.google.cloud.compute.v1.SetLabelsInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMachineResourcesInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMachineTypeInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMetadataInstanceHttpRequest; +import com.google.cloud.compute.v1.SetMinCpuPlatformInstanceHttpRequest; +import com.google.cloud.compute.v1.SetSchedulingInstanceHttpRequest; +import com.google.cloud.compute.v1.SetServiceAccountInstanceHttpRequest; +import com.google.cloud.compute.v1.SetTagsInstanceHttpRequest; +import com.google.cloud.compute.v1.StartInstanceHttpRequest; +import com.google.cloud.compute.v1.StartWithEncryptionKeyInstanceHttpRequest; +import com.google.cloud.compute.v1.StopInstanceHttpRequest; +import com.google.cloud.compute.v1.UpdateAccessConfigInstanceHttpRequest; +import com.google.cloud.compute.v1.UpdateNetworkInterfaceInstanceHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InstanceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of addAccessConfigInstance to 30 seconds: + * + *

+ * 
+ * InstanceStubSettings.Builder instanceSettingsBuilder =
+ *     InstanceStubSettings.newBuilder();
+ * instanceSettingsBuilder.addAccessConfigInstanceSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InstanceStubSettings instanceSettings = instanceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + addAccessConfigInstanceSettings; + private final PagedCallSettings< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, + AggregatedListInstancesPagedResponse> + aggregatedListInstancesSettings; + private final UnaryCallSettings + attachDiskInstanceSettings; + private final UnaryCallSettings deleteInstanceSettings; + private final UnaryCallSettings + deleteAccessConfigInstanceSettings; + private final UnaryCallSettings + detachDiskInstanceSettings; + private final UnaryCallSettings getInstanceSettings; + private final UnaryCallSettings + getSerialPortOutputInstanceSettings; + private final UnaryCallSettings insertInstanceSettings; + private final PagedCallSettings< + ListInstancesHttpRequest, InstanceList, ListInstancesPagedResponse> + listInstancesSettings; + private final PagedCallSettings< + ListReferrersInstancesHttpRequest, InstanceListReferrers, + ListReferrersInstancesPagedResponse> + listReferrersInstancesSettings; + private final UnaryCallSettings resetInstanceSettings; + private final UnaryCallSettings + setDeletionProtectionInstanceSettings; + private final UnaryCallSettings + setDiskAutoDeleteInstanceSettings; + private final UnaryCallSettings + setLabelsInstanceSettings; + private final UnaryCallSettings + setMachineResourcesInstanceSettings; + private final UnaryCallSettings + setMachineTypeInstanceSettings; + private final UnaryCallSettings + setMetadataInstanceSettings; + private final UnaryCallSettings + setMinCpuPlatformInstanceSettings; + private final UnaryCallSettings + setSchedulingInstanceSettings; + private final UnaryCallSettings + setServiceAccountInstanceSettings; + private final UnaryCallSettings setTagsInstanceSettings; + private final UnaryCallSettings startInstanceSettings; + private final UnaryCallSettings + startWithEncryptionKeyInstanceSettings; + private final UnaryCallSettings stopInstanceSettings; + private final UnaryCallSettings + updateAccessConfigInstanceSettings; + private final UnaryCallSettings + updateNetworkInterfaceInstanceSettings; + + /** Returns the object with the settings used for calls to addAccessConfigInstance. */ + public UnaryCallSettings + addAccessConfigInstanceSettings() { + return addAccessConfigInstanceSettings; + } + + /** Returns the object with the settings used for calls to aggregatedListInstances. */ + public PagedCallSettings< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, + AggregatedListInstancesPagedResponse> + aggregatedListInstancesSettings() { + return aggregatedListInstancesSettings; + } + + /** Returns the object with the settings used for calls to attachDiskInstance. */ + public UnaryCallSettings attachDiskInstanceSettings() { + return attachDiskInstanceSettings; + } + + /** Returns the object with the settings used for calls to deleteInstance. */ + public UnaryCallSettings deleteInstanceSettings() { + return deleteInstanceSettings; + } + + /** Returns the object with the settings used for calls to deleteAccessConfigInstance. */ + public UnaryCallSettings + deleteAccessConfigInstanceSettings() { + return deleteAccessConfigInstanceSettings; + } + + /** Returns the object with the settings used for calls to detachDiskInstance. */ + public UnaryCallSettings detachDiskInstanceSettings() { + return detachDiskInstanceSettings; + } + + /** Returns the object with the settings used for calls to getInstance. */ + public UnaryCallSettings getInstanceSettings() { + return getInstanceSettings; + } + + /** Returns the object with the settings used for calls to getSerialPortOutputInstance. */ + public UnaryCallSettings + getSerialPortOutputInstanceSettings() { + return getSerialPortOutputInstanceSettings; + } + + /** Returns the object with the settings used for calls to insertInstance. */ + public UnaryCallSettings insertInstanceSettings() { + return insertInstanceSettings; + } + + /** Returns the object with the settings used for calls to listInstances. */ + public PagedCallSettings + listInstancesSettings() { + return listInstancesSettings; + } + + /** Returns the object with the settings used for calls to listReferrersInstances. */ + public PagedCallSettings< + ListReferrersInstancesHttpRequest, InstanceListReferrers, + ListReferrersInstancesPagedResponse> + listReferrersInstancesSettings() { + return listReferrersInstancesSettings; + } + + /** Returns the object with the settings used for calls to resetInstance. */ + public UnaryCallSettings resetInstanceSettings() { + return resetInstanceSettings; + } + + /** Returns the object with the settings used for calls to setDeletionProtectionInstance. */ + public UnaryCallSettings + setDeletionProtectionInstanceSettings() { + return setDeletionProtectionInstanceSettings; + } + + /** Returns the object with the settings used for calls to setDiskAutoDeleteInstance. */ + public UnaryCallSettings + setDiskAutoDeleteInstanceSettings() { + return setDiskAutoDeleteInstanceSettings; + } + + /** Returns the object with the settings used for calls to setLabelsInstance. */ + public UnaryCallSettings setLabelsInstanceSettings() { + return setLabelsInstanceSettings; + } + + /** Returns the object with the settings used for calls to setMachineResourcesInstance. */ + public UnaryCallSettings + setMachineResourcesInstanceSettings() { + return setMachineResourcesInstanceSettings; + } + + /** Returns the object with the settings used for calls to setMachineTypeInstance. */ + public UnaryCallSettings + setMachineTypeInstanceSettings() { + return setMachineTypeInstanceSettings; + } + + /** Returns the object with the settings used for calls to setMetadataInstance. */ + public UnaryCallSettings + setMetadataInstanceSettings() { + return setMetadataInstanceSettings; + } + + /** Returns the object with the settings used for calls to setMinCpuPlatformInstance. */ + public UnaryCallSettings + setMinCpuPlatformInstanceSettings() { + return setMinCpuPlatformInstanceSettings; + } + + /** Returns the object with the settings used for calls to setSchedulingInstance. */ + public UnaryCallSettings + setSchedulingInstanceSettings() { + return setSchedulingInstanceSettings; + } + + /** Returns the object with the settings used for calls to setServiceAccountInstance. */ + public UnaryCallSettings + setServiceAccountInstanceSettings() { + return setServiceAccountInstanceSettings; + } + + /** Returns the object with the settings used for calls to setTagsInstance. */ + public UnaryCallSettings setTagsInstanceSettings() { + return setTagsInstanceSettings; + } + + /** Returns the object with the settings used for calls to startInstance. */ + public UnaryCallSettings startInstanceSettings() { + return startInstanceSettings; + } + + /** Returns the object with the settings used for calls to startWithEncryptionKeyInstance. */ + public UnaryCallSettings + startWithEncryptionKeyInstanceSettings() { + return startWithEncryptionKeyInstanceSettings; + } + + /** Returns the object with the settings used for calls to stopInstance. */ + public UnaryCallSettings stopInstanceSettings() { + return stopInstanceSettings; + } + + /** Returns the object with the settings used for calls to updateAccessConfigInstance. */ + public UnaryCallSettings + updateAccessConfigInstanceSettings() { + return updateAccessConfigInstanceSettings; + } + + /** Returns the object with the settings used for calls to updateNetworkInterfaceInstance. */ + public UnaryCallSettings + updateNetworkInterfaceInstanceSettings() { + return updateNetworkInterfaceInstanceSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InstanceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonInstanceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(InstanceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InstanceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + addAccessConfigInstanceSettings = settingsBuilder.addAccessConfigInstanceSettings().build(); + aggregatedListInstancesSettings = settingsBuilder.aggregatedListInstancesSettings().build(); + attachDiskInstanceSettings = settingsBuilder.attachDiskInstanceSettings().build(); + deleteInstanceSettings = settingsBuilder.deleteInstanceSettings().build(); + deleteAccessConfigInstanceSettings = + settingsBuilder.deleteAccessConfigInstanceSettings().build(); + detachDiskInstanceSettings = settingsBuilder.detachDiskInstanceSettings().build(); + getInstanceSettings = settingsBuilder.getInstanceSettings().build(); + getSerialPortOutputInstanceSettings = + settingsBuilder.getSerialPortOutputInstanceSettings().build(); + insertInstanceSettings = settingsBuilder.insertInstanceSettings().build(); + listInstancesSettings = settingsBuilder.listInstancesSettings().build(); + listReferrersInstancesSettings = settingsBuilder.listReferrersInstancesSettings().build(); + resetInstanceSettings = settingsBuilder.resetInstanceSettings().build(); + setDeletionProtectionInstanceSettings = + settingsBuilder.setDeletionProtectionInstanceSettings().build(); + setDiskAutoDeleteInstanceSettings = settingsBuilder.setDiskAutoDeleteInstanceSettings().build(); + setLabelsInstanceSettings = settingsBuilder.setLabelsInstanceSettings().build(); + setMachineResourcesInstanceSettings = + settingsBuilder.setMachineResourcesInstanceSettings().build(); + setMachineTypeInstanceSettings = settingsBuilder.setMachineTypeInstanceSettings().build(); + setMetadataInstanceSettings = settingsBuilder.setMetadataInstanceSettings().build(); + setMinCpuPlatformInstanceSettings = settingsBuilder.setMinCpuPlatformInstanceSettings().build(); + setSchedulingInstanceSettings = settingsBuilder.setSchedulingInstanceSettings().build(); + setServiceAccountInstanceSettings = settingsBuilder.setServiceAccountInstanceSettings().build(); + setTagsInstanceSettings = settingsBuilder.setTagsInstanceSettings().build(); + startInstanceSettings = settingsBuilder.startInstanceSettings().build(); + startWithEncryptionKeyInstanceSettings = + settingsBuilder.startWithEncryptionKeyInstanceSettings().build(); + stopInstanceSettings = settingsBuilder.stopInstanceSettings().build(); + updateAccessConfigInstanceSettings = + settingsBuilder.updateAccessConfigInstanceSettings().build(); + updateNetworkInterfaceInstanceSettings = + settingsBuilder.updateNetworkInterfaceInstanceSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, InstancesScopedList> + AGGREGATED_LIST_INSTANCES_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, InstancesScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListInstancesHttpRequest injectToken( + AggregatedListInstancesHttpRequest payload, String token) { + return AggregatedListInstancesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListInstancesHttpRequest injectPageSize( + AggregatedListInstancesHttpRequest payload, int pageSize) { + return AggregatedListInstancesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListInstancesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InstanceAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(InstanceAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor + LIST_INSTANCES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInstancesHttpRequest injectToken( + ListInstancesHttpRequest payload, String token) { + return ListInstancesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListInstancesHttpRequest injectPageSize( + ListInstancesHttpRequest payload, int pageSize) { + return ListInstancesHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListInstancesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InstanceList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(InstanceList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListDescriptor< + ListReferrersInstancesHttpRequest, InstanceListReferrers, Reference> + LIST_REFERRERS_INSTANCES_PAGE_STR_DESC = + new PagedListDescriptor< + ListReferrersInstancesHttpRequest, InstanceListReferrers, Reference>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListReferrersInstancesHttpRequest injectToken( + ListReferrersInstancesHttpRequest payload, String token) { + return ListReferrersInstancesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListReferrersInstancesHttpRequest injectPageSize( + ListReferrersInstancesHttpRequest payload, int pageSize) { + return ListReferrersInstancesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListReferrersInstancesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InstanceListReferrers payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(InstanceListReferrers payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, + AggregatedListInstancesPagedResponse> + AGGREGATED_LIST_INSTANCES_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, + AggregatedListInstancesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + AggregatedListInstancesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, + InstancesScopedList> + pageContext = + PageContext.create( + callable, AGGREGATED_LIST_INSTANCES_PAGE_STR_DESC, request, context); + return AggregatedListInstancesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListInstancesHttpRequest, InstanceList, ListInstancesPagedResponse> + LIST_INSTANCES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInstancesHttpRequest, InstanceList, ListInstancesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListInstancesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_INSTANCES_PAGE_STR_DESC, request, context); + return ListInstancesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListReferrersInstancesHttpRequest, InstanceListReferrers, + ListReferrersInstancesPagedResponse> + LIST_REFERRERS_INSTANCES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListReferrersInstancesHttpRequest, InstanceListReferrers, + ListReferrersInstancesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListReferrersInstancesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_REFERRERS_INSTANCES_PAGE_STR_DESC, request, context); + return ListReferrersInstancesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for InstanceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + addAccessConfigInstanceSettings; + private final PagedCallSettings.Builder< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, + AggregatedListInstancesPagedResponse> + aggregatedListInstancesSettings; + private final UnaryCallSettings.Builder + attachDiskInstanceSettings; + private final UnaryCallSettings.Builder + deleteInstanceSettings; + private final UnaryCallSettings.Builder + deleteAccessConfigInstanceSettings; + private final UnaryCallSettings.Builder + detachDiskInstanceSettings; + private final UnaryCallSettings.Builder getInstanceSettings; + private final UnaryCallSettings.Builder< + GetSerialPortOutputInstanceHttpRequest, SerialPortOutput> + getSerialPortOutputInstanceSettings; + private final UnaryCallSettings.Builder + insertInstanceSettings; + private final PagedCallSettings.Builder< + ListInstancesHttpRequest, InstanceList, ListInstancesPagedResponse> + listInstancesSettings; + private final PagedCallSettings.Builder< + ListReferrersInstancesHttpRequest, InstanceListReferrers, + ListReferrersInstancesPagedResponse> + listReferrersInstancesSettings; + private final UnaryCallSettings.Builder + resetInstanceSettings; + private final UnaryCallSettings.Builder + setDeletionProtectionInstanceSettings; + private final UnaryCallSettings.Builder + setDiskAutoDeleteInstanceSettings; + private final UnaryCallSettings.Builder + setLabelsInstanceSettings; + private final UnaryCallSettings.Builder + setMachineResourcesInstanceSettings; + private final UnaryCallSettings.Builder + setMachineTypeInstanceSettings; + private final UnaryCallSettings.Builder + setMetadataInstanceSettings; + private final UnaryCallSettings.Builder + setMinCpuPlatformInstanceSettings; + private final UnaryCallSettings.Builder + setSchedulingInstanceSettings; + private final UnaryCallSettings.Builder + setServiceAccountInstanceSettings; + private final UnaryCallSettings.Builder + setTagsInstanceSettings; + private final UnaryCallSettings.Builder + startInstanceSettings; + private final UnaryCallSettings.Builder + startWithEncryptionKeyInstanceSettings; + private final UnaryCallSettings.Builder + stopInstanceSettings; + private final UnaryCallSettings.Builder + updateAccessConfigInstanceSettings; + private final UnaryCallSettings.Builder + updateNetworkInterfaceInstanceSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + addAccessConfigInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + aggregatedListInstancesSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_INSTANCES_PAGE_STR_FACT); + + attachDiskInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteAccessConfigInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + detachDiskInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getSerialPortOutputInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listInstancesSettings = PagedCallSettings.newBuilder(LIST_INSTANCES_PAGE_STR_FACT); + + listReferrersInstancesSettings = + PagedCallSettings.newBuilder(LIST_REFERRERS_INSTANCES_PAGE_STR_FACT); + + resetInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setDeletionProtectionInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setDiskAutoDeleteInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setLabelsInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setMachineResourcesInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setMachineTypeInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setMetadataInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setMinCpuPlatformInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setSchedulingInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setServiceAccountInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setTagsInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + startInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + startWithEncryptionKeyInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + stopInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateAccessConfigInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateNetworkInterfaceInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + addAccessConfigInstanceSettings, + aggregatedListInstancesSettings, + attachDiskInstanceSettings, + deleteInstanceSettings, + deleteAccessConfigInstanceSettings, + detachDiskInstanceSettings, + getInstanceSettings, + getSerialPortOutputInstanceSettings, + insertInstanceSettings, + listInstancesSettings, + listReferrersInstancesSettings, + resetInstanceSettings, + setDeletionProtectionInstanceSettings, + setDiskAutoDeleteInstanceSettings, + setLabelsInstanceSettings, + setMachineResourcesInstanceSettings, + setMachineTypeInstanceSettings, + setMetadataInstanceSettings, + setMinCpuPlatformInstanceSettings, + setSchedulingInstanceSettings, + setServiceAccountInstanceSettings, + setTagsInstanceSettings, + startInstanceSettings, + startWithEncryptionKeyInstanceSettings, + stopInstanceSettings, + updateAccessConfigInstanceSettings, + updateNetworkInterfaceInstanceSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .addAccessConfigInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .aggregatedListInstancesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .attachDiskInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteAccessConfigInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .detachDiskInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getSerialPortOutputInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listInstancesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listReferrersInstancesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .resetInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setDeletionProtectionInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setDiskAutoDeleteInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setLabelsInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setMachineResourcesInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setMachineTypeInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setMetadataInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setMinCpuPlatformInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setSchedulingInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setServiceAccountInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setTagsInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .startInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .startWithEncryptionKeyInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .stopInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateAccessConfigInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateNetworkInterfaceInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(InstanceStubSettings settings) { + super(settings); + + addAccessConfigInstanceSettings = settings.addAccessConfigInstanceSettings.toBuilder(); + aggregatedListInstancesSettings = settings.aggregatedListInstancesSettings.toBuilder(); + attachDiskInstanceSettings = settings.attachDiskInstanceSettings.toBuilder(); + deleteInstanceSettings = settings.deleteInstanceSettings.toBuilder(); + deleteAccessConfigInstanceSettings = settings.deleteAccessConfigInstanceSettings.toBuilder(); + detachDiskInstanceSettings = settings.detachDiskInstanceSettings.toBuilder(); + getInstanceSettings = settings.getInstanceSettings.toBuilder(); + getSerialPortOutputInstanceSettings = + settings.getSerialPortOutputInstanceSettings.toBuilder(); + insertInstanceSettings = settings.insertInstanceSettings.toBuilder(); + listInstancesSettings = settings.listInstancesSettings.toBuilder(); + listReferrersInstancesSettings = settings.listReferrersInstancesSettings.toBuilder(); + resetInstanceSettings = settings.resetInstanceSettings.toBuilder(); + setDeletionProtectionInstanceSettings = + settings.setDeletionProtectionInstanceSettings.toBuilder(); + setDiskAutoDeleteInstanceSettings = settings.setDiskAutoDeleteInstanceSettings.toBuilder(); + setLabelsInstanceSettings = settings.setLabelsInstanceSettings.toBuilder(); + setMachineResourcesInstanceSettings = + settings.setMachineResourcesInstanceSettings.toBuilder(); + setMachineTypeInstanceSettings = settings.setMachineTypeInstanceSettings.toBuilder(); + setMetadataInstanceSettings = settings.setMetadataInstanceSettings.toBuilder(); + setMinCpuPlatformInstanceSettings = settings.setMinCpuPlatformInstanceSettings.toBuilder(); + setSchedulingInstanceSettings = settings.setSchedulingInstanceSettings.toBuilder(); + setServiceAccountInstanceSettings = settings.setServiceAccountInstanceSettings.toBuilder(); + setTagsInstanceSettings = settings.setTagsInstanceSettings.toBuilder(); + startInstanceSettings = settings.startInstanceSettings.toBuilder(); + startWithEncryptionKeyInstanceSettings = + settings.startWithEncryptionKeyInstanceSettings.toBuilder(); + stopInstanceSettings = settings.stopInstanceSettings.toBuilder(); + updateAccessConfigInstanceSettings = settings.updateAccessConfigInstanceSettings.toBuilder(); + updateNetworkInterfaceInstanceSettings = + settings.updateNetworkInterfaceInstanceSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + addAccessConfigInstanceSettings, + aggregatedListInstancesSettings, + attachDiskInstanceSettings, + deleteInstanceSettings, + deleteAccessConfigInstanceSettings, + detachDiskInstanceSettings, + getInstanceSettings, + getSerialPortOutputInstanceSettings, + insertInstanceSettings, + listInstancesSettings, + listReferrersInstancesSettings, + resetInstanceSettings, + setDeletionProtectionInstanceSettings, + setDiskAutoDeleteInstanceSettings, + setLabelsInstanceSettings, + setMachineResourcesInstanceSettings, + setMachineTypeInstanceSettings, + setMetadataInstanceSettings, + setMinCpuPlatformInstanceSettings, + setSchedulingInstanceSettings, + setServiceAccountInstanceSettings, + setTagsInstanceSettings, + startInstanceSettings, + startWithEncryptionKeyInstanceSettings, + stopInstanceSettings, + updateAccessConfigInstanceSettings, + updateNetworkInterfaceInstanceSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to addAccessConfigInstance. */ + public UnaryCallSettings.Builder + addAccessConfigInstanceSettings() { + return addAccessConfigInstanceSettings; + } + + /** Returns the builder for the settings used for calls to aggregatedListInstances. */ + public PagedCallSettings.Builder< + AggregatedListInstancesHttpRequest, InstanceAggregatedList, + AggregatedListInstancesPagedResponse> + aggregatedListInstancesSettings() { + return aggregatedListInstancesSettings; + } + + /** Returns the builder for the settings used for calls to attachDiskInstance. */ + public UnaryCallSettings.Builder + attachDiskInstanceSettings() { + return attachDiskInstanceSettings; + } + + /** Returns the builder for the settings used for calls to deleteInstance. */ + public UnaryCallSettings.Builder + deleteInstanceSettings() { + return deleteInstanceSettings; + } + + /** Returns the builder for the settings used for calls to deleteAccessConfigInstance. */ + public UnaryCallSettings.Builder + deleteAccessConfigInstanceSettings() { + return deleteAccessConfigInstanceSettings; + } + + /** Returns the builder for the settings used for calls to detachDiskInstance. */ + public UnaryCallSettings.Builder + detachDiskInstanceSettings() { + return detachDiskInstanceSettings; + } + + /** Returns the builder for the settings used for calls to getInstance. */ + public UnaryCallSettings.Builder getInstanceSettings() { + return getInstanceSettings; + } + + /** Returns the builder for the settings used for calls to getSerialPortOutputInstance. */ + public UnaryCallSettings.Builder + getSerialPortOutputInstanceSettings() { + return getSerialPortOutputInstanceSettings; + } + + /** Returns the builder for the settings used for calls to insertInstance. */ + public UnaryCallSettings.Builder + insertInstanceSettings() { + return insertInstanceSettings; + } + + /** Returns the builder for the settings used for calls to listInstances. */ + public PagedCallSettings.Builder< + ListInstancesHttpRequest, InstanceList, ListInstancesPagedResponse> + listInstancesSettings() { + return listInstancesSettings; + } + + /** Returns the builder for the settings used for calls to listReferrersInstances. */ + public PagedCallSettings.Builder< + ListReferrersInstancesHttpRequest, InstanceListReferrers, + ListReferrersInstancesPagedResponse> + listReferrersInstancesSettings() { + return listReferrersInstancesSettings; + } + + /** Returns the builder for the settings used for calls to resetInstance. */ + public UnaryCallSettings.Builder resetInstanceSettings() { + return resetInstanceSettings; + } + + /** Returns the builder for the settings used for calls to setDeletionProtectionInstance. */ + public UnaryCallSettings.Builder + setDeletionProtectionInstanceSettings() { + return setDeletionProtectionInstanceSettings; + } + + /** Returns the builder for the settings used for calls to setDiskAutoDeleteInstance. */ + public UnaryCallSettings.Builder + setDiskAutoDeleteInstanceSettings() { + return setDiskAutoDeleteInstanceSettings; + } + + /** Returns the builder for the settings used for calls to setLabelsInstance. */ + public UnaryCallSettings.Builder + setLabelsInstanceSettings() { + return setLabelsInstanceSettings; + } + + /** Returns the builder for the settings used for calls to setMachineResourcesInstance. */ + public UnaryCallSettings.Builder + setMachineResourcesInstanceSettings() { + return setMachineResourcesInstanceSettings; + } + + /** Returns the builder for the settings used for calls to setMachineTypeInstance. */ + public UnaryCallSettings.Builder + setMachineTypeInstanceSettings() { + return setMachineTypeInstanceSettings; + } + + /** Returns the builder for the settings used for calls to setMetadataInstance. */ + public UnaryCallSettings.Builder + setMetadataInstanceSettings() { + return setMetadataInstanceSettings; + } + + /** Returns the builder for the settings used for calls to setMinCpuPlatformInstance. */ + public UnaryCallSettings.Builder + setMinCpuPlatformInstanceSettings() { + return setMinCpuPlatformInstanceSettings; + } + + /** Returns the builder for the settings used for calls to setSchedulingInstance. */ + public UnaryCallSettings.Builder + setSchedulingInstanceSettings() { + return setSchedulingInstanceSettings; + } + + /** Returns the builder for the settings used for calls to setServiceAccountInstance. */ + public UnaryCallSettings.Builder + setServiceAccountInstanceSettings() { + return setServiceAccountInstanceSettings; + } + + /** Returns the builder for the settings used for calls to setTagsInstance. */ + public UnaryCallSettings.Builder + setTagsInstanceSettings() { + return setTagsInstanceSettings; + } + + /** Returns the builder for the settings used for calls to startInstance. */ + public UnaryCallSettings.Builder startInstanceSettings() { + return startInstanceSettings; + } + + /** Returns the builder for the settings used for calls to startWithEncryptionKeyInstance. */ + public UnaryCallSettings.Builder + startWithEncryptionKeyInstanceSettings() { + return startWithEncryptionKeyInstanceSettings; + } + + /** Returns the builder for the settings used for calls to stopInstance. */ + public UnaryCallSettings.Builder stopInstanceSettings() { + return stopInstanceSettings; + } + + /** Returns the builder for the settings used for calls to updateAccessConfigInstance. */ + public UnaryCallSettings.Builder + updateAccessConfigInstanceSettings() { + return updateAccessConfigInstanceSettings; + } + + /** Returns the builder for the settings used for calls to updateNetworkInterfaceInstance. */ + public UnaryCallSettings.Builder + updateNetworkInterfaceInstanceSettings() { + return updateNetworkInterfaceInstanceSettings; + } + + @Override + public InstanceStubSettings build() throws IOException { + return new InstanceStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceTemplateStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceTemplateStub.java new file mode 100644 index 000000000000..df2944463d78 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceTemplateStub.java @@ -0,0 +1,75 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceTemplateClient.ListInstanceTemplatesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteInstanceTemplateHttpRequest; +import com.google.cloud.compute.v1.GetInstanceTemplateHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceTemplateHttpRequest; +import com.google.cloud.compute.v1.InstanceTemplate; +import com.google.cloud.compute.v1.InstanceTemplateList; +import com.google.cloud.compute.v1.ListInstanceTemplatesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class InstanceTemplateStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + deleteInstanceTemplateCallable() { + throw new UnsupportedOperationException("Not implemented: deleteInstanceTemplateCallable()"); + } + + @BetaApi + public UnaryCallable + getInstanceTemplateCallable() { + throw new UnsupportedOperationException("Not implemented: getInstanceTemplateCallable()"); + } + + @BetaApi + public UnaryCallable + insertInstanceTemplateCallable() { + throw new UnsupportedOperationException("Not implemented: insertInstanceTemplateCallable()"); + } + + @BetaApi + public UnaryCallable + listInstanceTemplatesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInstanceTemplatesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listInstanceTemplatesCallable() { + throw new UnsupportedOperationException("Not implemented: listInstanceTemplatesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceTemplateStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceTemplateStubSettings.java new file mode 100644 index 000000000000..819de6dde783 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InstanceTemplateStubSettings.java @@ -0,0 +1,452 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InstanceTemplateClient.ListInstanceTemplatesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteInstanceTemplateHttpRequest; +import com.google.cloud.compute.v1.GetInstanceTemplateHttpRequest; +import com.google.cloud.compute.v1.InsertInstanceTemplateHttpRequest; +import com.google.cloud.compute.v1.InstanceTemplate; +import com.google.cloud.compute.v1.InstanceTemplateList; +import com.google.cloud.compute.v1.ListInstanceTemplatesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InstanceTemplateStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteInstanceTemplate to 30 seconds: + * + *

+ * 
+ * InstanceTemplateStubSettings.Builder instanceTemplateSettingsBuilder =
+ *     InstanceTemplateStubSettings.newBuilder();
+ * instanceTemplateSettingsBuilder.deleteInstanceTemplateSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InstanceTemplateStubSettings instanceTemplateSettings = instanceTemplateSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InstanceTemplateStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteInstanceTemplateSettings; + private final UnaryCallSettings + getInstanceTemplateSettings; + private final UnaryCallSettings + insertInstanceTemplateSettings; + private final PagedCallSettings< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, + ListInstanceTemplatesPagedResponse> + listInstanceTemplatesSettings; + + /** Returns the object with the settings used for calls to deleteInstanceTemplate. */ + public UnaryCallSettings + deleteInstanceTemplateSettings() { + return deleteInstanceTemplateSettings; + } + + /** Returns the object with the settings used for calls to getInstanceTemplate. */ + public UnaryCallSettings + getInstanceTemplateSettings() { + return getInstanceTemplateSettings; + } + + /** Returns the object with the settings used for calls to insertInstanceTemplate. */ + public UnaryCallSettings + insertInstanceTemplateSettings() { + return insertInstanceTemplateSettings; + } + + /** Returns the object with the settings used for calls to listInstanceTemplates. */ + public PagedCallSettings< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, + ListInstanceTemplatesPagedResponse> + listInstanceTemplatesSettings() { + return listInstanceTemplatesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InstanceTemplateStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonInstanceTemplateStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(InstanceTemplateStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InstanceTemplateStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteInstanceTemplateSettings = settingsBuilder.deleteInstanceTemplateSettings().build(); + getInstanceTemplateSettings = settingsBuilder.getInstanceTemplateSettings().build(); + insertInstanceTemplateSettings = settingsBuilder.insertInstanceTemplateSettings().build(); + listInstanceTemplatesSettings = settingsBuilder.listInstanceTemplatesSettings().build(); + } + + private static final PagedListDescriptor< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, InstanceTemplate> + LIST_INSTANCE_TEMPLATES_PAGE_STR_DESC = + new PagedListDescriptor< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, InstanceTemplate>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInstanceTemplatesHttpRequest injectToken( + ListInstanceTemplatesHttpRequest payload, String token) { + return ListInstanceTemplatesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListInstanceTemplatesHttpRequest injectPageSize( + ListInstanceTemplatesHttpRequest payload, int pageSize) { + return ListInstanceTemplatesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListInstanceTemplatesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InstanceTemplateList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(InstanceTemplateList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, + ListInstanceTemplatesPagedResponse> + LIST_INSTANCE_TEMPLATES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, + ListInstanceTemplatesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListInstanceTemplatesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_INSTANCE_TEMPLATES_PAGE_STR_DESC, request, context); + return ListInstanceTemplatesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for InstanceTemplateStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteInstanceTemplateSettings; + private final UnaryCallSettings.Builder + getInstanceTemplateSettings; + private final UnaryCallSettings.Builder + insertInstanceTemplateSettings; + private final PagedCallSettings.Builder< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, + ListInstanceTemplatesPagedResponse> + listInstanceTemplatesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteInstanceTemplateSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getInstanceTemplateSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertInstanceTemplateSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listInstanceTemplatesSettings = + PagedCallSettings.newBuilder(LIST_INSTANCE_TEMPLATES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteInstanceTemplateSettings, + getInstanceTemplateSettings, + insertInstanceTemplateSettings, + listInstanceTemplatesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteInstanceTemplateSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getInstanceTemplateSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertInstanceTemplateSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listInstanceTemplatesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(InstanceTemplateStubSettings settings) { + super(settings); + + deleteInstanceTemplateSettings = settings.deleteInstanceTemplateSettings.toBuilder(); + getInstanceTemplateSettings = settings.getInstanceTemplateSettings.toBuilder(); + insertInstanceTemplateSettings = settings.insertInstanceTemplateSettings.toBuilder(); + listInstanceTemplatesSettings = settings.listInstanceTemplatesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteInstanceTemplateSettings, + getInstanceTemplateSettings, + insertInstanceTemplateSettings, + listInstanceTemplatesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteInstanceTemplate. */ + public UnaryCallSettings.Builder + deleteInstanceTemplateSettings() { + return deleteInstanceTemplateSettings; + } + + /** Returns the builder for the settings used for calls to getInstanceTemplate. */ + public UnaryCallSettings.Builder + getInstanceTemplateSettings() { + return getInstanceTemplateSettings; + } + + /** Returns the builder for the settings used for calls to insertInstanceTemplate. */ + public UnaryCallSettings.Builder + insertInstanceTemplateSettings() { + return insertInstanceTemplateSettings; + } + + /** Returns the builder for the settings used for calls to listInstanceTemplates. */ + public PagedCallSettings.Builder< + ListInstanceTemplatesHttpRequest, InstanceTemplateList, + ListInstanceTemplatesPagedResponse> + listInstanceTemplatesSettings() { + return listInstanceTemplatesSettings; + } + + @Override + public InstanceTemplateStubSettings build() throws IOException { + return new InstanceTemplateStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectAttachmentStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectAttachmentStub.java new file mode 100644 index 000000000000..0fb2191c1496 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectAttachmentStub.java @@ -0,0 +1,99 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InterconnectAttachmentClient.AggregatedListInterconnectAttachmentsPagedResponse; +import static com.google.cloud.compute.v1.InterconnectAttachmentClient.ListInterconnectAttachmentsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListInterconnectAttachmentsHttpRequest; +import com.google.cloud.compute.v1.DeleteInterconnectAttachmentHttpRequest; +import com.google.cloud.compute.v1.GetInterconnectAttachmentHttpRequest; +import com.google.cloud.compute.v1.InsertInterconnectAttachmentHttpRequest; +import com.google.cloud.compute.v1.InterconnectAttachment; +import com.google.cloud.compute.v1.InterconnectAttachmentAggregatedList; +import com.google.cloud.compute.v1.InterconnectAttachmentList; +import com.google.cloud.compute.v1.ListInterconnectAttachmentsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class InterconnectAttachmentStub implements BackgroundResource { + + @BetaApi + public UnaryCallable< + AggregatedListInterconnectAttachmentsHttpRequest, + AggregatedListInterconnectAttachmentsPagedResponse> + aggregatedListInterconnectAttachmentsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListInterconnectAttachmentsPagedCallable()"); + } + + @BetaApi + public UnaryCallable< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList> + aggregatedListInterconnectAttachmentsCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListInterconnectAttachmentsCallable()"); + } + + @BetaApi + public UnaryCallable + deleteInterconnectAttachmentCallable() { + throw new UnsupportedOperationException( + "Not implemented: deleteInterconnectAttachmentCallable()"); + } + + @BetaApi + public UnaryCallable + getInterconnectAttachmentCallable() { + throw new UnsupportedOperationException("Not implemented: getInterconnectAttachmentCallable()"); + } + + @BetaApi + public UnaryCallable + insertInterconnectAttachmentCallable() { + throw new UnsupportedOperationException( + "Not implemented: insertInterconnectAttachmentCallable()"); + } + + @BetaApi + public UnaryCallable< + ListInterconnectAttachmentsHttpRequest, ListInterconnectAttachmentsPagedResponse> + listInterconnectAttachmentsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInterconnectAttachmentsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listInterconnectAttachmentsCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInterconnectAttachmentsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectAttachmentStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectAttachmentStubSettings.java new file mode 100644 index 000000000000..0a8846d6c5e6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectAttachmentStubSettings.java @@ -0,0 +1,592 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InterconnectAttachmentClient.AggregatedListInterconnectAttachmentsPagedResponse; +import static com.google.cloud.compute.v1.InterconnectAttachmentClient.ListInterconnectAttachmentsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListInterconnectAttachmentsHttpRequest; +import com.google.cloud.compute.v1.DeleteInterconnectAttachmentHttpRequest; +import com.google.cloud.compute.v1.GetInterconnectAttachmentHttpRequest; +import com.google.cloud.compute.v1.InsertInterconnectAttachmentHttpRequest; +import com.google.cloud.compute.v1.InterconnectAttachment; +import com.google.cloud.compute.v1.InterconnectAttachmentAggregatedList; +import com.google.cloud.compute.v1.InterconnectAttachmentList; +import com.google.cloud.compute.v1.InterconnectAttachmentsScopedList; +import com.google.cloud.compute.v1.ListInterconnectAttachmentsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InterconnectAttachmentStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteInterconnectAttachment to 30 seconds: + * + *

+ * 
+ * InterconnectAttachmentStubSettings.Builder interconnectAttachmentSettingsBuilder =
+ *     InterconnectAttachmentStubSettings.newBuilder();
+ * interconnectAttachmentSettingsBuilder.deleteInterconnectAttachmentSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InterconnectAttachmentStubSettings interconnectAttachmentSettings = interconnectAttachmentSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InterconnectAttachmentStubSettings + extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList, + AggregatedListInterconnectAttachmentsPagedResponse> + aggregatedListInterconnectAttachmentsSettings; + private final UnaryCallSettings + deleteInterconnectAttachmentSettings; + private final UnaryCallSettings + getInterconnectAttachmentSettings; + private final UnaryCallSettings + insertInterconnectAttachmentSettings; + private final PagedCallSettings< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + ListInterconnectAttachmentsPagedResponse> + listInterconnectAttachmentsSettings; + + /** + * Returns the object with the settings used for calls to aggregatedListInterconnectAttachments. + */ + public PagedCallSettings< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList, + AggregatedListInterconnectAttachmentsPagedResponse> + aggregatedListInterconnectAttachmentsSettings() { + return aggregatedListInterconnectAttachmentsSettings; + } + + /** Returns the object with the settings used for calls to deleteInterconnectAttachment. */ + public UnaryCallSettings + deleteInterconnectAttachmentSettings() { + return deleteInterconnectAttachmentSettings; + } + + /** Returns the object with the settings used for calls to getInterconnectAttachment. */ + public UnaryCallSettings + getInterconnectAttachmentSettings() { + return getInterconnectAttachmentSettings; + } + + /** Returns the object with the settings used for calls to insertInterconnectAttachment. */ + public UnaryCallSettings + insertInterconnectAttachmentSettings() { + return insertInterconnectAttachmentSettings; + } + + /** Returns the object with the settings used for calls to listInterconnectAttachments. */ + public PagedCallSettings< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + ListInterconnectAttachmentsPagedResponse> + listInterconnectAttachmentsSettings() { + return listInterconnectAttachmentsSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InterconnectAttachmentStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonInterconnectAttachmentStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(InterconnectAttachmentStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InterconnectAttachmentStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListInterconnectAttachmentsSettings = + settingsBuilder.aggregatedListInterconnectAttachmentsSettings().build(); + deleteInterconnectAttachmentSettings = + settingsBuilder.deleteInterconnectAttachmentSettings().build(); + getInterconnectAttachmentSettings = settingsBuilder.getInterconnectAttachmentSettings().build(); + insertInterconnectAttachmentSettings = + settingsBuilder.insertInterconnectAttachmentSettings().build(); + listInterconnectAttachmentsSettings = + settingsBuilder.listInterconnectAttachmentsSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList, + InterconnectAttachmentsScopedList> + AGGREGATED_LIST_INTERCONNECT_ATTACHMENTS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListInterconnectAttachmentsHttpRequest, + InterconnectAttachmentAggregatedList, InterconnectAttachmentsScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListInterconnectAttachmentsHttpRequest injectToken( + AggregatedListInterconnectAttachmentsHttpRequest payload, String token) { + return AggregatedListInterconnectAttachmentsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListInterconnectAttachmentsHttpRequest injectPageSize( + AggregatedListInterconnectAttachmentsHttpRequest payload, int pageSize) { + return AggregatedListInterconnectAttachmentsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize( + AggregatedListInterconnectAttachmentsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InterconnectAttachmentAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + InterconnectAttachmentAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + InterconnectAttachment> + LIST_INTERCONNECT_ATTACHMENTS_PAGE_STR_DESC = + new PagedListDescriptor< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + InterconnectAttachment>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInterconnectAttachmentsHttpRequest injectToken( + ListInterconnectAttachmentsHttpRequest payload, String token) { + return ListInterconnectAttachmentsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListInterconnectAttachmentsHttpRequest injectPageSize( + ListInterconnectAttachmentsHttpRequest payload, int pageSize) { + return ListInterconnectAttachmentsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListInterconnectAttachmentsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InterconnectAttachmentList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + InterconnectAttachmentList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList, + AggregatedListInterconnectAttachmentsPagedResponse> + AGGREGATED_LIST_INTERCONNECT_ATTACHMENTS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListInterconnectAttachmentsHttpRequest, + InterconnectAttachmentAggregatedList, + AggregatedListInterconnectAttachmentsPagedResponse>() { + @Override + public ApiFuture + getFuturePagedResponse( + UnaryCallable< + AggregatedListInterconnectAttachmentsHttpRequest, + InterconnectAttachmentAggregatedList> + callable, + AggregatedListInterconnectAttachmentsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListInterconnectAttachmentsHttpRequest, + InterconnectAttachmentAggregatedList, InterconnectAttachmentsScopedList> + pageContext = + PageContext.create( + callable, + AGGREGATED_LIST_INTERCONNECT_ATTACHMENTS_PAGE_STR_DESC, + request, + context); + return AggregatedListInterconnectAttachmentsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + ListInterconnectAttachmentsPagedResponse> + LIST_INTERCONNECT_ATTACHMENTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + ListInterconnectAttachmentsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListInterconnectAttachmentsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + InterconnectAttachment> + pageContext = + PageContext.create( + callable, LIST_INTERCONNECT_ATTACHMENTS_PAGE_STR_DESC, request, context); + return ListInterconnectAttachmentsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + /** Builder for InterconnectAttachmentStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList, + AggregatedListInterconnectAttachmentsPagedResponse> + aggregatedListInterconnectAttachmentsSettings; + private final UnaryCallSettings.Builder + deleteInterconnectAttachmentSettings; + private final UnaryCallSettings.Builder< + GetInterconnectAttachmentHttpRequest, InterconnectAttachment> + getInterconnectAttachmentSettings; + private final UnaryCallSettings.Builder + insertInterconnectAttachmentSettings; + private final PagedCallSettings.Builder< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + ListInterconnectAttachmentsPagedResponse> + listInterconnectAttachmentsSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListInterconnectAttachmentsSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_INTERCONNECT_ATTACHMENTS_PAGE_STR_FACT); + + deleteInterconnectAttachmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getInterconnectAttachmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertInterconnectAttachmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listInterconnectAttachmentsSettings = + PagedCallSettings.newBuilder(LIST_INTERCONNECT_ATTACHMENTS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListInterconnectAttachmentsSettings, + deleteInterconnectAttachmentSettings, + getInterconnectAttachmentSettings, + insertInterconnectAttachmentSettings, + listInterconnectAttachmentsSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListInterconnectAttachmentsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteInterconnectAttachmentSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getInterconnectAttachmentSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertInterconnectAttachmentSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listInterconnectAttachmentsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(InterconnectAttachmentStubSettings settings) { + super(settings); + + aggregatedListInterconnectAttachmentsSettings = + settings.aggregatedListInterconnectAttachmentsSettings.toBuilder(); + deleteInterconnectAttachmentSettings = + settings.deleteInterconnectAttachmentSettings.toBuilder(); + getInterconnectAttachmentSettings = settings.getInterconnectAttachmentSettings.toBuilder(); + insertInterconnectAttachmentSettings = + settings.insertInterconnectAttachmentSettings.toBuilder(); + listInterconnectAttachmentsSettings = + settings.listInterconnectAttachmentsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListInterconnectAttachmentsSettings, + deleteInterconnectAttachmentSettings, + getInterconnectAttachmentSettings, + insertInterconnectAttachmentSettings, + listInterconnectAttachmentsSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** + * Returns the builder for the settings used for calls to aggregatedListInterconnectAttachments. + */ + public PagedCallSettings.Builder< + AggregatedListInterconnectAttachmentsHttpRequest, InterconnectAttachmentAggregatedList, + AggregatedListInterconnectAttachmentsPagedResponse> + aggregatedListInterconnectAttachmentsSettings() { + return aggregatedListInterconnectAttachmentsSettings; + } + + /** Returns the builder for the settings used for calls to deleteInterconnectAttachment. */ + public UnaryCallSettings.Builder + deleteInterconnectAttachmentSettings() { + return deleteInterconnectAttachmentSettings; + } + + /** Returns the builder for the settings used for calls to getInterconnectAttachment. */ + public UnaryCallSettings.Builder + getInterconnectAttachmentSettings() { + return getInterconnectAttachmentSettings; + } + + /** Returns the builder for the settings used for calls to insertInterconnectAttachment. */ + public UnaryCallSettings.Builder + insertInterconnectAttachmentSettings() { + return insertInterconnectAttachmentSettings; + } + + /** Returns the builder for the settings used for calls to listInterconnectAttachments. */ + public PagedCallSettings.Builder< + ListInterconnectAttachmentsHttpRequest, InterconnectAttachmentList, + ListInterconnectAttachmentsPagedResponse> + listInterconnectAttachmentsSettings() { + return listInterconnectAttachmentsSettings; + } + + @Override + public InterconnectAttachmentStubSettings build() throws IOException { + return new InterconnectAttachmentStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectLocationStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectLocationStub.java new file mode 100644 index 000000000000..f10640d33bb3 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectLocationStub.java @@ -0,0 +1,60 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InterconnectLocationClient.ListInterconnectLocationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.GetInterconnectLocationHttpRequest; +import com.google.cloud.compute.v1.InterconnectLocation; +import com.google.cloud.compute.v1.InterconnectLocationList; +import com.google.cloud.compute.v1.ListInterconnectLocationsHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class InterconnectLocationStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + getInterconnectLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getInterconnectLocationCallable()"); + } + + @BetaApi + public UnaryCallable + listInterconnectLocationsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInterconnectLocationsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listInterconnectLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listInterconnectLocationsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectLocationStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectLocationStubSettings.java new file mode 100644 index 000000000000..2d8929b980de --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectLocationStubSettings.java @@ -0,0 +1,402 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InterconnectLocationClient.ListInterconnectLocationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.GetInterconnectLocationHttpRequest; +import com.google.cloud.compute.v1.InterconnectLocation; +import com.google.cloud.compute.v1.InterconnectLocationList; +import com.google.cloud.compute.v1.ListInterconnectLocationsHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InterconnectLocationStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getInterconnectLocation to 30 seconds: + * + *

+ * 
+ * InterconnectLocationStubSettings.Builder interconnectLocationSettingsBuilder =
+ *     InterconnectLocationStubSettings.newBuilder();
+ * interconnectLocationSettingsBuilder.getInterconnectLocationSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InterconnectLocationStubSettings interconnectLocationSettings = interconnectLocationSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InterconnectLocationStubSettings + extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + getInterconnectLocationSettings; + private final PagedCallSettings< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + ListInterconnectLocationsPagedResponse> + listInterconnectLocationsSettings; + + /** Returns the object with the settings used for calls to getInterconnectLocation. */ + public UnaryCallSettings + getInterconnectLocationSettings() { + return getInterconnectLocationSettings; + } + + /** Returns the object with the settings used for calls to listInterconnectLocations. */ + public PagedCallSettings< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + ListInterconnectLocationsPagedResponse> + listInterconnectLocationsSettings() { + return listInterconnectLocationsSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InterconnectLocationStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonInterconnectLocationStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(InterconnectLocationStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InterconnectLocationStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getInterconnectLocationSettings = settingsBuilder.getInterconnectLocationSettings().build(); + listInterconnectLocationsSettings = settingsBuilder.listInterconnectLocationsSettings().build(); + } + + private static final PagedListDescriptor< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, InterconnectLocation> + LIST_INTERCONNECT_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + InterconnectLocation>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInterconnectLocationsHttpRequest injectToken( + ListInterconnectLocationsHttpRequest payload, String token) { + return ListInterconnectLocationsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListInterconnectLocationsHttpRequest injectPageSize( + ListInterconnectLocationsHttpRequest payload, int pageSize) { + return ListInterconnectLocationsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListInterconnectLocationsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InterconnectLocationList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + InterconnectLocationList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + ListInterconnectLocationsPagedResponse> + LIST_INTERCONNECT_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + ListInterconnectLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListInterconnectLocationsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + InterconnectLocation> + pageContext = + PageContext.create( + callable, LIST_INTERCONNECT_LOCATIONS_PAGE_STR_DESC, request, context); + return ListInterconnectLocationsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + /** Builder for InterconnectLocationStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder< + GetInterconnectLocationHttpRequest, InterconnectLocation> + getInterconnectLocationSettings; + private final PagedCallSettings.Builder< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + ListInterconnectLocationsPagedResponse> + listInterconnectLocationsSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getInterconnectLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listInterconnectLocationsSettings = + PagedCallSettings.newBuilder(LIST_INTERCONNECT_LOCATIONS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getInterconnectLocationSettings, listInterconnectLocationsSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .getInterconnectLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listInterconnectLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(InterconnectLocationStubSettings settings) { + super(settings); + + getInterconnectLocationSettings = settings.getInterconnectLocationSettings.toBuilder(); + listInterconnectLocationsSettings = settings.listInterconnectLocationsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getInterconnectLocationSettings, listInterconnectLocationsSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to getInterconnectLocation. */ + public UnaryCallSettings.Builder + getInterconnectLocationSettings() { + return getInterconnectLocationSettings; + } + + /** Returns the builder for the settings used for calls to listInterconnectLocations. */ + public PagedCallSettings.Builder< + ListInterconnectLocationsHttpRequest, InterconnectLocationList, + ListInterconnectLocationsPagedResponse> + listInterconnectLocationsSettings() { + return listInterconnectLocationsSettings; + } + + @Override + public InterconnectLocationStubSettings build() throws IOException { + return new InterconnectLocationStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectStub.java new file mode 100644 index 000000000000..6dff773ec683 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectStub.java @@ -0,0 +1,76 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InterconnectClient.ListInterconnectsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteInterconnectHttpRequest; +import com.google.cloud.compute.v1.GetInterconnectHttpRequest; +import com.google.cloud.compute.v1.InsertInterconnectHttpRequest; +import com.google.cloud.compute.v1.Interconnect; +import com.google.cloud.compute.v1.InterconnectList; +import com.google.cloud.compute.v1.ListInterconnectsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchInterconnectHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class InterconnectStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteInterconnectCallable() { + throw new UnsupportedOperationException("Not implemented: deleteInterconnectCallable()"); + } + + @BetaApi + public UnaryCallable getInterconnectCallable() { + throw new UnsupportedOperationException("Not implemented: getInterconnectCallable()"); + } + + @BetaApi + public UnaryCallable insertInterconnectCallable() { + throw new UnsupportedOperationException("Not implemented: insertInterconnectCallable()"); + } + + @BetaApi + public UnaryCallable + listInterconnectsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listInterconnectsPagedCallable()"); + } + + @BetaApi + public UnaryCallable listInterconnectsCallable() { + throw new UnsupportedOperationException("Not implemented: listInterconnectsCallable()"); + } + + @BetaApi + public UnaryCallable patchInterconnectCallable() { + throw new UnsupportedOperationException("Not implemented: patchInterconnectCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectStubSettings.java new file mode 100644 index 000000000000..7f7d7d43ee8a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/InterconnectStubSettings.java @@ -0,0 +1,465 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.InterconnectClient.ListInterconnectsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteInterconnectHttpRequest; +import com.google.cloud.compute.v1.GetInterconnectHttpRequest; +import com.google.cloud.compute.v1.InsertInterconnectHttpRequest; +import com.google.cloud.compute.v1.Interconnect; +import com.google.cloud.compute.v1.InterconnectList; +import com.google.cloud.compute.v1.ListInterconnectsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchInterconnectHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link InterconnectStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteInterconnect to 30 seconds: + * + *

+ * 
+ * InterconnectStubSettings.Builder interconnectSettingsBuilder =
+ *     InterconnectStubSettings.newBuilder();
+ * interconnectSettingsBuilder.deleteInterconnectSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * InterconnectStubSettings interconnectSettings = interconnectSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class InterconnectStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteInterconnectSettings; + private final UnaryCallSettings getInterconnectSettings; + private final UnaryCallSettings + insertInterconnectSettings; + private final PagedCallSettings< + ListInterconnectsHttpRequest, InterconnectList, ListInterconnectsPagedResponse> + listInterconnectsSettings; + private final UnaryCallSettings + patchInterconnectSettings; + + /** Returns the object with the settings used for calls to deleteInterconnect. */ + public UnaryCallSettings deleteInterconnectSettings() { + return deleteInterconnectSettings; + } + + /** Returns the object with the settings used for calls to getInterconnect. */ + public UnaryCallSettings getInterconnectSettings() { + return getInterconnectSettings; + } + + /** Returns the object with the settings used for calls to insertInterconnect. */ + public UnaryCallSettings insertInterconnectSettings() { + return insertInterconnectSettings; + } + + /** Returns the object with the settings used for calls to listInterconnects. */ + public PagedCallSettings< + ListInterconnectsHttpRequest, InterconnectList, ListInterconnectsPagedResponse> + listInterconnectsSettings() { + return listInterconnectsSettings; + } + + /** Returns the object with the settings used for calls to patchInterconnect. */ + public UnaryCallSettings patchInterconnectSettings() { + return patchInterconnectSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public InterconnectStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonInterconnectStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(InterconnectStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected InterconnectStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteInterconnectSettings = settingsBuilder.deleteInterconnectSettings().build(); + getInterconnectSettings = settingsBuilder.getInterconnectSettings().build(); + insertInterconnectSettings = settingsBuilder.insertInterconnectSettings().build(); + listInterconnectsSettings = settingsBuilder.listInterconnectsSettings().build(); + patchInterconnectSettings = settingsBuilder.patchInterconnectSettings().build(); + } + + private static final PagedListDescriptor< + ListInterconnectsHttpRequest, InterconnectList, Interconnect> + LIST_INTERCONNECTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInterconnectsHttpRequest injectToken( + ListInterconnectsHttpRequest payload, String token) { + return ListInterconnectsHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListInterconnectsHttpRequest injectPageSize( + ListInterconnectsHttpRequest payload, int pageSize) { + return ListInterconnectsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListInterconnectsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(InterconnectList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(InterconnectList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListInterconnectsHttpRequest, InterconnectList, ListInterconnectsPagedResponse> + LIST_INTERCONNECTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInterconnectsHttpRequest, InterconnectList, ListInterconnectsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListInterconnectsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_INTERCONNECTS_PAGE_STR_DESC, request, context); + return ListInterconnectsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for InterconnectStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteInterconnectSettings; + private final UnaryCallSettings.Builder + getInterconnectSettings; + private final UnaryCallSettings.Builder + insertInterconnectSettings; + private final PagedCallSettings.Builder< + ListInterconnectsHttpRequest, InterconnectList, ListInterconnectsPagedResponse> + listInterconnectsSettings; + private final UnaryCallSettings.Builder + patchInterconnectSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteInterconnectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getInterconnectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertInterconnectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listInterconnectsSettings = PagedCallSettings.newBuilder(LIST_INTERCONNECTS_PAGE_STR_FACT); + + patchInterconnectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteInterconnectSettings, + getInterconnectSettings, + insertInterconnectSettings, + listInterconnectsSettings, + patchInterconnectSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteInterconnectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getInterconnectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertInterconnectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listInterconnectsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchInterconnectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(InterconnectStubSettings settings) { + super(settings); + + deleteInterconnectSettings = settings.deleteInterconnectSettings.toBuilder(); + getInterconnectSettings = settings.getInterconnectSettings.toBuilder(); + insertInterconnectSettings = settings.insertInterconnectSettings.toBuilder(); + listInterconnectsSettings = settings.listInterconnectsSettings.toBuilder(); + patchInterconnectSettings = settings.patchInterconnectSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteInterconnectSettings, + getInterconnectSettings, + insertInterconnectSettings, + listInterconnectsSettings, + patchInterconnectSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteInterconnect. */ + public UnaryCallSettings.Builder + deleteInterconnectSettings() { + return deleteInterconnectSettings; + } + + /** Returns the builder for the settings used for calls to getInterconnect. */ + public UnaryCallSettings.Builder + getInterconnectSettings() { + return getInterconnectSettings; + } + + /** Returns the builder for the settings used for calls to insertInterconnect. */ + public UnaryCallSettings.Builder + insertInterconnectSettings() { + return insertInterconnectSettings; + } + + /** Returns the builder for the settings used for calls to listInterconnects. */ + public PagedCallSettings.Builder< + ListInterconnectsHttpRequest, InterconnectList, ListInterconnectsPagedResponse> + listInterconnectsSettings() { + return listInterconnectsSettings; + } + + /** Returns the builder for the settings used for calls to patchInterconnect. */ + public UnaryCallSettings.Builder + patchInterconnectSettings() { + return patchInterconnectSettings; + } + + @Override + public InterconnectStubSettings build() throws IOException { + return new InterconnectStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseCodeStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseCodeStub.java new file mode 100644 index 000000000000..e2f43b1fa349 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseCodeStub.java @@ -0,0 +1,51 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.GetLicenseCodeHttpRequest; +import com.google.cloud.compute.v1.LicenseCode; +import com.google.cloud.compute.v1.TestIamPermissionsLicenseCodeHttpRequest; +import com.google.cloud.compute.v1.TestPermissionsResponse; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class LicenseCodeStub implements BackgroundResource { + + @BetaApi + public UnaryCallable getLicenseCodeCallable() { + throw new UnsupportedOperationException("Not implemented: getLicenseCodeCallable()"); + } + + @BetaApi + public UnaryCallable + testIamPermissionsLicenseCodeCallable() { + throw new UnsupportedOperationException( + "Not implemented: testIamPermissionsLicenseCodeCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseCodeStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseCodeStubSettings.java new file mode 100644 index 000000000000..70ffc2ff4679 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseCodeStubSettings.java @@ -0,0 +1,314 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.compute.v1.GetLicenseCodeHttpRequest; +import com.google.cloud.compute.v1.LicenseCode; +import com.google.cloud.compute.v1.TestIamPermissionsLicenseCodeHttpRequest; +import com.google.cloud.compute.v1.TestPermissionsResponse; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link LicenseCodeStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getLicenseCode to 30 seconds: + * + *

+ * 
+ * LicenseCodeStubSettings.Builder licenseCodeSettingsBuilder =
+ *     LicenseCodeStubSettings.newBuilder();
+ * licenseCodeSettingsBuilder.getLicenseCodeSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * LicenseCodeStubSettings licenseCodeSettings = licenseCodeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class LicenseCodeStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings getLicenseCodeSettings; + private final UnaryCallSettings + testIamPermissionsLicenseCodeSettings; + + /** Returns the object with the settings used for calls to getLicenseCode. */ + public UnaryCallSettings getLicenseCodeSettings() { + return getLicenseCodeSettings; + } + + /** Returns the object with the settings used for calls to testIamPermissionsLicenseCode. */ + public UnaryCallSettings + testIamPermissionsLicenseCodeSettings() { + return testIamPermissionsLicenseCodeSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public LicenseCodeStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonLicenseCodeStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(LicenseCodeStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected LicenseCodeStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getLicenseCodeSettings = settingsBuilder.getLicenseCodeSettings().build(); + testIamPermissionsLicenseCodeSettings = + settingsBuilder.testIamPermissionsLicenseCodeSettings().build(); + } + + /** Builder for LicenseCodeStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + getLicenseCodeSettings; + private final UnaryCallSettings.Builder< + TestIamPermissionsLicenseCodeHttpRequest, TestPermissionsResponse> + testIamPermissionsLicenseCodeSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getLicenseCodeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + testIamPermissionsLicenseCodeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getLicenseCodeSettings, testIamPermissionsLicenseCodeSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .getLicenseCodeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .testIamPermissionsLicenseCodeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(LicenseCodeStubSettings settings) { + super(settings); + + getLicenseCodeSettings = settings.getLicenseCodeSettings.toBuilder(); + testIamPermissionsLicenseCodeSettings = + settings.testIamPermissionsLicenseCodeSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getLicenseCodeSettings, testIamPermissionsLicenseCodeSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to getLicenseCode. */ + public UnaryCallSettings.Builder + getLicenseCodeSettings() { + return getLicenseCodeSettings; + } + + /** Returns the builder for the settings used for calls to testIamPermissionsLicenseCode. */ + public UnaryCallSettings.Builder< + TestIamPermissionsLicenseCodeHttpRequest, TestPermissionsResponse> + testIamPermissionsLicenseCodeSettings() { + return testIamPermissionsLicenseCodeSettings; + } + + @Override + public LicenseCodeStubSettings build() throws IOException { + return new LicenseCodeStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseStub.java new file mode 100644 index 000000000000..e0210ccedad2 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseStub.java @@ -0,0 +1,78 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.LicenseClient.ListLicensesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteLicenseHttpRequest; +import com.google.cloud.compute.v1.GetLicenseHttpRequest; +import com.google.cloud.compute.v1.InsertLicenseHttpRequest; +import com.google.cloud.compute.v1.License; +import com.google.cloud.compute.v1.LicensesListResponse; +import com.google.cloud.compute.v1.ListLicensesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.TestIamPermissionsLicenseHttpRequest; +import com.google.cloud.compute.v1.TestPermissionsResponse; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class LicenseStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteLicenseCallable() { + throw new UnsupportedOperationException("Not implemented: deleteLicenseCallable()"); + } + + @BetaApi + public UnaryCallable getLicenseCallable() { + throw new UnsupportedOperationException("Not implemented: getLicenseCallable()"); + } + + @BetaApi + public UnaryCallable insertLicenseCallable() { + throw new UnsupportedOperationException("Not implemented: insertLicenseCallable()"); + } + + @BetaApi + public UnaryCallable + listLicensesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLicensesPagedCallable()"); + } + + @BetaApi + public UnaryCallable listLicensesCallable() { + throw new UnsupportedOperationException("Not implemented: listLicensesCallable()"); + } + + @BetaApi + public UnaryCallable + testIamPermissionsLicenseCallable() { + throw new UnsupportedOperationException("Not implemented: testIamPermissionsLicenseCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseStubSettings.java new file mode 100644 index 000000000000..1fc3748ed609 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/LicenseStubSettings.java @@ -0,0 +1,455 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.LicenseClient.ListLicensesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteLicenseHttpRequest; +import com.google.cloud.compute.v1.GetLicenseHttpRequest; +import com.google.cloud.compute.v1.InsertLicenseHttpRequest; +import com.google.cloud.compute.v1.License; +import com.google.cloud.compute.v1.LicensesListResponse; +import com.google.cloud.compute.v1.ListLicensesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.TestIamPermissionsLicenseHttpRequest; +import com.google.cloud.compute.v1.TestPermissionsResponse; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link LicenseStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteLicense to 30 seconds: + * + *

+ * 
+ * LicenseStubSettings.Builder licenseSettingsBuilder =
+ *     LicenseStubSettings.newBuilder();
+ * licenseSettingsBuilder.deleteLicenseSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * LicenseStubSettings licenseSettings = licenseSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class LicenseStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings deleteLicenseSettings; + private final UnaryCallSettings getLicenseSettings; + private final UnaryCallSettings insertLicenseSettings; + private final PagedCallSettings< + ListLicensesHttpRequest, LicensesListResponse, ListLicensesPagedResponse> + listLicensesSettings; + private final UnaryCallSettings + testIamPermissionsLicenseSettings; + + /** Returns the object with the settings used for calls to deleteLicense. */ + public UnaryCallSettings deleteLicenseSettings() { + return deleteLicenseSettings; + } + + /** Returns the object with the settings used for calls to getLicense. */ + public UnaryCallSettings getLicenseSettings() { + return getLicenseSettings; + } + + /** Returns the object with the settings used for calls to insertLicense. */ + public UnaryCallSettings insertLicenseSettings() { + return insertLicenseSettings; + } + + /** Returns the object with the settings used for calls to listLicenses. */ + public PagedCallSettings + listLicensesSettings() { + return listLicensesSettings; + } + + /** Returns the object with the settings used for calls to testIamPermissionsLicense. */ + public UnaryCallSettings + testIamPermissionsLicenseSettings() { + return testIamPermissionsLicenseSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public LicenseStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonLicenseStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(LicenseStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected LicenseStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteLicenseSettings = settingsBuilder.deleteLicenseSettings().build(); + getLicenseSettings = settingsBuilder.getLicenseSettings().build(); + insertLicenseSettings = settingsBuilder.insertLicenseSettings().build(); + listLicensesSettings = settingsBuilder.listLicensesSettings().build(); + testIamPermissionsLicenseSettings = settingsBuilder.testIamPermissionsLicenseSettings().build(); + } + + private static final PagedListDescriptor + LIST_LICENSES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLicensesHttpRequest injectToken( + ListLicensesHttpRequest payload, String token) { + return ListLicensesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLicensesHttpRequest injectPageSize( + ListLicensesHttpRequest payload, int pageSize) { + return ListLicensesHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLicensesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(LicensesListResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(LicensesListResponse payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListLicensesHttpRequest, LicensesListResponse, ListLicensesPagedResponse> + LIST_LICENSES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLicensesHttpRequest, LicensesListResponse, ListLicensesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLicensesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LICENSES_PAGE_STR_DESC, request, context); + return ListLicensesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for LicenseStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteLicenseSettings; + private final UnaryCallSettings.Builder getLicenseSettings; + private final UnaryCallSettings.Builder + insertLicenseSettings; + private final PagedCallSettings.Builder< + ListLicensesHttpRequest, LicensesListResponse, ListLicensesPagedResponse> + listLicensesSettings; + private final UnaryCallSettings.Builder< + TestIamPermissionsLicenseHttpRequest, TestPermissionsResponse> + testIamPermissionsLicenseSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteLicenseSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getLicenseSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertLicenseSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listLicensesSettings = PagedCallSettings.newBuilder(LIST_LICENSES_PAGE_STR_FACT); + + testIamPermissionsLicenseSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteLicenseSettings, + getLicenseSettings, + insertLicenseSettings, + listLicensesSettings, + testIamPermissionsLicenseSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteLicenseSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getLicenseSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertLicenseSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listLicensesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .testIamPermissionsLicenseSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(LicenseStubSettings settings) { + super(settings); + + deleteLicenseSettings = settings.deleteLicenseSettings.toBuilder(); + getLicenseSettings = settings.getLicenseSettings.toBuilder(); + insertLicenseSettings = settings.insertLicenseSettings.toBuilder(); + listLicensesSettings = settings.listLicensesSettings.toBuilder(); + testIamPermissionsLicenseSettings = settings.testIamPermissionsLicenseSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteLicenseSettings, + getLicenseSettings, + insertLicenseSettings, + listLicensesSettings, + testIamPermissionsLicenseSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteLicense. */ + public UnaryCallSettings.Builder deleteLicenseSettings() { + return deleteLicenseSettings; + } + + /** Returns the builder for the settings used for calls to getLicense. */ + public UnaryCallSettings.Builder getLicenseSettings() { + return getLicenseSettings; + } + + /** Returns the builder for the settings used for calls to insertLicense. */ + public UnaryCallSettings.Builder insertLicenseSettings() { + return insertLicenseSettings; + } + + /** Returns the builder for the settings used for calls to listLicenses. */ + public PagedCallSettings.Builder< + ListLicensesHttpRequest, LicensesListResponse, ListLicensesPagedResponse> + listLicensesSettings() { + return listLicensesSettings; + } + + /** Returns the builder for the settings used for calls to testIamPermissionsLicense. */ + public UnaryCallSettings.Builder + testIamPermissionsLicenseSettings() { + return testIamPermissionsLicenseSettings; + } + + @Override + public LicenseStubSettings build() throws IOException { + return new LicenseStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/MachineTypeStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/MachineTypeStub.java new file mode 100644 index 000000000000..3890bfb9c6c9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/MachineTypeStub.java @@ -0,0 +1,75 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.MachineTypeClient.AggregatedListMachineTypesPagedResponse; +import static com.google.cloud.compute.v1.MachineTypeClient.ListMachineTypesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListMachineTypesHttpRequest; +import com.google.cloud.compute.v1.GetMachineTypeHttpRequest; +import com.google.cloud.compute.v1.ListMachineTypesHttpRequest; +import com.google.cloud.compute.v1.MachineType; +import com.google.cloud.compute.v1.MachineTypeAggregatedList; +import com.google.cloud.compute.v1.MachineTypeList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class MachineTypeStub implements BackgroundResource { + + @BetaApi + public UnaryCallable< + AggregatedListMachineTypesHttpRequest, AggregatedListMachineTypesPagedResponse> + aggregatedListMachineTypesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListMachineTypesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListMachineTypesCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListMachineTypesCallable()"); + } + + @BetaApi + public UnaryCallable getMachineTypeCallable() { + throw new UnsupportedOperationException("Not implemented: getMachineTypeCallable()"); + } + + @BetaApi + public UnaryCallable + listMachineTypesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listMachineTypesPagedCallable()"); + } + + @BetaApi + public UnaryCallable listMachineTypesCallable() { + throw new UnsupportedOperationException("Not implemented: listMachineTypesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/MachineTypeStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/MachineTypeStubSettings.java new file mode 100644 index 000000000000..fdd22baca8b8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/MachineTypeStubSettings.java @@ -0,0 +1,487 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.MachineTypeClient.AggregatedListMachineTypesPagedResponse; +import static com.google.cloud.compute.v1.MachineTypeClient.ListMachineTypesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListMachineTypesHttpRequest; +import com.google.cloud.compute.v1.GetMachineTypeHttpRequest; +import com.google.cloud.compute.v1.ListMachineTypesHttpRequest; +import com.google.cloud.compute.v1.MachineType; +import com.google.cloud.compute.v1.MachineTypeAggregatedList; +import com.google.cloud.compute.v1.MachineTypeList; +import com.google.cloud.compute.v1.MachineTypesScopedList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link MachineTypeStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getMachineType to 30 seconds: + * + *

+ * 
+ * MachineTypeStubSettings.Builder machineTypeSettingsBuilder =
+ *     MachineTypeStubSettings.newBuilder();
+ * machineTypeSettingsBuilder.getMachineTypeSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * MachineTypeStubSettings machineTypeSettings = machineTypeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class MachineTypeStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + AggregatedListMachineTypesPagedResponse> + aggregatedListMachineTypesSettings; + private final UnaryCallSettings getMachineTypeSettings; + private final PagedCallSettings< + ListMachineTypesHttpRequest, MachineTypeList, ListMachineTypesPagedResponse> + listMachineTypesSettings; + + /** Returns the object with the settings used for calls to aggregatedListMachineTypes. */ + public PagedCallSettings< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + AggregatedListMachineTypesPagedResponse> + aggregatedListMachineTypesSettings() { + return aggregatedListMachineTypesSettings; + } + + /** Returns the object with the settings used for calls to getMachineType. */ + public UnaryCallSettings getMachineTypeSettings() { + return getMachineTypeSettings; + } + + /** Returns the object with the settings used for calls to listMachineTypes. */ + public PagedCallSettings< + ListMachineTypesHttpRequest, MachineTypeList, ListMachineTypesPagedResponse> + listMachineTypesSettings() { + return listMachineTypesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public MachineTypeStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonMachineTypeStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(MachineTypeStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected MachineTypeStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListMachineTypesSettings = + settingsBuilder.aggregatedListMachineTypesSettings().build(); + getMachineTypeSettings = settingsBuilder.getMachineTypeSettings().build(); + listMachineTypesSettings = settingsBuilder.listMachineTypesSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, MachineTypesScopedList> + AGGREGATED_LIST_MACHINE_TYPES_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + MachineTypesScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListMachineTypesHttpRequest injectToken( + AggregatedListMachineTypesHttpRequest payload, String token) { + return AggregatedListMachineTypesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListMachineTypesHttpRequest injectPageSize( + AggregatedListMachineTypesHttpRequest payload, int pageSize) { + return AggregatedListMachineTypesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListMachineTypesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(MachineTypeAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + MachineTypeAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor< + ListMachineTypesHttpRequest, MachineTypeList, MachineType> + LIST_MACHINE_TYPES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListMachineTypesHttpRequest injectToken( + ListMachineTypesHttpRequest payload, String token) { + return ListMachineTypesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListMachineTypesHttpRequest injectPageSize( + ListMachineTypesHttpRequest payload, int pageSize) { + return ListMachineTypesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListMachineTypesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(MachineTypeList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(MachineTypeList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + AggregatedListMachineTypesPagedResponse> + AGGREGATED_LIST_MACHINE_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + AggregatedListMachineTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + AggregatedListMachineTypesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + MachineTypesScopedList> + pageContext = + PageContext.create( + callable, AGGREGATED_LIST_MACHINE_TYPES_PAGE_STR_DESC, request, context); + return AggregatedListMachineTypesPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListMachineTypesHttpRequest, MachineTypeList, ListMachineTypesPagedResponse> + LIST_MACHINE_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListMachineTypesHttpRequest, MachineTypeList, ListMachineTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListMachineTypesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_MACHINE_TYPES_PAGE_STR_DESC, request, context); + return ListMachineTypesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for MachineTypeStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + AggregatedListMachineTypesPagedResponse> + aggregatedListMachineTypesSettings; + private final UnaryCallSettings.Builder + getMachineTypeSettings; + private final PagedCallSettings.Builder< + ListMachineTypesHttpRequest, MachineTypeList, ListMachineTypesPagedResponse> + listMachineTypesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListMachineTypesSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_MACHINE_TYPES_PAGE_STR_FACT); + + getMachineTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listMachineTypesSettings = PagedCallSettings.newBuilder(LIST_MACHINE_TYPES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListMachineTypesSettings, getMachineTypeSettings, listMachineTypesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListMachineTypesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getMachineTypeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listMachineTypesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(MachineTypeStubSettings settings) { + super(settings); + + aggregatedListMachineTypesSettings = settings.aggregatedListMachineTypesSettings.toBuilder(); + getMachineTypeSettings = settings.getMachineTypeSettings.toBuilder(); + listMachineTypesSettings = settings.listMachineTypesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListMachineTypesSettings, getMachineTypeSettings, listMachineTypesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListMachineTypes. */ + public PagedCallSettings.Builder< + AggregatedListMachineTypesHttpRequest, MachineTypeAggregatedList, + AggregatedListMachineTypesPagedResponse> + aggregatedListMachineTypesSettings() { + return aggregatedListMachineTypesSettings; + } + + /** Returns the builder for the settings used for calls to getMachineType. */ + public UnaryCallSettings.Builder + getMachineTypeSettings() { + return getMachineTypeSettings; + } + + /** Returns the builder for the settings used for calls to listMachineTypes. */ + public PagedCallSettings.Builder< + ListMachineTypesHttpRequest, MachineTypeList, ListMachineTypesPagedResponse> + listMachineTypesSettings() { + return listMachineTypesSettings; + } + + @Override + public MachineTypeStubSettings build() throws IOException { + return new MachineTypeStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/NetworkStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/NetworkStub.java new file mode 100644 index 000000000000..e46a6238a8aa --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/NetworkStub.java @@ -0,0 +1,95 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.NetworkClient.ListNetworksPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AddPeeringNetworkHttpRequest; +import com.google.cloud.compute.v1.DeleteNetworkHttpRequest; +import com.google.cloud.compute.v1.GetNetworkHttpRequest; +import com.google.cloud.compute.v1.InsertNetworkHttpRequest; +import com.google.cloud.compute.v1.ListNetworksHttpRequest; +import com.google.cloud.compute.v1.Network; +import com.google.cloud.compute.v1.NetworkList; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchNetworkHttpRequest; +import com.google.cloud.compute.v1.RemovePeeringNetworkHttpRequest; +import com.google.cloud.compute.v1.SwitchToCustomModeNetworkHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class NetworkStub implements BackgroundResource { + + @BetaApi + public UnaryCallable addPeeringNetworkCallable() { + throw new UnsupportedOperationException("Not implemented: addPeeringNetworkCallable()"); + } + + @BetaApi + public UnaryCallable deleteNetworkCallable() { + throw new UnsupportedOperationException("Not implemented: deleteNetworkCallable()"); + } + + @BetaApi + public UnaryCallable getNetworkCallable() { + throw new UnsupportedOperationException("Not implemented: getNetworkCallable()"); + } + + @BetaApi + public UnaryCallable insertNetworkCallable() { + throw new UnsupportedOperationException("Not implemented: insertNetworkCallable()"); + } + + @BetaApi + public UnaryCallable + listNetworksPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listNetworksPagedCallable()"); + } + + @BetaApi + public UnaryCallable listNetworksCallable() { + throw new UnsupportedOperationException("Not implemented: listNetworksCallable()"); + } + + @BetaApi + public UnaryCallable patchNetworkCallable() { + throw new UnsupportedOperationException("Not implemented: patchNetworkCallable()"); + } + + @BetaApi + public UnaryCallable removePeeringNetworkCallable() { + throw new UnsupportedOperationException("Not implemented: removePeeringNetworkCallable()"); + } + + @BetaApi + public UnaryCallable + switchToCustomModeNetworkCallable() { + throw new UnsupportedOperationException("Not implemented: switchToCustomModeNetworkCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/NetworkStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/NetworkStubSettings.java new file mode 100644 index 000000000000..e025cedc2c13 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/NetworkStubSettings.java @@ -0,0 +1,532 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.NetworkClient.ListNetworksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AddPeeringNetworkHttpRequest; +import com.google.cloud.compute.v1.DeleteNetworkHttpRequest; +import com.google.cloud.compute.v1.GetNetworkHttpRequest; +import com.google.cloud.compute.v1.InsertNetworkHttpRequest; +import com.google.cloud.compute.v1.ListNetworksHttpRequest; +import com.google.cloud.compute.v1.Network; +import com.google.cloud.compute.v1.NetworkList; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchNetworkHttpRequest; +import com.google.cloud.compute.v1.RemovePeeringNetworkHttpRequest; +import com.google.cloud.compute.v1.SwitchToCustomModeNetworkHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link NetworkStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of addPeeringNetwork to 30 seconds: + * + *

+ * 
+ * NetworkStubSettings.Builder networkSettingsBuilder =
+ *     NetworkStubSettings.newBuilder();
+ * networkSettingsBuilder.addPeeringNetworkSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * NetworkStubSettings networkSettings = networkSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class NetworkStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + addPeeringNetworkSettings; + private final UnaryCallSettings deleteNetworkSettings; + private final UnaryCallSettings getNetworkSettings; + private final UnaryCallSettings insertNetworkSettings; + private final PagedCallSettings + listNetworksSettings; + private final UnaryCallSettings patchNetworkSettings; + private final UnaryCallSettings + removePeeringNetworkSettings; + private final UnaryCallSettings + switchToCustomModeNetworkSettings; + + /** Returns the object with the settings used for calls to addPeeringNetwork. */ + public UnaryCallSettings addPeeringNetworkSettings() { + return addPeeringNetworkSettings; + } + + /** Returns the object with the settings used for calls to deleteNetwork. */ + public UnaryCallSettings deleteNetworkSettings() { + return deleteNetworkSettings; + } + + /** Returns the object with the settings used for calls to getNetwork. */ + public UnaryCallSettings getNetworkSettings() { + return getNetworkSettings; + } + + /** Returns the object with the settings used for calls to insertNetwork. */ + public UnaryCallSettings insertNetworkSettings() { + return insertNetworkSettings; + } + + /** Returns the object with the settings used for calls to listNetworks. */ + public PagedCallSettings + listNetworksSettings() { + return listNetworksSettings; + } + + /** Returns the object with the settings used for calls to patchNetwork. */ + public UnaryCallSettings patchNetworkSettings() { + return patchNetworkSettings; + } + + /** Returns the object with the settings used for calls to removePeeringNetwork. */ + public UnaryCallSettings + removePeeringNetworkSettings() { + return removePeeringNetworkSettings; + } + + /** Returns the object with the settings used for calls to switchToCustomModeNetwork. */ + public UnaryCallSettings + switchToCustomModeNetworkSettings() { + return switchToCustomModeNetworkSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public NetworkStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonNetworkStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(NetworkStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected NetworkStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + addPeeringNetworkSettings = settingsBuilder.addPeeringNetworkSettings().build(); + deleteNetworkSettings = settingsBuilder.deleteNetworkSettings().build(); + getNetworkSettings = settingsBuilder.getNetworkSettings().build(); + insertNetworkSettings = settingsBuilder.insertNetworkSettings().build(); + listNetworksSettings = settingsBuilder.listNetworksSettings().build(); + patchNetworkSettings = settingsBuilder.patchNetworkSettings().build(); + removePeeringNetworkSettings = settingsBuilder.removePeeringNetworkSettings().build(); + switchToCustomModeNetworkSettings = settingsBuilder.switchToCustomModeNetworkSettings().build(); + } + + private static final PagedListDescriptor + LIST_NETWORKS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListNetworksHttpRequest injectToken( + ListNetworksHttpRequest payload, String token) { + return ListNetworksHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListNetworksHttpRequest injectPageSize( + ListNetworksHttpRequest payload, int pageSize) { + return ListNetworksHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListNetworksHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(NetworkList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(NetworkList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListNetworksHttpRequest, NetworkList, ListNetworksPagedResponse> + LIST_NETWORKS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListNetworksHttpRequest, NetworkList, ListNetworksPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListNetworksHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_NETWORKS_PAGE_STR_DESC, request, context); + return ListNetworksPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for NetworkStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + addPeeringNetworkSettings; + private final UnaryCallSettings.Builder + deleteNetworkSettings; + private final UnaryCallSettings.Builder getNetworkSettings; + private final UnaryCallSettings.Builder + insertNetworkSettings; + private final PagedCallSettings.Builder< + ListNetworksHttpRequest, NetworkList, ListNetworksPagedResponse> + listNetworksSettings; + private final UnaryCallSettings.Builder + patchNetworkSettings; + private final UnaryCallSettings.Builder + removePeeringNetworkSettings; + private final UnaryCallSettings.Builder + switchToCustomModeNetworkSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + addPeeringNetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteNetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getNetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertNetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listNetworksSettings = PagedCallSettings.newBuilder(LIST_NETWORKS_PAGE_STR_FACT); + + patchNetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + removePeeringNetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + switchToCustomModeNetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + addPeeringNetworkSettings, + deleteNetworkSettings, + getNetworkSettings, + insertNetworkSettings, + listNetworksSettings, + patchNetworkSettings, + removePeeringNetworkSettings, + switchToCustomModeNetworkSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .addPeeringNetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteNetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getNetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertNetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listNetworksSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchNetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .removePeeringNetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .switchToCustomModeNetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(NetworkStubSettings settings) { + super(settings); + + addPeeringNetworkSettings = settings.addPeeringNetworkSettings.toBuilder(); + deleteNetworkSettings = settings.deleteNetworkSettings.toBuilder(); + getNetworkSettings = settings.getNetworkSettings.toBuilder(); + insertNetworkSettings = settings.insertNetworkSettings.toBuilder(); + listNetworksSettings = settings.listNetworksSettings.toBuilder(); + patchNetworkSettings = settings.patchNetworkSettings.toBuilder(); + removePeeringNetworkSettings = settings.removePeeringNetworkSettings.toBuilder(); + switchToCustomModeNetworkSettings = settings.switchToCustomModeNetworkSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + addPeeringNetworkSettings, + deleteNetworkSettings, + getNetworkSettings, + insertNetworkSettings, + listNetworksSettings, + patchNetworkSettings, + removePeeringNetworkSettings, + switchToCustomModeNetworkSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to addPeeringNetwork. */ + public UnaryCallSettings.Builder + addPeeringNetworkSettings() { + return addPeeringNetworkSettings; + } + + /** Returns the builder for the settings used for calls to deleteNetwork. */ + public UnaryCallSettings.Builder deleteNetworkSettings() { + return deleteNetworkSettings; + } + + /** Returns the builder for the settings used for calls to getNetwork. */ + public UnaryCallSettings.Builder getNetworkSettings() { + return getNetworkSettings; + } + + /** Returns the builder for the settings used for calls to insertNetwork. */ + public UnaryCallSettings.Builder insertNetworkSettings() { + return insertNetworkSettings; + } + + /** Returns the builder for the settings used for calls to listNetworks. */ + public PagedCallSettings.Builder< + ListNetworksHttpRequest, NetworkList, ListNetworksPagedResponse> + listNetworksSettings() { + return listNetworksSettings; + } + + /** Returns the builder for the settings used for calls to patchNetwork. */ + public UnaryCallSettings.Builder patchNetworkSettings() { + return patchNetworkSettings; + } + + /** Returns the builder for the settings used for calls to removePeeringNetwork. */ + public UnaryCallSettings.Builder + removePeeringNetworkSettings() { + return removePeeringNetworkSettings; + } + + /** Returns the builder for the settings used for calls to switchToCustomModeNetwork. */ + public UnaryCallSettings.Builder + switchToCustomModeNetworkSettings() { + return switchToCustomModeNetworkSettings; + } + + @Override + public NetworkStubSettings build() throws IOException { + return new NetworkStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ProjectStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ProjectStub.java new file mode 100644 index 000000000000..9b4c006575de --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ProjectStub.java @@ -0,0 +1,136 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ProjectClient.GetXpnResourcesProjectsPagedResponse; +import static com.google.cloud.compute.v1.ProjectClient.ListXpnHostsProjectsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DisableXpnHostProjectHttpRequest; +import com.google.cloud.compute.v1.DisableXpnResourceProjectHttpRequest; +import com.google.cloud.compute.v1.EnableXpnHostProjectHttpRequest; +import com.google.cloud.compute.v1.EnableXpnResourceProjectHttpRequest; +import com.google.cloud.compute.v1.GetProjectHttpRequest; +import com.google.cloud.compute.v1.GetXpnHostProjectHttpRequest; +import com.google.cloud.compute.v1.GetXpnResourcesProjectsHttpRequest; +import com.google.cloud.compute.v1.ListXpnHostsProjectsHttpRequest; +import com.google.cloud.compute.v1.MoveDiskProjectHttpRequest; +import com.google.cloud.compute.v1.MoveInstanceProjectHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.Project; +import com.google.cloud.compute.v1.ProjectsGetXpnResources; +import com.google.cloud.compute.v1.SetCommonInstanceMetadataProjectHttpRequest; +import com.google.cloud.compute.v1.SetUsageExportBucketProjectHttpRequest; +import com.google.cloud.compute.v1.XpnHostList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class ProjectStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + disableXpnHostProjectCallable() { + throw new UnsupportedOperationException("Not implemented: disableXpnHostProjectCallable()"); + } + + @BetaApi + public UnaryCallable + disableXpnResourceProjectCallable() { + throw new UnsupportedOperationException("Not implemented: disableXpnResourceProjectCallable()"); + } + + @BetaApi + public UnaryCallable enableXpnHostProjectCallable() { + throw new UnsupportedOperationException("Not implemented: enableXpnHostProjectCallable()"); + } + + @BetaApi + public UnaryCallable + enableXpnResourceProjectCallable() { + throw new UnsupportedOperationException("Not implemented: enableXpnResourceProjectCallable()"); + } + + @BetaApi + public UnaryCallable getProjectCallable() { + throw new UnsupportedOperationException("Not implemented: getProjectCallable()"); + } + + @BetaApi + public UnaryCallable getXpnHostProjectCallable() { + throw new UnsupportedOperationException("Not implemented: getXpnHostProjectCallable()"); + } + + @BetaApi + public UnaryCallable + getXpnResourcesProjectsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: getXpnResourcesProjectsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + getXpnResourcesProjectsCallable() { + throw new UnsupportedOperationException("Not implemented: getXpnResourcesProjectsCallable()"); + } + + @BetaApi + public UnaryCallable + listXpnHostsProjectsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listXpnHostsProjectsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listXpnHostsProjectsCallable() { + throw new UnsupportedOperationException("Not implemented: listXpnHostsProjectsCallable()"); + } + + @BetaApi + public UnaryCallable moveDiskProjectCallable() { + throw new UnsupportedOperationException("Not implemented: moveDiskProjectCallable()"); + } + + @BetaApi + public UnaryCallable moveInstanceProjectCallable() { + throw new UnsupportedOperationException("Not implemented: moveInstanceProjectCallable()"); + } + + @BetaApi + public UnaryCallable + setCommonInstanceMetadataProjectCallable() { + throw new UnsupportedOperationException( + "Not implemented: setCommonInstanceMetadataProjectCallable()"); + } + + @BetaApi + public UnaryCallable + setUsageExportBucketProjectCallable() { + throw new UnsupportedOperationException( + "Not implemented: setUsageExportBucketProjectCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ProjectStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ProjectStubSettings.java new file mode 100644 index 000000000000..a73d61425054 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ProjectStubSettings.java @@ -0,0 +1,738 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ProjectClient.GetXpnResourcesProjectsPagedResponse; +import static com.google.cloud.compute.v1.ProjectClient.ListXpnHostsProjectsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DisableXpnHostProjectHttpRequest; +import com.google.cloud.compute.v1.DisableXpnResourceProjectHttpRequest; +import com.google.cloud.compute.v1.EnableXpnHostProjectHttpRequest; +import com.google.cloud.compute.v1.EnableXpnResourceProjectHttpRequest; +import com.google.cloud.compute.v1.GetProjectHttpRequest; +import com.google.cloud.compute.v1.GetXpnHostProjectHttpRequest; +import com.google.cloud.compute.v1.GetXpnResourcesProjectsHttpRequest; +import com.google.cloud.compute.v1.ListXpnHostsProjectsHttpRequest; +import com.google.cloud.compute.v1.MoveDiskProjectHttpRequest; +import com.google.cloud.compute.v1.MoveInstanceProjectHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.Project; +import com.google.cloud.compute.v1.ProjectsGetXpnResources; +import com.google.cloud.compute.v1.SetCommonInstanceMetadataProjectHttpRequest; +import com.google.cloud.compute.v1.SetUsageExportBucketProjectHttpRequest; +import com.google.cloud.compute.v1.XpnHostList; +import com.google.cloud.compute.v1.XpnResourceId; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link ProjectStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of disableXpnHostProject to 30 seconds: + * + *

+ * 
+ * ProjectStubSettings.Builder projectSettingsBuilder =
+ *     ProjectStubSettings.newBuilder();
+ * projectSettingsBuilder.disableXpnHostProjectSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * ProjectStubSettings projectSettings = projectSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ProjectStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + disableXpnHostProjectSettings; + private final UnaryCallSettings + disableXpnResourceProjectSettings; + private final UnaryCallSettings + enableXpnHostProjectSettings; + private final UnaryCallSettings + enableXpnResourceProjectSettings; + private final UnaryCallSettings getProjectSettings; + private final UnaryCallSettings getXpnHostProjectSettings; + private final PagedCallSettings< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, + GetXpnResourcesProjectsPagedResponse> + getXpnResourcesProjectsSettings; + private final PagedCallSettings< + ListXpnHostsProjectsHttpRequest, XpnHostList, ListXpnHostsProjectsPagedResponse> + listXpnHostsProjectsSettings; + private final UnaryCallSettings moveDiskProjectSettings; + private final UnaryCallSettings + moveInstanceProjectSettings; + private final UnaryCallSettings + setCommonInstanceMetadataProjectSettings; + private final UnaryCallSettings + setUsageExportBucketProjectSettings; + + /** Returns the object with the settings used for calls to disableXpnHostProject. */ + public UnaryCallSettings + disableXpnHostProjectSettings() { + return disableXpnHostProjectSettings; + } + + /** Returns the object with the settings used for calls to disableXpnResourceProject. */ + public UnaryCallSettings + disableXpnResourceProjectSettings() { + return disableXpnResourceProjectSettings; + } + + /** Returns the object with the settings used for calls to enableXpnHostProject. */ + public UnaryCallSettings + enableXpnHostProjectSettings() { + return enableXpnHostProjectSettings; + } + + /** Returns the object with the settings used for calls to enableXpnResourceProject. */ + public UnaryCallSettings + enableXpnResourceProjectSettings() { + return enableXpnResourceProjectSettings; + } + + /** Returns the object with the settings used for calls to getProject. */ + public UnaryCallSettings getProjectSettings() { + return getProjectSettings; + } + + /** Returns the object with the settings used for calls to getXpnHostProject. */ + public UnaryCallSettings getXpnHostProjectSettings() { + return getXpnHostProjectSettings; + } + + /** Returns the object with the settings used for calls to getXpnResourcesProjects. */ + public PagedCallSettings< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, + GetXpnResourcesProjectsPagedResponse> + getXpnResourcesProjectsSettings() { + return getXpnResourcesProjectsSettings; + } + + /** Returns the object with the settings used for calls to listXpnHostsProjects. */ + public PagedCallSettings< + ListXpnHostsProjectsHttpRequest, XpnHostList, ListXpnHostsProjectsPagedResponse> + listXpnHostsProjectsSettings() { + return listXpnHostsProjectsSettings; + } + + /** Returns the object with the settings used for calls to moveDiskProject. */ + public UnaryCallSettings moveDiskProjectSettings() { + return moveDiskProjectSettings; + } + + /** Returns the object with the settings used for calls to moveInstanceProject. */ + public UnaryCallSettings + moveInstanceProjectSettings() { + return moveInstanceProjectSettings; + } + + /** Returns the object with the settings used for calls to setCommonInstanceMetadataProject. */ + public UnaryCallSettings + setCommonInstanceMetadataProjectSettings() { + return setCommonInstanceMetadataProjectSettings; + } + + /** Returns the object with the settings used for calls to setUsageExportBucketProject. */ + public UnaryCallSettings + setUsageExportBucketProjectSettings() { + return setUsageExportBucketProjectSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ProjectStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonProjectStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(ProjectStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ProjectStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + disableXpnHostProjectSettings = settingsBuilder.disableXpnHostProjectSettings().build(); + disableXpnResourceProjectSettings = settingsBuilder.disableXpnResourceProjectSettings().build(); + enableXpnHostProjectSettings = settingsBuilder.enableXpnHostProjectSettings().build(); + enableXpnResourceProjectSettings = settingsBuilder.enableXpnResourceProjectSettings().build(); + getProjectSettings = settingsBuilder.getProjectSettings().build(); + getXpnHostProjectSettings = settingsBuilder.getXpnHostProjectSettings().build(); + getXpnResourcesProjectsSettings = settingsBuilder.getXpnResourcesProjectsSettings().build(); + listXpnHostsProjectsSettings = settingsBuilder.listXpnHostsProjectsSettings().build(); + moveDiskProjectSettings = settingsBuilder.moveDiskProjectSettings().build(); + moveInstanceProjectSettings = settingsBuilder.moveInstanceProjectSettings().build(); + setCommonInstanceMetadataProjectSettings = + settingsBuilder.setCommonInstanceMetadataProjectSettings().build(); + setUsageExportBucketProjectSettings = + settingsBuilder.setUsageExportBucketProjectSettings().build(); + } + + private static final PagedListDescriptor< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, XpnResourceId> + GET_XPN_RESOURCES_PROJECTS_PAGE_STR_DESC = + new PagedListDescriptor< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, XpnResourceId>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public GetXpnResourcesProjectsHttpRequest injectToken( + GetXpnResourcesProjectsHttpRequest payload, String token) { + return GetXpnResourcesProjectsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public GetXpnResourcesProjectsHttpRequest injectPageSize( + GetXpnResourcesProjectsHttpRequest payload, int pageSize) { + return GetXpnResourcesProjectsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(GetXpnResourcesProjectsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(ProjectsGetXpnResources payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ProjectsGetXpnResources payload) { + return payload.getResourcesList(); + } + }; + + private static final PagedListDescriptor + LIST_XPN_HOSTS_PROJECTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListXpnHostsProjectsHttpRequest injectToken( + ListXpnHostsProjectsHttpRequest payload, String token) { + return ListXpnHostsProjectsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListXpnHostsProjectsHttpRequest injectPageSize( + ListXpnHostsProjectsHttpRequest payload, int pageSize) { + return ListXpnHostsProjectsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListXpnHostsProjectsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(XpnHostList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(XpnHostList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, + GetXpnResourcesProjectsPagedResponse> + GET_XPN_RESOURCES_PROJECTS_PAGE_STR_FACT = + new PagedListResponseFactory< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, + GetXpnResourcesProjectsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + GetXpnResourcesProjectsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, XpnResourceId> + pageContext = + PageContext.create( + callable, GET_XPN_RESOURCES_PROJECTS_PAGE_STR_DESC, request, context); + return GetXpnResourcesProjectsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListXpnHostsProjectsHttpRequest, XpnHostList, ListXpnHostsProjectsPagedResponse> + LIST_XPN_HOSTS_PROJECTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListXpnHostsProjectsHttpRequest, XpnHostList, ListXpnHostsProjectsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListXpnHostsProjectsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create( + callable, LIST_XPN_HOSTS_PROJECTS_PAGE_STR_DESC, request, context); + return ListXpnHostsProjectsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for ProjectStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + disableXpnHostProjectSettings; + private final UnaryCallSettings.Builder + disableXpnResourceProjectSettings; + private final UnaryCallSettings.Builder + enableXpnHostProjectSettings; + private final UnaryCallSettings.Builder + enableXpnResourceProjectSettings; + private final UnaryCallSettings.Builder getProjectSettings; + private final UnaryCallSettings.Builder + getXpnHostProjectSettings; + private final PagedCallSettings.Builder< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, + GetXpnResourcesProjectsPagedResponse> + getXpnResourcesProjectsSettings; + private final PagedCallSettings.Builder< + ListXpnHostsProjectsHttpRequest, XpnHostList, ListXpnHostsProjectsPagedResponse> + listXpnHostsProjectsSettings; + private final UnaryCallSettings.Builder + moveDiskProjectSettings; + private final UnaryCallSettings.Builder + moveInstanceProjectSettings; + private final UnaryCallSettings.Builder + setCommonInstanceMetadataProjectSettings; + private final UnaryCallSettings.Builder + setUsageExportBucketProjectSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + disableXpnHostProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + disableXpnResourceProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + enableXpnHostProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + enableXpnResourceProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getXpnHostProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getXpnResourcesProjectsSettings = + PagedCallSettings.newBuilder(GET_XPN_RESOURCES_PROJECTS_PAGE_STR_FACT); + + listXpnHostsProjectsSettings = + PagedCallSettings.newBuilder(LIST_XPN_HOSTS_PROJECTS_PAGE_STR_FACT); + + moveDiskProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + moveInstanceProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setCommonInstanceMetadataProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setUsageExportBucketProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + disableXpnHostProjectSettings, + disableXpnResourceProjectSettings, + enableXpnHostProjectSettings, + enableXpnResourceProjectSettings, + getProjectSettings, + getXpnHostProjectSettings, + getXpnResourcesProjectsSettings, + listXpnHostsProjectsSettings, + moveDiskProjectSettings, + moveInstanceProjectSettings, + setCommonInstanceMetadataProjectSettings, + setUsageExportBucketProjectSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .disableXpnHostProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .disableXpnResourceProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .enableXpnHostProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .enableXpnResourceProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getXpnHostProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getXpnResourcesProjectsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listXpnHostsProjectsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .moveDiskProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .moveInstanceProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setCommonInstanceMetadataProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setUsageExportBucketProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(ProjectStubSettings settings) { + super(settings); + + disableXpnHostProjectSettings = settings.disableXpnHostProjectSettings.toBuilder(); + disableXpnResourceProjectSettings = settings.disableXpnResourceProjectSettings.toBuilder(); + enableXpnHostProjectSettings = settings.enableXpnHostProjectSettings.toBuilder(); + enableXpnResourceProjectSettings = settings.enableXpnResourceProjectSettings.toBuilder(); + getProjectSettings = settings.getProjectSettings.toBuilder(); + getXpnHostProjectSettings = settings.getXpnHostProjectSettings.toBuilder(); + getXpnResourcesProjectsSettings = settings.getXpnResourcesProjectsSettings.toBuilder(); + listXpnHostsProjectsSettings = settings.listXpnHostsProjectsSettings.toBuilder(); + moveDiskProjectSettings = settings.moveDiskProjectSettings.toBuilder(); + moveInstanceProjectSettings = settings.moveInstanceProjectSettings.toBuilder(); + setCommonInstanceMetadataProjectSettings = + settings.setCommonInstanceMetadataProjectSettings.toBuilder(); + setUsageExportBucketProjectSettings = + settings.setUsageExportBucketProjectSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + disableXpnHostProjectSettings, + disableXpnResourceProjectSettings, + enableXpnHostProjectSettings, + enableXpnResourceProjectSettings, + getProjectSettings, + getXpnHostProjectSettings, + getXpnResourcesProjectsSettings, + listXpnHostsProjectsSettings, + moveDiskProjectSettings, + moveInstanceProjectSettings, + setCommonInstanceMetadataProjectSettings, + setUsageExportBucketProjectSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to disableXpnHostProject. */ + public UnaryCallSettings.Builder + disableXpnHostProjectSettings() { + return disableXpnHostProjectSettings; + } + + /** Returns the builder for the settings used for calls to disableXpnResourceProject. */ + public UnaryCallSettings.Builder + disableXpnResourceProjectSettings() { + return disableXpnResourceProjectSettings; + } + + /** Returns the builder for the settings used for calls to enableXpnHostProject. */ + public UnaryCallSettings.Builder + enableXpnHostProjectSettings() { + return enableXpnHostProjectSettings; + } + + /** Returns the builder for the settings used for calls to enableXpnResourceProject. */ + public UnaryCallSettings.Builder + enableXpnResourceProjectSettings() { + return enableXpnResourceProjectSettings; + } + + /** Returns the builder for the settings used for calls to getProject. */ + public UnaryCallSettings.Builder getProjectSettings() { + return getProjectSettings; + } + + /** Returns the builder for the settings used for calls to getXpnHostProject. */ + public UnaryCallSettings.Builder + getXpnHostProjectSettings() { + return getXpnHostProjectSettings; + } + + /** Returns the builder for the settings used for calls to getXpnResourcesProjects. */ + public PagedCallSettings.Builder< + GetXpnResourcesProjectsHttpRequest, ProjectsGetXpnResources, + GetXpnResourcesProjectsPagedResponse> + getXpnResourcesProjectsSettings() { + return getXpnResourcesProjectsSettings; + } + + /** Returns the builder for the settings used for calls to listXpnHostsProjects. */ + public PagedCallSettings.Builder< + ListXpnHostsProjectsHttpRequest, XpnHostList, ListXpnHostsProjectsPagedResponse> + listXpnHostsProjectsSettings() { + return listXpnHostsProjectsSettings; + } + + /** Returns the builder for the settings used for calls to moveDiskProject. */ + public UnaryCallSettings.Builder + moveDiskProjectSettings() { + return moveDiskProjectSettings; + } + + /** Returns the builder for the settings used for calls to moveInstanceProject. */ + public UnaryCallSettings.Builder + moveInstanceProjectSettings() { + return moveInstanceProjectSettings; + } + + /** Returns the builder for the settings used for calls to setCommonInstanceMetadataProject. */ + public UnaryCallSettings.Builder + setCommonInstanceMetadataProjectSettings() { + return setCommonInstanceMetadataProjectSettings; + } + + /** Returns the builder for the settings used for calls to setUsageExportBucketProject. */ + public UnaryCallSettings.Builder + setUsageExportBucketProjectSettings() { + return setUsageExportBucketProjectSettings; + } + + @Override + public ProjectStubSettings build() throws IOException { + return new ProjectStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionAutoscalerStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionAutoscalerStub.java new file mode 100644 index 000000000000..c83d400d32ae --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionAutoscalerStub.java @@ -0,0 +1,88 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionAutoscalerClient.ListRegionAutoscalersPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.Autoscaler; +import com.google.cloud.compute.v1.DeleteRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.GetRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.InsertRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.ListRegionAutoscalersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.RegionAutoscalerList; +import com.google.cloud.compute.v1.UpdateRegionAutoscalerHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class RegionAutoscalerStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + deleteRegionAutoscalerCallable() { + throw new UnsupportedOperationException("Not implemented: deleteRegionAutoscalerCallable()"); + } + + @BetaApi + public UnaryCallable getRegionAutoscalerCallable() { + throw new UnsupportedOperationException("Not implemented: getRegionAutoscalerCallable()"); + } + + @BetaApi + public UnaryCallable + insertRegionAutoscalerCallable() { + throw new UnsupportedOperationException("Not implemented: insertRegionAutoscalerCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionAutoscalersPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listRegionAutoscalersPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionAutoscalersCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionAutoscalersCallable()"); + } + + @BetaApi + public UnaryCallable + patchRegionAutoscalerCallable() { + throw new UnsupportedOperationException("Not implemented: patchRegionAutoscalerCallable()"); + } + + @BetaApi + public UnaryCallable + updateRegionAutoscalerCallable() { + throw new UnsupportedOperationException("Not implemented: updateRegionAutoscalerCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionAutoscalerStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionAutoscalerStubSettings.java new file mode 100644 index 000000000000..4e81bac5cdc1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionAutoscalerStubSettings.java @@ -0,0 +1,508 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionAutoscalerClient.ListRegionAutoscalersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.Autoscaler; +import com.google.cloud.compute.v1.DeleteRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.GetRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.InsertRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.ListRegionAutoscalersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchRegionAutoscalerHttpRequest; +import com.google.cloud.compute.v1.RegionAutoscalerList; +import com.google.cloud.compute.v1.UpdateRegionAutoscalerHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionAutoscalerStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteRegionAutoscaler to 30 seconds: + * + *

+ * 
+ * RegionAutoscalerStubSettings.Builder regionAutoscalerSettingsBuilder =
+ *     RegionAutoscalerStubSettings.newBuilder();
+ * regionAutoscalerSettingsBuilder.deleteRegionAutoscalerSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionAutoscalerStubSettings regionAutoscalerSettings = regionAutoscalerSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionAutoscalerStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteRegionAutoscalerSettings; + private final UnaryCallSettings + getRegionAutoscalerSettings; + private final UnaryCallSettings + insertRegionAutoscalerSettings; + private final PagedCallSettings< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, + ListRegionAutoscalersPagedResponse> + listRegionAutoscalersSettings; + private final UnaryCallSettings + patchRegionAutoscalerSettings; + private final UnaryCallSettings + updateRegionAutoscalerSettings; + + /** Returns the object with the settings used for calls to deleteRegionAutoscaler. */ + public UnaryCallSettings + deleteRegionAutoscalerSettings() { + return deleteRegionAutoscalerSettings; + } + + /** Returns the object with the settings used for calls to getRegionAutoscaler. */ + public UnaryCallSettings + getRegionAutoscalerSettings() { + return getRegionAutoscalerSettings; + } + + /** Returns the object with the settings used for calls to insertRegionAutoscaler. */ + public UnaryCallSettings + insertRegionAutoscalerSettings() { + return insertRegionAutoscalerSettings; + } + + /** Returns the object with the settings used for calls to listRegionAutoscalers. */ + public PagedCallSettings< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, + ListRegionAutoscalersPagedResponse> + listRegionAutoscalersSettings() { + return listRegionAutoscalersSettings; + } + + /** Returns the object with the settings used for calls to patchRegionAutoscaler. */ + public UnaryCallSettings + patchRegionAutoscalerSettings() { + return patchRegionAutoscalerSettings; + } + + /** Returns the object with the settings used for calls to updateRegionAutoscaler. */ + public UnaryCallSettings + updateRegionAutoscalerSettings() { + return updateRegionAutoscalerSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionAutoscalerStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonRegionAutoscalerStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(RegionAutoscalerStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionAutoscalerStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteRegionAutoscalerSettings = settingsBuilder.deleteRegionAutoscalerSettings().build(); + getRegionAutoscalerSettings = settingsBuilder.getRegionAutoscalerSettings().build(); + insertRegionAutoscalerSettings = settingsBuilder.insertRegionAutoscalerSettings().build(); + listRegionAutoscalersSettings = settingsBuilder.listRegionAutoscalersSettings().build(); + patchRegionAutoscalerSettings = settingsBuilder.patchRegionAutoscalerSettings().build(); + updateRegionAutoscalerSettings = settingsBuilder.updateRegionAutoscalerSettings().build(); + } + + private static final PagedListDescriptor< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, Autoscaler> + LIST_REGION_AUTOSCALERS_PAGE_STR_DESC = + new PagedListDescriptor< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, Autoscaler>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRegionAutoscalersHttpRequest injectToken( + ListRegionAutoscalersHttpRequest payload, String token) { + return ListRegionAutoscalersHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListRegionAutoscalersHttpRequest injectPageSize( + ListRegionAutoscalersHttpRequest payload, int pageSize) { + return ListRegionAutoscalersHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListRegionAutoscalersHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(RegionAutoscalerList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(RegionAutoscalerList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, + ListRegionAutoscalersPagedResponse> + LIST_REGION_AUTOSCALERS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, + ListRegionAutoscalersPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListRegionAutoscalersHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_REGION_AUTOSCALERS_PAGE_STR_DESC, request, context); + return ListRegionAutoscalersPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for RegionAutoscalerStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteRegionAutoscalerSettings; + private final UnaryCallSettings.Builder + getRegionAutoscalerSettings; + private final UnaryCallSettings.Builder + insertRegionAutoscalerSettings; + private final PagedCallSettings.Builder< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, + ListRegionAutoscalersPagedResponse> + listRegionAutoscalersSettings; + private final UnaryCallSettings.Builder + patchRegionAutoscalerSettings; + private final UnaryCallSettings.Builder + updateRegionAutoscalerSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteRegionAutoscalerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getRegionAutoscalerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertRegionAutoscalerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listRegionAutoscalersSettings = + PagedCallSettings.newBuilder(LIST_REGION_AUTOSCALERS_PAGE_STR_FACT); + + patchRegionAutoscalerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateRegionAutoscalerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteRegionAutoscalerSettings, + getRegionAutoscalerSettings, + insertRegionAutoscalerSettings, + listRegionAutoscalersSettings, + patchRegionAutoscalerSettings, + updateRegionAutoscalerSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteRegionAutoscalerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getRegionAutoscalerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertRegionAutoscalerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listRegionAutoscalersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchRegionAutoscalerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateRegionAutoscalerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(RegionAutoscalerStubSettings settings) { + super(settings); + + deleteRegionAutoscalerSettings = settings.deleteRegionAutoscalerSettings.toBuilder(); + getRegionAutoscalerSettings = settings.getRegionAutoscalerSettings.toBuilder(); + insertRegionAutoscalerSettings = settings.insertRegionAutoscalerSettings.toBuilder(); + listRegionAutoscalersSettings = settings.listRegionAutoscalersSettings.toBuilder(); + patchRegionAutoscalerSettings = settings.patchRegionAutoscalerSettings.toBuilder(); + updateRegionAutoscalerSettings = settings.updateRegionAutoscalerSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteRegionAutoscalerSettings, + getRegionAutoscalerSettings, + insertRegionAutoscalerSettings, + listRegionAutoscalersSettings, + patchRegionAutoscalerSettings, + updateRegionAutoscalerSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteRegionAutoscaler. */ + public UnaryCallSettings.Builder + deleteRegionAutoscalerSettings() { + return deleteRegionAutoscalerSettings; + } + + /** Returns the builder for the settings used for calls to getRegionAutoscaler. */ + public UnaryCallSettings.Builder + getRegionAutoscalerSettings() { + return getRegionAutoscalerSettings; + } + + /** Returns the builder for the settings used for calls to insertRegionAutoscaler. */ + public UnaryCallSettings.Builder + insertRegionAutoscalerSettings() { + return insertRegionAutoscalerSettings; + } + + /** Returns the builder for the settings used for calls to listRegionAutoscalers. */ + public PagedCallSettings.Builder< + ListRegionAutoscalersHttpRequest, RegionAutoscalerList, + ListRegionAutoscalersPagedResponse> + listRegionAutoscalersSettings() { + return listRegionAutoscalersSettings; + } + + /** Returns the builder for the settings used for calls to patchRegionAutoscaler. */ + public UnaryCallSettings.Builder + patchRegionAutoscalerSettings() { + return patchRegionAutoscalerSettings; + } + + /** Returns the builder for the settings used for calls to updateRegionAutoscaler. */ + public UnaryCallSettings.Builder + updateRegionAutoscalerSettings() { + return updateRegionAutoscalerSettings; + } + + @Override + public RegionAutoscalerStubSettings build() throws IOException { + return new RegionAutoscalerStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionBackendServiceStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionBackendServiceStub.java new file mode 100644 index 000000000000..b10c28c713fe --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionBackendServiceStub.java @@ -0,0 +1,101 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionBackendServiceClient.ListRegionBackendServicesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.BackendService; +import com.google.cloud.compute.v1.BackendServiceGroupHealth; +import com.google.cloud.compute.v1.BackendServiceList; +import com.google.cloud.compute.v1.DeleteRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetHealthRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.InsertRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.ListRegionBackendServicesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.UpdateRegionBackendServiceHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class RegionBackendServiceStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + deleteRegionBackendServiceCallable() { + throw new UnsupportedOperationException( + "Not implemented: deleteRegionBackendServiceCallable()"); + } + + @BetaApi + public UnaryCallable + getRegionBackendServiceCallable() { + throw new UnsupportedOperationException("Not implemented: getRegionBackendServiceCallable()"); + } + + @BetaApi + public UnaryCallable + getHealthRegionBackendServiceCallable() { + throw new UnsupportedOperationException( + "Not implemented: getHealthRegionBackendServiceCallable()"); + } + + @BetaApi + public UnaryCallable + insertRegionBackendServiceCallable() { + throw new UnsupportedOperationException( + "Not implemented: insertRegionBackendServiceCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionBackendServicesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listRegionBackendServicesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionBackendServicesCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionBackendServicesCallable()"); + } + + @BetaApi + public UnaryCallable + patchRegionBackendServiceCallable() { + throw new UnsupportedOperationException("Not implemented: patchRegionBackendServiceCallable()"); + } + + @BetaApi + public UnaryCallable + updateRegionBackendServiceCallable() { + throw new UnsupportedOperationException( + "Not implemented: updateRegionBackendServiceCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionBackendServiceStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionBackendServiceStubSettings.java new file mode 100644 index 000000000000..46aca507d5a1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionBackendServiceStubSettings.java @@ -0,0 +1,548 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionBackendServiceClient.ListRegionBackendServicesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.BackendService; +import com.google.cloud.compute.v1.BackendServiceGroupHealth; +import com.google.cloud.compute.v1.BackendServiceList; +import com.google.cloud.compute.v1.DeleteRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetHealthRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.GetRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.InsertRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.ListRegionBackendServicesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchRegionBackendServiceHttpRequest; +import com.google.cloud.compute.v1.UpdateRegionBackendServiceHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionBackendServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteRegionBackendService to 30 seconds: + * + *

+ * 
+ * RegionBackendServiceStubSettings.Builder regionBackendServiceSettingsBuilder =
+ *     RegionBackendServiceStubSettings.newBuilder();
+ * regionBackendServiceSettingsBuilder.deleteRegionBackendServiceSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionBackendServiceStubSettings regionBackendServiceSettings = regionBackendServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionBackendServiceStubSettings + extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteRegionBackendServiceSettings; + private final UnaryCallSettings + getRegionBackendServiceSettings; + private final UnaryCallSettings< + GetHealthRegionBackendServiceHttpRequest, BackendServiceGroupHealth> + getHealthRegionBackendServiceSettings; + private final UnaryCallSettings + insertRegionBackendServiceSettings; + private final PagedCallSettings< + ListRegionBackendServicesHttpRequest, BackendServiceList, + ListRegionBackendServicesPagedResponse> + listRegionBackendServicesSettings; + private final UnaryCallSettings + patchRegionBackendServiceSettings; + private final UnaryCallSettings + updateRegionBackendServiceSettings; + + /** Returns the object with the settings used for calls to deleteRegionBackendService. */ + public UnaryCallSettings + deleteRegionBackendServiceSettings() { + return deleteRegionBackendServiceSettings; + } + + /** Returns the object with the settings used for calls to getRegionBackendService. */ + public UnaryCallSettings + getRegionBackendServiceSettings() { + return getRegionBackendServiceSettings; + } + + /** Returns the object with the settings used for calls to getHealthRegionBackendService. */ + public UnaryCallSettings + getHealthRegionBackendServiceSettings() { + return getHealthRegionBackendServiceSettings; + } + + /** Returns the object with the settings used for calls to insertRegionBackendService. */ + public UnaryCallSettings + insertRegionBackendServiceSettings() { + return insertRegionBackendServiceSettings; + } + + /** Returns the object with the settings used for calls to listRegionBackendServices. */ + public PagedCallSettings< + ListRegionBackendServicesHttpRequest, BackendServiceList, + ListRegionBackendServicesPagedResponse> + listRegionBackendServicesSettings() { + return listRegionBackendServicesSettings; + } + + /** Returns the object with the settings used for calls to patchRegionBackendService. */ + public UnaryCallSettings + patchRegionBackendServiceSettings() { + return patchRegionBackendServiceSettings; + } + + /** Returns the object with the settings used for calls to updateRegionBackendService. */ + public UnaryCallSettings + updateRegionBackendServiceSettings() { + return updateRegionBackendServiceSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionBackendServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonRegionBackendServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(RegionBackendServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionBackendServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteRegionBackendServiceSettings = + settingsBuilder.deleteRegionBackendServiceSettings().build(); + getRegionBackendServiceSettings = settingsBuilder.getRegionBackendServiceSettings().build(); + getHealthRegionBackendServiceSettings = + settingsBuilder.getHealthRegionBackendServiceSettings().build(); + insertRegionBackendServiceSettings = + settingsBuilder.insertRegionBackendServiceSettings().build(); + listRegionBackendServicesSettings = settingsBuilder.listRegionBackendServicesSettings().build(); + patchRegionBackendServiceSettings = settingsBuilder.patchRegionBackendServiceSettings().build(); + updateRegionBackendServiceSettings = + settingsBuilder.updateRegionBackendServiceSettings().build(); + } + + private static final PagedListDescriptor< + ListRegionBackendServicesHttpRequest, BackendServiceList, BackendService> + LIST_REGION_BACKEND_SERVICES_PAGE_STR_DESC = + new PagedListDescriptor< + ListRegionBackendServicesHttpRequest, BackendServiceList, BackendService>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRegionBackendServicesHttpRequest injectToken( + ListRegionBackendServicesHttpRequest payload, String token) { + return ListRegionBackendServicesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListRegionBackendServicesHttpRequest injectPageSize( + ListRegionBackendServicesHttpRequest payload, int pageSize) { + return ListRegionBackendServicesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListRegionBackendServicesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(BackendServiceList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(BackendServiceList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListRegionBackendServicesHttpRequest, BackendServiceList, + ListRegionBackendServicesPagedResponse> + LIST_REGION_BACKEND_SERVICES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRegionBackendServicesHttpRequest, BackendServiceList, + ListRegionBackendServicesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListRegionBackendServicesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_REGION_BACKEND_SERVICES_PAGE_STR_DESC, request, context); + return ListRegionBackendServicesPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + /** Builder for RegionBackendServiceStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteRegionBackendServiceSettings; + private final UnaryCallSettings.Builder + getRegionBackendServiceSettings; + private final UnaryCallSettings.Builder< + GetHealthRegionBackendServiceHttpRequest, BackendServiceGroupHealth> + getHealthRegionBackendServiceSettings; + private final UnaryCallSettings.Builder + insertRegionBackendServiceSettings; + private final PagedCallSettings.Builder< + ListRegionBackendServicesHttpRequest, BackendServiceList, + ListRegionBackendServicesPagedResponse> + listRegionBackendServicesSettings; + private final UnaryCallSettings.Builder + patchRegionBackendServiceSettings; + private final UnaryCallSettings.Builder + updateRegionBackendServiceSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteRegionBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getRegionBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getHealthRegionBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertRegionBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listRegionBackendServicesSettings = + PagedCallSettings.newBuilder(LIST_REGION_BACKEND_SERVICES_PAGE_STR_FACT); + + patchRegionBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateRegionBackendServiceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteRegionBackendServiceSettings, + getRegionBackendServiceSettings, + getHealthRegionBackendServiceSettings, + insertRegionBackendServiceSettings, + listRegionBackendServicesSettings, + patchRegionBackendServiceSettings, + updateRegionBackendServiceSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteRegionBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getRegionBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getHealthRegionBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertRegionBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listRegionBackendServicesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchRegionBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateRegionBackendServiceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(RegionBackendServiceStubSettings settings) { + super(settings); + + deleteRegionBackendServiceSettings = settings.deleteRegionBackendServiceSettings.toBuilder(); + getRegionBackendServiceSettings = settings.getRegionBackendServiceSettings.toBuilder(); + getHealthRegionBackendServiceSettings = + settings.getHealthRegionBackendServiceSettings.toBuilder(); + insertRegionBackendServiceSettings = settings.insertRegionBackendServiceSettings.toBuilder(); + listRegionBackendServicesSettings = settings.listRegionBackendServicesSettings.toBuilder(); + patchRegionBackendServiceSettings = settings.patchRegionBackendServiceSettings.toBuilder(); + updateRegionBackendServiceSettings = settings.updateRegionBackendServiceSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteRegionBackendServiceSettings, + getRegionBackendServiceSettings, + getHealthRegionBackendServiceSettings, + insertRegionBackendServiceSettings, + listRegionBackendServicesSettings, + patchRegionBackendServiceSettings, + updateRegionBackendServiceSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteRegionBackendService. */ + public UnaryCallSettings.Builder + deleteRegionBackendServiceSettings() { + return deleteRegionBackendServiceSettings; + } + + /** Returns the builder for the settings used for calls to getRegionBackendService. */ + public UnaryCallSettings.Builder + getRegionBackendServiceSettings() { + return getRegionBackendServiceSettings; + } + + /** Returns the builder for the settings used for calls to getHealthRegionBackendService. */ + public UnaryCallSettings.Builder< + GetHealthRegionBackendServiceHttpRequest, BackendServiceGroupHealth> + getHealthRegionBackendServiceSettings() { + return getHealthRegionBackendServiceSettings; + } + + /** Returns the builder for the settings used for calls to insertRegionBackendService. */ + public UnaryCallSettings.Builder + insertRegionBackendServiceSettings() { + return insertRegionBackendServiceSettings; + } + + /** Returns the builder for the settings used for calls to listRegionBackendServices. */ + public PagedCallSettings.Builder< + ListRegionBackendServicesHttpRequest, BackendServiceList, + ListRegionBackendServicesPagedResponse> + listRegionBackendServicesSettings() { + return listRegionBackendServicesSettings; + } + + /** Returns the builder for the settings used for calls to patchRegionBackendService. */ + public UnaryCallSettings.Builder + patchRegionBackendServiceSettings() { + return patchRegionBackendServiceSettings; + } + + /** Returns the builder for the settings used for calls to updateRegionBackendService. */ + public UnaryCallSettings.Builder + updateRegionBackendServiceSettings() { + return updateRegionBackendServiceSettings; + } + + @Override + public RegionBackendServiceStubSettings build() throws IOException { + return new RegionBackendServiceStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionCommitmentStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionCommitmentStub.java new file mode 100644 index 000000000000..f7af537a7fb7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionCommitmentStub.java @@ -0,0 +1,85 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionCommitmentClient.AggregatedListRegionCommitmentsPagedResponse; +import static com.google.cloud.compute.v1.RegionCommitmentClient.ListRegionCommitmentsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListRegionCommitmentsHttpRequest; +import com.google.cloud.compute.v1.Commitment; +import com.google.cloud.compute.v1.CommitmentAggregatedList; +import com.google.cloud.compute.v1.CommitmentList; +import com.google.cloud.compute.v1.GetRegionCommitmentHttpRequest; +import com.google.cloud.compute.v1.InsertRegionCommitmentHttpRequest; +import com.google.cloud.compute.v1.ListRegionCommitmentsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class RegionCommitmentStub implements BackgroundResource { + + @BetaApi + public UnaryCallable< + AggregatedListRegionCommitmentsHttpRequest, AggregatedListRegionCommitmentsPagedResponse> + aggregatedListRegionCommitmentsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListRegionCommitmentsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListRegionCommitmentsCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListRegionCommitmentsCallable()"); + } + + @BetaApi + public UnaryCallable getRegionCommitmentCallable() { + throw new UnsupportedOperationException("Not implemented: getRegionCommitmentCallable()"); + } + + @BetaApi + public UnaryCallable + insertRegionCommitmentCallable() { + throw new UnsupportedOperationException("Not implemented: insertRegionCommitmentCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionCommitmentsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listRegionCommitmentsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionCommitmentsCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionCommitmentsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionCommitmentStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionCommitmentStubSettings.java new file mode 100644 index 000000000000..4f93e74feedc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionCommitmentStubSettings.java @@ -0,0 +1,533 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionCommitmentClient.AggregatedListRegionCommitmentsPagedResponse; +import static com.google.cloud.compute.v1.RegionCommitmentClient.ListRegionCommitmentsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListRegionCommitmentsHttpRequest; +import com.google.cloud.compute.v1.Commitment; +import com.google.cloud.compute.v1.CommitmentAggregatedList; +import com.google.cloud.compute.v1.CommitmentList; +import com.google.cloud.compute.v1.CommitmentsScopedList; +import com.google.cloud.compute.v1.GetRegionCommitmentHttpRequest; +import com.google.cloud.compute.v1.InsertRegionCommitmentHttpRequest; +import com.google.cloud.compute.v1.ListRegionCommitmentsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionCommitmentStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getRegionCommitment to 30 seconds: + * + *

+ * 
+ * RegionCommitmentStubSettings.Builder regionCommitmentSettingsBuilder =
+ *     RegionCommitmentStubSettings.newBuilder();
+ * regionCommitmentSettingsBuilder.getRegionCommitmentSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionCommitmentStubSettings regionCommitmentSettings = regionCommitmentSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionCommitmentStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + AggregatedListRegionCommitmentsPagedResponse> + aggregatedListRegionCommitmentsSettings; + private final UnaryCallSettings + getRegionCommitmentSettings; + private final UnaryCallSettings + insertRegionCommitmentSettings; + private final PagedCallSettings< + ListRegionCommitmentsHttpRequest, CommitmentList, ListRegionCommitmentsPagedResponse> + listRegionCommitmentsSettings; + + /** Returns the object with the settings used for calls to aggregatedListRegionCommitments. */ + public PagedCallSettings< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + AggregatedListRegionCommitmentsPagedResponse> + aggregatedListRegionCommitmentsSettings() { + return aggregatedListRegionCommitmentsSettings; + } + + /** Returns the object with the settings used for calls to getRegionCommitment. */ + public UnaryCallSettings + getRegionCommitmentSettings() { + return getRegionCommitmentSettings; + } + + /** Returns the object with the settings used for calls to insertRegionCommitment. */ + public UnaryCallSettings + insertRegionCommitmentSettings() { + return insertRegionCommitmentSettings; + } + + /** Returns the object with the settings used for calls to listRegionCommitments. */ + public PagedCallSettings< + ListRegionCommitmentsHttpRequest, CommitmentList, ListRegionCommitmentsPagedResponse> + listRegionCommitmentsSettings() { + return listRegionCommitmentsSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionCommitmentStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonRegionCommitmentStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(RegionCommitmentStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionCommitmentStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListRegionCommitmentsSettings = + settingsBuilder.aggregatedListRegionCommitmentsSettings().build(); + getRegionCommitmentSettings = settingsBuilder.getRegionCommitmentSettings().build(); + insertRegionCommitmentSettings = settingsBuilder.insertRegionCommitmentSettings().build(); + listRegionCommitmentsSettings = settingsBuilder.listRegionCommitmentsSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + CommitmentsScopedList> + AGGREGATED_LIST_REGION_COMMITMENTS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + CommitmentsScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListRegionCommitmentsHttpRequest injectToken( + AggregatedListRegionCommitmentsHttpRequest payload, String token) { + return AggregatedListRegionCommitmentsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListRegionCommitmentsHttpRequest injectPageSize( + AggregatedListRegionCommitmentsHttpRequest payload, int pageSize) { + return AggregatedListRegionCommitmentsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListRegionCommitmentsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(CommitmentAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + CommitmentAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor< + ListRegionCommitmentsHttpRequest, CommitmentList, Commitment> + LIST_REGION_COMMITMENTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRegionCommitmentsHttpRequest injectToken( + ListRegionCommitmentsHttpRequest payload, String token) { + return ListRegionCommitmentsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListRegionCommitmentsHttpRequest injectPageSize( + ListRegionCommitmentsHttpRequest payload, int pageSize) { + return ListRegionCommitmentsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListRegionCommitmentsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(CommitmentList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(CommitmentList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + AggregatedListRegionCommitmentsPagedResponse> + AGGREGATED_LIST_REGION_COMMITMENTS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + AggregatedListRegionCommitmentsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + AggregatedListRegionCommitmentsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + CommitmentsScopedList> + pageContext = + PageContext.create( + callable, + AGGREGATED_LIST_REGION_COMMITMENTS_PAGE_STR_DESC, + request, + context); + return AggregatedListRegionCommitmentsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListRegionCommitmentsHttpRequest, CommitmentList, ListRegionCommitmentsPagedResponse> + LIST_REGION_COMMITMENTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRegionCommitmentsHttpRequest, CommitmentList, + ListRegionCommitmentsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListRegionCommitmentsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_REGION_COMMITMENTS_PAGE_STR_DESC, request, context); + return ListRegionCommitmentsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for RegionCommitmentStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + AggregatedListRegionCommitmentsPagedResponse> + aggregatedListRegionCommitmentsSettings; + private final UnaryCallSettings.Builder + getRegionCommitmentSettings; + private final UnaryCallSettings.Builder + insertRegionCommitmentSettings; + private final PagedCallSettings.Builder< + ListRegionCommitmentsHttpRequest, CommitmentList, ListRegionCommitmentsPagedResponse> + listRegionCommitmentsSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListRegionCommitmentsSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_REGION_COMMITMENTS_PAGE_STR_FACT); + + getRegionCommitmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertRegionCommitmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listRegionCommitmentsSettings = + PagedCallSettings.newBuilder(LIST_REGION_COMMITMENTS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListRegionCommitmentsSettings, + getRegionCommitmentSettings, + insertRegionCommitmentSettings, + listRegionCommitmentsSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListRegionCommitmentsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getRegionCommitmentSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertRegionCommitmentSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listRegionCommitmentsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(RegionCommitmentStubSettings settings) { + super(settings); + + aggregatedListRegionCommitmentsSettings = + settings.aggregatedListRegionCommitmentsSettings.toBuilder(); + getRegionCommitmentSettings = settings.getRegionCommitmentSettings.toBuilder(); + insertRegionCommitmentSettings = settings.insertRegionCommitmentSettings.toBuilder(); + listRegionCommitmentsSettings = settings.listRegionCommitmentsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListRegionCommitmentsSettings, + getRegionCommitmentSettings, + insertRegionCommitmentSettings, + listRegionCommitmentsSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListRegionCommitments. */ + public PagedCallSettings.Builder< + AggregatedListRegionCommitmentsHttpRequest, CommitmentAggregatedList, + AggregatedListRegionCommitmentsPagedResponse> + aggregatedListRegionCommitmentsSettings() { + return aggregatedListRegionCommitmentsSettings; + } + + /** Returns the builder for the settings used for calls to getRegionCommitment. */ + public UnaryCallSettings.Builder + getRegionCommitmentSettings() { + return getRegionCommitmentSettings; + } + + /** Returns the builder for the settings used for calls to insertRegionCommitment. */ + public UnaryCallSettings.Builder + insertRegionCommitmentSettings() { + return insertRegionCommitmentSettings; + } + + /** Returns the builder for the settings used for calls to listRegionCommitments. */ + public PagedCallSettings.Builder< + ListRegionCommitmentsHttpRequest, CommitmentList, ListRegionCommitmentsPagedResponse> + listRegionCommitmentsSettings() { + return listRegionCommitmentsSettings; + } + + @Override + public RegionCommitmentStubSettings build() throws IOException { + return new RegionCommitmentStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskStub.java new file mode 100644 index 000000000000..50b83ed2fc9c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskStub.java @@ -0,0 +1,98 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionDiskClient.ListRegionDisksPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.CreateSnapshotRegionDiskHttpRequest; +import com.google.cloud.compute.v1.DeleteRegionDiskHttpRequest; +import com.google.cloud.compute.v1.Disk; +import com.google.cloud.compute.v1.DiskList; +import com.google.cloud.compute.v1.GetRegionDiskHttpRequest; +import com.google.cloud.compute.v1.InsertRegionDiskHttpRequest; +import com.google.cloud.compute.v1.ListRegionDisksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ResizeRegionDiskHttpRequest; +import com.google.cloud.compute.v1.SetLabelsRegionDiskHttpRequest; +import com.google.cloud.compute.v1.TestIamPermissionsRegionDiskHttpRequest; +import com.google.cloud.compute.v1.TestPermissionsResponse; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class RegionDiskStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + createSnapshotRegionDiskCallable() { + throw new UnsupportedOperationException("Not implemented: createSnapshotRegionDiskCallable()"); + } + + @BetaApi + public UnaryCallable deleteRegionDiskCallable() { + throw new UnsupportedOperationException("Not implemented: deleteRegionDiskCallable()"); + } + + @BetaApi + public UnaryCallable getRegionDiskCallable() { + throw new UnsupportedOperationException("Not implemented: getRegionDiskCallable()"); + } + + @BetaApi + public UnaryCallable insertRegionDiskCallable() { + throw new UnsupportedOperationException("Not implemented: insertRegionDiskCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionDisksPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionDisksPagedCallable()"); + } + + @BetaApi + public UnaryCallable listRegionDisksCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionDisksCallable()"); + } + + @BetaApi + public UnaryCallable resizeRegionDiskCallable() { + throw new UnsupportedOperationException("Not implemented: resizeRegionDiskCallable()"); + } + + @BetaApi + public UnaryCallable setLabelsRegionDiskCallable() { + throw new UnsupportedOperationException("Not implemented: setLabelsRegionDiskCallable()"); + } + + @BetaApi + public UnaryCallable + testIamPermissionsRegionDiskCallable() { + throw new UnsupportedOperationException( + "Not implemented: testIamPermissionsRegionDiskCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskStubSettings.java new file mode 100644 index 000000000000..b2f9119eff36 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskStubSettings.java @@ -0,0 +1,543 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionDiskClient.ListRegionDisksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.CreateSnapshotRegionDiskHttpRequest; +import com.google.cloud.compute.v1.DeleteRegionDiskHttpRequest; +import com.google.cloud.compute.v1.Disk; +import com.google.cloud.compute.v1.DiskList; +import com.google.cloud.compute.v1.GetRegionDiskHttpRequest; +import com.google.cloud.compute.v1.InsertRegionDiskHttpRequest; +import com.google.cloud.compute.v1.ListRegionDisksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ResizeRegionDiskHttpRequest; +import com.google.cloud.compute.v1.SetLabelsRegionDiskHttpRequest; +import com.google.cloud.compute.v1.TestIamPermissionsRegionDiskHttpRequest; +import com.google.cloud.compute.v1.TestPermissionsResponse; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionDiskStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of createSnapshotRegionDisk to 30 seconds: + * + *

+ * 
+ * RegionDiskStubSettings.Builder regionDiskSettingsBuilder =
+ *     RegionDiskStubSettings.newBuilder();
+ * regionDiskSettingsBuilder.createSnapshotRegionDiskSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionDiskStubSettings regionDiskSettings = regionDiskSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionDiskStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + createSnapshotRegionDiskSettings; + private final UnaryCallSettings deleteRegionDiskSettings; + private final UnaryCallSettings getRegionDiskSettings; + private final UnaryCallSettings insertRegionDiskSettings; + private final PagedCallSettings< + ListRegionDisksHttpRequest, DiskList, ListRegionDisksPagedResponse> + listRegionDisksSettings; + private final UnaryCallSettings resizeRegionDiskSettings; + private final UnaryCallSettings + setLabelsRegionDiskSettings; + private final UnaryCallSettings + testIamPermissionsRegionDiskSettings; + + /** Returns the object with the settings used for calls to createSnapshotRegionDisk. */ + public UnaryCallSettings + createSnapshotRegionDiskSettings() { + return createSnapshotRegionDiskSettings; + } + + /** Returns the object with the settings used for calls to deleteRegionDisk. */ + public UnaryCallSettings deleteRegionDiskSettings() { + return deleteRegionDiskSettings; + } + + /** Returns the object with the settings used for calls to getRegionDisk. */ + public UnaryCallSettings getRegionDiskSettings() { + return getRegionDiskSettings; + } + + /** Returns the object with the settings used for calls to insertRegionDisk. */ + public UnaryCallSettings insertRegionDiskSettings() { + return insertRegionDiskSettings; + } + + /** Returns the object with the settings used for calls to listRegionDisks. */ + public PagedCallSettings + listRegionDisksSettings() { + return listRegionDisksSettings; + } + + /** Returns the object with the settings used for calls to resizeRegionDisk. */ + public UnaryCallSettings resizeRegionDiskSettings() { + return resizeRegionDiskSettings; + } + + /** Returns the object with the settings used for calls to setLabelsRegionDisk. */ + public UnaryCallSettings + setLabelsRegionDiskSettings() { + return setLabelsRegionDiskSettings; + } + + /** Returns the object with the settings used for calls to testIamPermissionsRegionDisk. */ + public UnaryCallSettings + testIamPermissionsRegionDiskSettings() { + return testIamPermissionsRegionDiskSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionDiskStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonRegionDiskStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(RegionDiskStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionDiskStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createSnapshotRegionDiskSettings = settingsBuilder.createSnapshotRegionDiskSettings().build(); + deleteRegionDiskSettings = settingsBuilder.deleteRegionDiskSettings().build(); + getRegionDiskSettings = settingsBuilder.getRegionDiskSettings().build(); + insertRegionDiskSettings = settingsBuilder.insertRegionDiskSettings().build(); + listRegionDisksSettings = settingsBuilder.listRegionDisksSettings().build(); + resizeRegionDiskSettings = settingsBuilder.resizeRegionDiskSettings().build(); + setLabelsRegionDiskSettings = settingsBuilder.setLabelsRegionDiskSettings().build(); + testIamPermissionsRegionDiskSettings = + settingsBuilder.testIamPermissionsRegionDiskSettings().build(); + } + + private static final PagedListDescriptor + LIST_REGION_DISKS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRegionDisksHttpRequest injectToken( + ListRegionDisksHttpRequest payload, String token) { + return ListRegionDisksHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListRegionDisksHttpRequest injectPageSize( + ListRegionDisksHttpRequest payload, int pageSize) { + return ListRegionDisksHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListRegionDisksHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(DiskList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(DiskList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListRegionDisksHttpRequest, DiskList, ListRegionDisksPagedResponse> + LIST_REGION_DISKS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRegionDisksHttpRequest, DiskList, ListRegionDisksPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListRegionDisksHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_REGION_DISKS_PAGE_STR_DESC, request, context); + return ListRegionDisksPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for RegionDiskStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + createSnapshotRegionDiskSettings; + private final UnaryCallSettings.Builder + deleteRegionDiskSettings; + private final UnaryCallSettings.Builder getRegionDiskSettings; + private final UnaryCallSettings.Builder + insertRegionDiskSettings; + private final PagedCallSettings.Builder< + ListRegionDisksHttpRequest, DiskList, ListRegionDisksPagedResponse> + listRegionDisksSettings; + private final UnaryCallSettings.Builder + resizeRegionDiskSettings; + private final UnaryCallSettings.Builder + setLabelsRegionDiskSettings; + private final UnaryCallSettings.Builder< + TestIamPermissionsRegionDiskHttpRequest, TestPermissionsResponse> + testIamPermissionsRegionDiskSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + createSnapshotRegionDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteRegionDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getRegionDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertRegionDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listRegionDisksSettings = PagedCallSettings.newBuilder(LIST_REGION_DISKS_PAGE_STR_FACT); + + resizeRegionDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setLabelsRegionDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + testIamPermissionsRegionDiskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createSnapshotRegionDiskSettings, + deleteRegionDiskSettings, + getRegionDiskSettings, + insertRegionDiskSettings, + listRegionDisksSettings, + resizeRegionDiskSettings, + setLabelsRegionDiskSettings, + testIamPermissionsRegionDiskSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .createSnapshotRegionDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteRegionDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getRegionDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertRegionDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listRegionDisksSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .resizeRegionDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setLabelsRegionDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .testIamPermissionsRegionDiskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(RegionDiskStubSettings settings) { + super(settings); + + createSnapshotRegionDiskSettings = settings.createSnapshotRegionDiskSettings.toBuilder(); + deleteRegionDiskSettings = settings.deleteRegionDiskSettings.toBuilder(); + getRegionDiskSettings = settings.getRegionDiskSettings.toBuilder(); + insertRegionDiskSettings = settings.insertRegionDiskSettings.toBuilder(); + listRegionDisksSettings = settings.listRegionDisksSettings.toBuilder(); + resizeRegionDiskSettings = settings.resizeRegionDiskSettings.toBuilder(); + setLabelsRegionDiskSettings = settings.setLabelsRegionDiskSettings.toBuilder(); + testIamPermissionsRegionDiskSettings = + settings.testIamPermissionsRegionDiskSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createSnapshotRegionDiskSettings, + deleteRegionDiskSettings, + getRegionDiskSettings, + insertRegionDiskSettings, + listRegionDisksSettings, + resizeRegionDiskSettings, + setLabelsRegionDiskSettings, + testIamPermissionsRegionDiskSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to createSnapshotRegionDisk. */ + public UnaryCallSettings.Builder + createSnapshotRegionDiskSettings() { + return createSnapshotRegionDiskSettings; + } + + /** Returns the builder for the settings used for calls to deleteRegionDisk. */ + public UnaryCallSettings.Builder + deleteRegionDiskSettings() { + return deleteRegionDiskSettings; + } + + /** Returns the builder for the settings used for calls to getRegionDisk. */ + public UnaryCallSettings.Builder getRegionDiskSettings() { + return getRegionDiskSettings; + } + + /** Returns the builder for the settings used for calls to insertRegionDisk. */ + public UnaryCallSettings.Builder + insertRegionDiskSettings() { + return insertRegionDiskSettings; + } + + /** Returns the builder for the settings used for calls to listRegionDisks. */ + public PagedCallSettings.Builder< + ListRegionDisksHttpRequest, DiskList, ListRegionDisksPagedResponse> + listRegionDisksSettings() { + return listRegionDisksSettings; + } + + /** Returns the builder for the settings used for calls to resizeRegionDisk. */ + public UnaryCallSettings.Builder + resizeRegionDiskSettings() { + return resizeRegionDiskSettings; + } + + /** Returns the builder for the settings used for calls to setLabelsRegionDisk. */ + public UnaryCallSettings.Builder + setLabelsRegionDiskSettings() { + return setLabelsRegionDiskSettings; + } + + /** Returns the builder for the settings used for calls to testIamPermissionsRegionDisk. */ + public UnaryCallSettings.Builder< + TestIamPermissionsRegionDiskHttpRequest, TestPermissionsResponse> + testIamPermissionsRegionDiskSettings() { + return testIamPermissionsRegionDiskSettings; + } + + @Override + public RegionDiskStubSettings build() throws IOException { + return new RegionDiskStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskTypeStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskTypeStub.java new file mode 100644 index 000000000000..3ef40332f420 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskTypeStub.java @@ -0,0 +1,58 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionDiskTypeClient.ListRegionDiskTypesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DiskType; +import com.google.cloud.compute.v1.GetRegionDiskTypeHttpRequest; +import com.google.cloud.compute.v1.ListRegionDiskTypesHttpRequest; +import com.google.cloud.compute.v1.RegionDiskTypeList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class RegionDiskTypeStub implements BackgroundResource { + + @BetaApi + public UnaryCallable getRegionDiskTypeCallable() { + throw new UnsupportedOperationException("Not implemented: getRegionDiskTypeCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionDiskTypesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionDiskTypesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionDiskTypesCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionDiskTypesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskTypeStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskTypeStubSettings.java new file mode 100644 index 000000000000..05f773d9ef49 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionDiskTypeStubSettings.java @@ -0,0 +1,383 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionDiskTypeClient.ListRegionDiskTypesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DiskType; +import com.google.cloud.compute.v1.GetRegionDiskTypeHttpRequest; +import com.google.cloud.compute.v1.ListRegionDiskTypesHttpRequest; +import com.google.cloud.compute.v1.RegionDiskTypeList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionDiskTypeStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getRegionDiskType to 30 seconds: + * + *

+ * 
+ * RegionDiskTypeStubSettings.Builder regionDiskTypeSettingsBuilder =
+ *     RegionDiskTypeStubSettings.newBuilder();
+ * regionDiskTypeSettingsBuilder.getRegionDiskTypeSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionDiskTypeStubSettings regionDiskTypeSettings = regionDiskTypeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionDiskTypeStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings getRegionDiskTypeSettings; + private final PagedCallSettings< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, ListRegionDiskTypesPagedResponse> + listRegionDiskTypesSettings; + + /** Returns the object with the settings used for calls to getRegionDiskType. */ + public UnaryCallSettings getRegionDiskTypeSettings() { + return getRegionDiskTypeSettings; + } + + /** Returns the object with the settings used for calls to listRegionDiskTypes. */ + public PagedCallSettings< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, ListRegionDiskTypesPagedResponse> + listRegionDiskTypesSettings() { + return listRegionDiskTypesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionDiskTypeStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonRegionDiskTypeStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(RegionDiskTypeStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionDiskTypeStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getRegionDiskTypeSettings = settingsBuilder.getRegionDiskTypeSettings().build(); + listRegionDiskTypesSettings = settingsBuilder.listRegionDiskTypesSettings().build(); + } + + private static final PagedListDescriptor< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, DiskType> + LIST_REGION_DISK_TYPES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRegionDiskTypesHttpRequest injectToken( + ListRegionDiskTypesHttpRequest payload, String token) { + return ListRegionDiskTypesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListRegionDiskTypesHttpRequest injectPageSize( + ListRegionDiskTypesHttpRequest payload, int pageSize) { + return ListRegionDiskTypesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListRegionDiskTypesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(RegionDiskTypeList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(RegionDiskTypeList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, ListRegionDiskTypesPagedResponse> + LIST_REGION_DISK_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, + ListRegionDiskTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListRegionDiskTypesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_REGION_DISK_TYPES_PAGE_STR_DESC, request, context); + return ListRegionDiskTypesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for RegionDiskTypeStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + getRegionDiskTypeSettings; + private final PagedCallSettings.Builder< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, ListRegionDiskTypesPagedResponse> + listRegionDiskTypesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getRegionDiskTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listRegionDiskTypesSettings = + PagedCallSettings.newBuilder(LIST_REGION_DISK_TYPES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getRegionDiskTypeSettings, listRegionDiskTypesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .getRegionDiskTypeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listRegionDiskTypesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(RegionDiskTypeStubSettings settings) { + super(settings); + + getRegionDiskTypeSettings = settings.getRegionDiskTypeSettings.toBuilder(); + listRegionDiskTypesSettings = settings.listRegionDiskTypesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getRegionDiskTypeSettings, listRegionDiskTypesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to getRegionDiskType. */ + public UnaryCallSettings.Builder + getRegionDiskTypeSettings() { + return getRegionDiskTypeSettings; + } + + /** Returns the builder for the settings used for calls to listRegionDiskTypes. */ + public PagedCallSettings.Builder< + ListRegionDiskTypesHttpRequest, RegionDiskTypeList, ListRegionDiskTypesPagedResponse> + listRegionDiskTypesSettings() { + return listRegionDiskTypesSettings; + } + + @Override + public RegionDiskTypeStubSettings build() throws IOException { + return new RegionDiskTypeStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupManagerStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupManagerStub.java new file mode 100644 index 000000000000..930048b9b6ec --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupManagerStub.java @@ -0,0 +1,139 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionInstanceGroupManagerClient.ListRegionInstanceGroupManagersPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AbandonInstancesRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.DeleteInstancesRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.DeleteRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.GetRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InsertRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InstanceGroupManager; +import com.google.cloud.compute.v1.ListManagedInstancesRegionInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.ListRegionInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.RecreateInstancesRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.RegionInstanceGroupManagerList; +import com.google.cloud.compute.v1.RegionInstanceGroupManagersListInstancesResponse; +import com.google.cloud.compute.v1.ResizeRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetInstanceTemplateRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetTargetPoolsRegionInstanceGroupManagerHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class RegionInstanceGroupManagerStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + abandonInstancesRegionInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: abandonInstancesRegionInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + deleteRegionInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: deleteRegionInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + deleteInstancesRegionInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: deleteInstancesRegionInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + getRegionInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: getRegionInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + insertRegionInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: insertRegionInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable< + ListRegionInstanceGroupManagersHttpRequest, ListRegionInstanceGroupManagersPagedResponse> + listRegionInstanceGroupManagersPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listRegionInstanceGroupManagersPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionInstanceGroupManagersCallable() { + throw new UnsupportedOperationException( + "Not implemented: listRegionInstanceGroupManagersCallable()"); + } + + @BetaApi + public UnaryCallable< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersCallable() { + throw new UnsupportedOperationException( + "Not implemented: listManagedInstancesRegionInstanceGroupManagersCallable()"); + } + + @BetaApi + public UnaryCallable + recreateInstancesRegionInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: recreateInstancesRegionInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + resizeRegionInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: resizeRegionInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + setInstanceTemplateRegionInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: setInstanceTemplateRegionInstanceGroupManagerCallable()"); + } + + @BetaApi + public UnaryCallable + setTargetPoolsRegionInstanceGroupManagerCallable() { + throw new UnsupportedOperationException( + "Not implemented: setTargetPoolsRegionInstanceGroupManagerCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupManagerStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupManagerStubSettings.java new file mode 100644 index 000000000000..601d37d866fa --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupManagerStubSettings.java @@ -0,0 +1,745 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionInstanceGroupManagerClient.ListRegionInstanceGroupManagersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AbandonInstancesRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.DeleteInstancesRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.DeleteRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.GetRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InsertRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.InstanceGroupManager; +import com.google.cloud.compute.v1.ListManagedInstancesRegionInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.ListRegionInstanceGroupManagersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.RecreateInstancesRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.RegionInstanceGroupManagerList; +import com.google.cloud.compute.v1.RegionInstanceGroupManagersListInstancesResponse; +import com.google.cloud.compute.v1.ResizeRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetInstanceTemplateRegionInstanceGroupManagerHttpRequest; +import com.google.cloud.compute.v1.SetTargetPoolsRegionInstanceGroupManagerHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionInstanceGroupManagerStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of abandonInstancesRegionInstanceGroupManager to 30 seconds: + * + *

+ * 
+ * RegionInstanceGroupManagerStubSettings.Builder regionInstanceGroupManagerSettingsBuilder =
+ *     RegionInstanceGroupManagerStubSettings.newBuilder();
+ * regionInstanceGroupManagerSettingsBuilder.abandonInstancesRegionInstanceGroupManagerSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionInstanceGroupManagerStubSettings regionInstanceGroupManagerSettings = regionInstanceGroupManagerSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionInstanceGroupManagerStubSettings + extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + abandonInstancesRegionInstanceGroupManagerSettings; + private final UnaryCallSettings + deleteRegionInstanceGroupManagerSettings; + private final UnaryCallSettings + deleteInstancesRegionInstanceGroupManagerSettings; + private final UnaryCallSettings + getRegionInstanceGroupManagerSettings; + private final UnaryCallSettings + insertRegionInstanceGroupManagerSettings; + private final PagedCallSettings< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + ListRegionInstanceGroupManagersPagedResponse> + listRegionInstanceGroupManagersSettings; + private final UnaryCallSettings< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersSettings; + private final UnaryCallSettings + recreateInstancesRegionInstanceGroupManagerSettings; + private final UnaryCallSettings + resizeRegionInstanceGroupManagerSettings; + private final UnaryCallSettings< + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest, Operation> + setInstanceTemplateRegionInstanceGroupManagerSettings; + private final UnaryCallSettings + setTargetPoolsRegionInstanceGroupManagerSettings; + + /** + * Returns the object with the settings used for calls to + * abandonInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings + abandonInstancesRegionInstanceGroupManagerSettings() { + return abandonInstancesRegionInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to deleteRegionInstanceGroupManager. */ + public UnaryCallSettings + deleteRegionInstanceGroupManagerSettings() { + return deleteRegionInstanceGroupManagerSettings; + } + + /** + * Returns the object with the settings used for calls to + * deleteInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings + deleteInstancesRegionInstanceGroupManagerSettings() { + return deleteInstancesRegionInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to getRegionInstanceGroupManager. */ + public UnaryCallSettings + getRegionInstanceGroupManagerSettings() { + return getRegionInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to insertRegionInstanceGroupManager. */ + public UnaryCallSettings + insertRegionInstanceGroupManagerSettings() { + return insertRegionInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to listRegionInstanceGroupManagers. */ + public PagedCallSettings< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + ListRegionInstanceGroupManagersPagedResponse> + listRegionInstanceGroupManagersSettings() { + return listRegionInstanceGroupManagersSettings; + } + + /** + * Returns the object with the settings used for calls to + * listManagedInstancesRegionInstanceGroupManagers. + */ + public UnaryCallSettings< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersSettings() { + return listManagedInstancesRegionInstanceGroupManagersSettings; + } + + /** + * Returns the object with the settings used for calls to + * recreateInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings + recreateInstancesRegionInstanceGroupManagerSettings() { + return recreateInstancesRegionInstanceGroupManagerSettings; + } + + /** Returns the object with the settings used for calls to resizeRegionInstanceGroupManager. */ + public UnaryCallSettings + resizeRegionInstanceGroupManagerSettings() { + return resizeRegionInstanceGroupManagerSettings; + } + + /** + * Returns the object with the settings used for calls to + * setInstanceTemplateRegionInstanceGroupManager. + */ + public UnaryCallSettings + setInstanceTemplateRegionInstanceGroupManagerSettings() { + return setInstanceTemplateRegionInstanceGroupManagerSettings; + } + + /** + * Returns the object with the settings used for calls to + * setTargetPoolsRegionInstanceGroupManager. + */ + public UnaryCallSettings + setTargetPoolsRegionInstanceGroupManagerSettings() { + return setTargetPoolsRegionInstanceGroupManagerSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionInstanceGroupManagerStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonRegionInstanceGroupManagerStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(RegionInstanceGroupManagerStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionInstanceGroupManagerStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + abandonInstancesRegionInstanceGroupManagerSettings = + settingsBuilder.abandonInstancesRegionInstanceGroupManagerSettings().build(); + deleteRegionInstanceGroupManagerSettings = + settingsBuilder.deleteRegionInstanceGroupManagerSettings().build(); + deleteInstancesRegionInstanceGroupManagerSettings = + settingsBuilder.deleteInstancesRegionInstanceGroupManagerSettings().build(); + getRegionInstanceGroupManagerSettings = + settingsBuilder.getRegionInstanceGroupManagerSettings().build(); + insertRegionInstanceGroupManagerSettings = + settingsBuilder.insertRegionInstanceGroupManagerSettings().build(); + listRegionInstanceGroupManagersSettings = + settingsBuilder.listRegionInstanceGroupManagersSettings().build(); + listManagedInstancesRegionInstanceGroupManagersSettings = + settingsBuilder.listManagedInstancesRegionInstanceGroupManagersSettings().build(); + recreateInstancesRegionInstanceGroupManagerSettings = + settingsBuilder.recreateInstancesRegionInstanceGroupManagerSettings().build(); + resizeRegionInstanceGroupManagerSettings = + settingsBuilder.resizeRegionInstanceGroupManagerSettings().build(); + setInstanceTemplateRegionInstanceGroupManagerSettings = + settingsBuilder.setInstanceTemplateRegionInstanceGroupManagerSettings().build(); + setTargetPoolsRegionInstanceGroupManagerSettings = + settingsBuilder.setTargetPoolsRegionInstanceGroupManagerSettings().build(); + } + + private static final PagedListDescriptor< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + InstanceGroupManager> + LIST_REGION_INSTANCE_GROUP_MANAGERS_PAGE_STR_DESC = + new PagedListDescriptor< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + InstanceGroupManager>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRegionInstanceGroupManagersHttpRequest injectToken( + ListRegionInstanceGroupManagersHttpRequest payload, String token) { + return ListRegionInstanceGroupManagersHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListRegionInstanceGroupManagersHttpRequest injectPageSize( + ListRegionInstanceGroupManagersHttpRequest payload, int pageSize) { + return ListRegionInstanceGroupManagersHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListRegionInstanceGroupManagersHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(RegionInstanceGroupManagerList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + RegionInstanceGroupManagerList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + ListRegionInstanceGroupManagersPagedResponse> + LIST_REGION_INSTANCE_GROUP_MANAGERS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + ListRegionInstanceGroupManagersPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList> + callable, + ListRegionInstanceGroupManagersHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + InstanceGroupManager> + pageContext = + PageContext.create( + callable, + LIST_REGION_INSTANCE_GROUP_MANAGERS_PAGE_STR_DESC, + request, + context); + return ListRegionInstanceGroupManagersPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + /** Builder for RegionInstanceGroupManagerStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder< + AbandonInstancesRegionInstanceGroupManagerHttpRequest, Operation> + abandonInstancesRegionInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder + deleteRegionInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder< + DeleteInstancesRegionInstanceGroupManagerHttpRequest, Operation> + deleteInstancesRegionInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder< + GetRegionInstanceGroupManagerHttpRequest, InstanceGroupManager> + getRegionInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder + insertRegionInstanceGroupManagerSettings; + private final PagedCallSettings.Builder< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + ListRegionInstanceGroupManagersPagedResponse> + listRegionInstanceGroupManagersSettings; + private final UnaryCallSettings.Builder< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersSettings; + private final UnaryCallSettings.Builder< + RecreateInstancesRegionInstanceGroupManagerHttpRequest, Operation> + recreateInstancesRegionInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder + resizeRegionInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder< + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest, Operation> + setInstanceTemplateRegionInstanceGroupManagerSettings; + private final UnaryCallSettings.Builder< + SetTargetPoolsRegionInstanceGroupManagerHttpRequest, Operation> + setTargetPoolsRegionInstanceGroupManagerSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + abandonInstancesRegionInstanceGroupManagerSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteRegionInstanceGroupManagerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteInstancesRegionInstanceGroupManagerSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getRegionInstanceGroupManagerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertRegionInstanceGroupManagerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listRegionInstanceGroupManagersSettings = + PagedCallSettings.newBuilder(LIST_REGION_INSTANCE_GROUP_MANAGERS_PAGE_STR_FACT); + + listManagedInstancesRegionInstanceGroupManagersSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + recreateInstancesRegionInstanceGroupManagerSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + resizeRegionInstanceGroupManagerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setInstanceTemplateRegionInstanceGroupManagerSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setTargetPoolsRegionInstanceGroupManagerSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + abandonInstancesRegionInstanceGroupManagerSettings, + deleteRegionInstanceGroupManagerSettings, + deleteInstancesRegionInstanceGroupManagerSettings, + getRegionInstanceGroupManagerSettings, + insertRegionInstanceGroupManagerSettings, + listRegionInstanceGroupManagersSettings, + listManagedInstancesRegionInstanceGroupManagersSettings, + recreateInstancesRegionInstanceGroupManagerSettings, + resizeRegionInstanceGroupManagerSettings, + setInstanceTemplateRegionInstanceGroupManagerSettings, + setTargetPoolsRegionInstanceGroupManagerSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .abandonInstancesRegionInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteRegionInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteInstancesRegionInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getRegionInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertRegionInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listRegionInstanceGroupManagersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listManagedInstancesRegionInstanceGroupManagersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .recreateInstancesRegionInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .resizeRegionInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setInstanceTemplateRegionInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setTargetPoolsRegionInstanceGroupManagerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(RegionInstanceGroupManagerStubSettings settings) { + super(settings); + + abandonInstancesRegionInstanceGroupManagerSettings = + settings.abandonInstancesRegionInstanceGroupManagerSettings.toBuilder(); + deleteRegionInstanceGroupManagerSettings = + settings.deleteRegionInstanceGroupManagerSettings.toBuilder(); + deleteInstancesRegionInstanceGroupManagerSettings = + settings.deleteInstancesRegionInstanceGroupManagerSettings.toBuilder(); + getRegionInstanceGroupManagerSettings = + settings.getRegionInstanceGroupManagerSettings.toBuilder(); + insertRegionInstanceGroupManagerSettings = + settings.insertRegionInstanceGroupManagerSettings.toBuilder(); + listRegionInstanceGroupManagersSettings = + settings.listRegionInstanceGroupManagersSettings.toBuilder(); + listManagedInstancesRegionInstanceGroupManagersSettings = + settings.listManagedInstancesRegionInstanceGroupManagersSettings.toBuilder(); + recreateInstancesRegionInstanceGroupManagerSettings = + settings.recreateInstancesRegionInstanceGroupManagerSettings.toBuilder(); + resizeRegionInstanceGroupManagerSettings = + settings.resizeRegionInstanceGroupManagerSettings.toBuilder(); + setInstanceTemplateRegionInstanceGroupManagerSettings = + settings.setInstanceTemplateRegionInstanceGroupManagerSettings.toBuilder(); + setTargetPoolsRegionInstanceGroupManagerSettings = + settings.setTargetPoolsRegionInstanceGroupManagerSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + abandonInstancesRegionInstanceGroupManagerSettings, + deleteRegionInstanceGroupManagerSettings, + deleteInstancesRegionInstanceGroupManagerSettings, + getRegionInstanceGroupManagerSettings, + insertRegionInstanceGroupManagerSettings, + listRegionInstanceGroupManagersSettings, + listManagedInstancesRegionInstanceGroupManagersSettings, + recreateInstancesRegionInstanceGroupManagerSettings, + resizeRegionInstanceGroupManagerSettings, + setInstanceTemplateRegionInstanceGroupManagerSettings, + setTargetPoolsRegionInstanceGroupManagerSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** + * Returns the builder for the settings used for calls to + * abandonInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings.Builder< + AbandonInstancesRegionInstanceGroupManagerHttpRequest, Operation> + abandonInstancesRegionInstanceGroupManagerSettings() { + return abandonInstancesRegionInstanceGroupManagerSettings; + } + + /** Returns the builder for the settings used for calls to deleteRegionInstanceGroupManager. */ + public UnaryCallSettings.Builder + deleteRegionInstanceGroupManagerSettings() { + return deleteRegionInstanceGroupManagerSettings; + } + + /** + * Returns the builder for the settings used for calls to + * deleteInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings.Builder< + DeleteInstancesRegionInstanceGroupManagerHttpRequest, Operation> + deleteInstancesRegionInstanceGroupManagerSettings() { + return deleteInstancesRegionInstanceGroupManagerSettings; + } + + /** Returns the builder for the settings used for calls to getRegionInstanceGroupManager. */ + public UnaryCallSettings.Builder + getRegionInstanceGroupManagerSettings() { + return getRegionInstanceGroupManagerSettings; + } + + /** Returns the builder for the settings used for calls to insertRegionInstanceGroupManager. */ + public UnaryCallSettings.Builder + insertRegionInstanceGroupManagerSettings() { + return insertRegionInstanceGroupManagerSettings; + } + + /** Returns the builder for the settings used for calls to listRegionInstanceGroupManagers. */ + public PagedCallSettings.Builder< + ListRegionInstanceGroupManagersHttpRequest, RegionInstanceGroupManagerList, + ListRegionInstanceGroupManagersPagedResponse> + listRegionInstanceGroupManagersSettings() { + return listRegionInstanceGroupManagersSettings; + } + + /** + * Returns the builder for the settings used for calls to + * listManagedInstancesRegionInstanceGroupManagers. + */ + public UnaryCallSettings.Builder< + ListManagedInstancesRegionInstanceGroupManagersHttpRequest, + RegionInstanceGroupManagersListInstancesResponse> + listManagedInstancesRegionInstanceGroupManagersSettings() { + return listManagedInstancesRegionInstanceGroupManagersSettings; + } + + /** + * Returns the builder for the settings used for calls to + * recreateInstancesRegionInstanceGroupManager. + */ + public UnaryCallSettings.Builder< + RecreateInstancesRegionInstanceGroupManagerHttpRequest, Operation> + recreateInstancesRegionInstanceGroupManagerSettings() { + return recreateInstancesRegionInstanceGroupManagerSettings; + } + + /** Returns the builder for the settings used for calls to resizeRegionInstanceGroupManager. */ + public UnaryCallSettings.Builder + resizeRegionInstanceGroupManagerSettings() { + return resizeRegionInstanceGroupManagerSettings; + } + + /** + * Returns the builder for the settings used for calls to + * setInstanceTemplateRegionInstanceGroupManager. + */ + public UnaryCallSettings.Builder< + SetInstanceTemplateRegionInstanceGroupManagerHttpRequest, Operation> + setInstanceTemplateRegionInstanceGroupManagerSettings() { + return setInstanceTemplateRegionInstanceGroupManagerSettings; + } + + /** + * Returns the builder for the settings used for calls to + * setTargetPoolsRegionInstanceGroupManager. + */ + public UnaryCallSettings.Builder + setTargetPoolsRegionInstanceGroupManagerSettings() { + return setTargetPoolsRegionInstanceGroupManagerSettings; + } + + @Override + public RegionInstanceGroupManagerStubSettings build() throws IOException { + return new RegionInstanceGroupManagerStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupStub.java new file mode 100644 index 000000000000..a885aef44fac --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupStub.java @@ -0,0 +1,89 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionInstanceGroupClient.ListInstancesRegionInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.RegionInstanceGroupClient.ListRegionInstanceGroupsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.GetRegionInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.InstanceGroup; +import com.google.cloud.compute.v1.ListInstancesRegionInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.ListRegionInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.RegionInstanceGroupList; +import com.google.cloud.compute.v1.RegionInstanceGroupsListInstances; +import com.google.cloud.compute.v1.SetNamedPortsRegionInstanceGroupHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class RegionInstanceGroupStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + getRegionInstanceGroupCallable() { + throw new UnsupportedOperationException("Not implemented: getRegionInstanceGroupCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionInstanceGroupsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listRegionInstanceGroupsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionInstanceGroupsCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionInstanceGroupsCallable()"); + } + + @BetaApi + public UnaryCallable< + ListInstancesRegionInstanceGroupsHttpRequest, + ListInstancesRegionInstanceGroupsPagedResponse> + listInstancesRegionInstanceGroupsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInstancesRegionInstanceGroupsPagedCallable()"); + } + + @BetaApi + public UnaryCallable< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances> + listInstancesRegionInstanceGroupsCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInstancesRegionInstanceGroupsCallable()"); + } + + @BetaApi + public UnaryCallable + setNamedPortsRegionInstanceGroupCallable() { + throw new UnsupportedOperationException( + "Not implemented: setNamedPortsRegionInstanceGroupCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupStubSettings.java new file mode 100644 index 000000000000..17d4c0d42d97 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionInstanceGroupStubSettings.java @@ -0,0 +1,546 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionInstanceGroupClient.ListInstancesRegionInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.RegionInstanceGroupClient.ListRegionInstanceGroupsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.GetRegionInstanceGroupHttpRequest; +import com.google.cloud.compute.v1.InstanceGroup; +import com.google.cloud.compute.v1.InstanceWithNamedPorts; +import com.google.cloud.compute.v1.ListInstancesRegionInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.ListRegionInstanceGroupsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.RegionInstanceGroupList; +import com.google.cloud.compute.v1.RegionInstanceGroupsListInstances; +import com.google.cloud.compute.v1.SetNamedPortsRegionInstanceGroupHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionInstanceGroupStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getRegionInstanceGroup to 30 seconds: + * + *

+ * 
+ * RegionInstanceGroupStubSettings.Builder regionInstanceGroupSettingsBuilder =
+ *     RegionInstanceGroupStubSettings.newBuilder();
+ * regionInstanceGroupSettingsBuilder.getRegionInstanceGroupSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionInstanceGroupStubSettings regionInstanceGroupSettings = regionInstanceGroupSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionInstanceGroupStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + getRegionInstanceGroupSettings; + private final PagedCallSettings< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, + ListRegionInstanceGroupsPagedResponse> + listRegionInstanceGroupsSettings; + private final PagedCallSettings< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + ListInstancesRegionInstanceGroupsPagedResponse> + listInstancesRegionInstanceGroupsSettings; + private final UnaryCallSettings + setNamedPortsRegionInstanceGroupSettings; + + /** Returns the object with the settings used for calls to getRegionInstanceGroup. */ + public UnaryCallSettings + getRegionInstanceGroupSettings() { + return getRegionInstanceGroupSettings; + } + + /** Returns the object with the settings used for calls to listRegionInstanceGroups. */ + public PagedCallSettings< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, + ListRegionInstanceGroupsPagedResponse> + listRegionInstanceGroupsSettings() { + return listRegionInstanceGroupsSettings; + } + + /** Returns the object with the settings used for calls to listInstancesRegionInstanceGroups. */ + public PagedCallSettings< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + ListInstancesRegionInstanceGroupsPagedResponse> + listInstancesRegionInstanceGroupsSettings() { + return listInstancesRegionInstanceGroupsSettings; + } + + /** Returns the object with the settings used for calls to setNamedPortsRegionInstanceGroup. */ + public UnaryCallSettings + setNamedPortsRegionInstanceGroupSettings() { + return setNamedPortsRegionInstanceGroupSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionInstanceGroupStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonRegionInstanceGroupStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(RegionInstanceGroupStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionInstanceGroupStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getRegionInstanceGroupSettings = settingsBuilder.getRegionInstanceGroupSettings().build(); + listRegionInstanceGroupsSettings = settingsBuilder.listRegionInstanceGroupsSettings().build(); + listInstancesRegionInstanceGroupsSettings = + settingsBuilder.listInstancesRegionInstanceGroupsSettings().build(); + setNamedPortsRegionInstanceGroupSettings = + settingsBuilder.setNamedPortsRegionInstanceGroupSettings().build(); + } + + private static final PagedListDescriptor< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, InstanceGroup> + LIST_REGION_INSTANCE_GROUPS_PAGE_STR_DESC = + new PagedListDescriptor< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, InstanceGroup>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRegionInstanceGroupsHttpRequest injectToken( + ListRegionInstanceGroupsHttpRequest payload, String token) { + return ListRegionInstanceGroupsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListRegionInstanceGroupsHttpRequest injectPageSize( + ListRegionInstanceGroupsHttpRequest payload, int pageSize) { + return ListRegionInstanceGroupsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListRegionInstanceGroupsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(RegionInstanceGroupList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(RegionInstanceGroupList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListDescriptor< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + InstanceWithNamedPorts> + LIST_INSTANCES_REGION_INSTANCE_GROUPS_PAGE_STR_DESC = + new PagedListDescriptor< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + InstanceWithNamedPorts>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInstancesRegionInstanceGroupsHttpRequest injectToken( + ListInstancesRegionInstanceGroupsHttpRequest payload, String token) { + return ListInstancesRegionInstanceGroupsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListInstancesRegionInstanceGroupsHttpRequest injectPageSize( + ListInstancesRegionInstanceGroupsHttpRequest payload, int pageSize) { + return ListInstancesRegionInstanceGroupsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListInstancesRegionInstanceGroupsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(RegionInstanceGroupsListInstances payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + RegionInstanceGroupsListInstances payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, + ListRegionInstanceGroupsPagedResponse> + LIST_REGION_INSTANCE_GROUPS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, + ListRegionInstanceGroupsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListRegionInstanceGroupsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, InstanceGroup> + pageContext = + PageContext.create( + callable, LIST_REGION_INSTANCE_GROUPS_PAGE_STR_DESC, request, context); + return ListRegionInstanceGroupsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + ListInstancesRegionInstanceGroupsPagedResponse> + LIST_INSTANCES_REGION_INSTANCE_GROUPS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + ListInstancesRegionInstanceGroupsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable< + ListInstancesRegionInstanceGroupsHttpRequest, + RegionInstanceGroupsListInstances> + callable, + ListInstancesRegionInstanceGroupsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListInstancesRegionInstanceGroupsHttpRequest, + RegionInstanceGroupsListInstances, InstanceWithNamedPorts> + pageContext = + PageContext.create( + callable, + LIST_INSTANCES_REGION_INSTANCE_GROUPS_PAGE_STR_DESC, + request, + context); + return ListInstancesRegionInstanceGroupsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + /** Builder for RegionInstanceGroupStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + getRegionInstanceGroupSettings; + private final PagedCallSettings.Builder< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, + ListRegionInstanceGroupsPagedResponse> + listRegionInstanceGroupsSettings; + private final PagedCallSettings.Builder< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + ListInstancesRegionInstanceGroupsPagedResponse> + listInstancesRegionInstanceGroupsSettings; + private final UnaryCallSettings.Builder + setNamedPortsRegionInstanceGroupSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getRegionInstanceGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listRegionInstanceGroupsSettings = + PagedCallSettings.newBuilder(LIST_REGION_INSTANCE_GROUPS_PAGE_STR_FACT); + + listInstancesRegionInstanceGroupsSettings = + PagedCallSettings.newBuilder(LIST_INSTANCES_REGION_INSTANCE_GROUPS_PAGE_STR_FACT); + + setNamedPortsRegionInstanceGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getRegionInstanceGroupSettings, + listRegionInstanceGroupsSettings, + listInstancesRegionInstanceGroupsSettings, + setNamedPortsRegionInstanceGroupSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .getRegionInstanceGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listRegionInstanceGroupsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listInstancesRegionInstanceGroupsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setNamedPortsRegionInstanceGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(RegionInstanceGroupStubSettings settings) { + super(settings); + + getRegionInstanceGroupSettings = settings.getRegionInstanceGroupSettings.toBuilder(); + listRegionInstanceGroupsSettings = settings.listRegionInstanceGroupsSettings.toBuilder(); + listInstancesRegionInstanceGroupsSettings = + settings.listInstancesRegionInstanceGroupsSettings.toBuilder(); + setNamedPortsRegionInstanceGroupSettings = + settings.setNamedPortsRegionInstanceGroupSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getRegionInstanceGroupSettings, + listRegionInstanceGroupsSettings, + listInstancesRegionInstanceGroupsSettings, + setNamedPortsRegionInstanceGroupSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to getRegionInstanceGroup. */ + public UnaryCallSettings.Builder + getRegionInstanceGroupSettings() { + return getRegionInstanceGroupSettings; + } + + /** Returns the builder for the settings used for calls to listRegionInstanceGroups. */ + public PagedCallSettings.Builder< + ListRegionInstanceGroupsHttpRequest, RegionInstanceGroupList, + ListRegionInstanceGroupsPagedResponse> + listRegionInstanceGroupsSettings() { + return listRegionInstanceGroupsSettings; + } + + /** Returns the builder for the settings used for calls to listInstancesRegionInstanceGroups. */ + public PagedCallSettings.Builder< + ListInstancesRegionInstanceGroupsHttpRequest, RegionInstanceGroupsListInstances, + ListInstancesRegionInstanceGroupsPagedResponse> + listInstancesRegionInstanceGroupsSettings() { + return listInstancesRegionInstanceGroupsSettings; + } + + /** Returns the builder for the settings used for calls to setNamedPortsRegionInstanceGroup. */ + public UnaryCallSettings.Builder + setNamedPortsRegionInstanceGroupSettings() { + return setNamedPortsRegionInstanceGroupSettings; + } + + @Override + public RegionInstanceGroupStubSettings build() throws IOException { + return new RegionInstanceGroupStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionOperationStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionOperationStub.java new file mode 100644 index 000000000000..de3eb337a809 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionOperationStub.java @@ -0,0 +1,64 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionOperationClient.ListRegionOperationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteRegionOperationHttpRequest; +import com.google.cloud.compute.v1.GetRegionOperationHttpRequest; +import com.google.cloud.compute.v1.ListRegionOperationsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.OperationList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class RegionOperationStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteRegionOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteRegionOperationCallable()"); + } + + @BetaApi + public UnaryCallable getRegionOperationCallable() { + throw new UnsupportedOperationException("Not implemented: getRegionOperationCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionOperationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionOperationsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionOperationsCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionOperationsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionOperationStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionOperationStubSettings.java new file mode 100644 index 000000000000..270ec87bf321 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionOperationStubSettings.java @@ -0,0 +1,413 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionOperationClient.ListRegionOperationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteRegionOperationHttpRequest; +import com.google.cloud.compute.v1.GetRegionOperationHttpRequest; +import com.google.cloud.compute.v1.ListRegionOperationsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.OperationList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionOperationStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteRegionOperation to 30 seconds: + * + *

+ * 
+ * RegionOperationStubSettings.Builder regionOperationSettingsBuilder =
+ *     RegionOperationStubSettings.newBuilder();
+ * regionOperationSettingsBuilder.deleteRegionOperationSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionOperationStubSettings regionOperationSettings = regionOperationSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionOperationStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteRegionOperationSettings; + private final UnaryCallSettings + getRegionOperationSettings; + private final PagedCallSettings< + ListRegionOperationsHttpRequest, OperationList, ListRegionOperationsPagedResponse> + listRegionOperationsSettings; + + /** Returns the object with the settings used for calls to deleteRegionOperation. */ + public UnaryCallSettings deleteRegionOperationSettings() { + return deleteRegionOperationSettings; + } + + /** Returns the object with the settings used for calls to getRegionOperation. */ + public UnaryCallSettings getRegionOperationSettings() { + return getRegionOperationSettings; + } + + /** Returns the object with the settings used for calls to listRegionOperations. */ + public PagedCallSettings< + ListRegionOperationsHttpRequest, OperationList, ListRegionOperationsPagedResponse> + listRegionOperationsSettings() { + return listRegionOperationsSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionOperationStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonRegionOperationStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(RegionOperationStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionOperationStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteRegionOperationSettings = settingsBuilder.deleteRegionOperationSettings().build(); + getRegionOperationSettings = settingsBuilder.getRegionOperationSettings().build(); + listRegionOperationsSettings = settingsBuilder.listRegionOperationsSettings().build(); + } + + private static final PagedListDescriptor< + ListRegionOperationsHttpRequest, OperationList, Operation> + LIST_REGION_OPERATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRegionOperationsHttpRequest injectToken( + ListRegionOperationsHttpRequest payload, String token) { + return ListRegionOperationsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListRegionOperationsHttpRequest injectPageSize( + ListRegionOperationsHttpRequest payload, int pageSize) { + return ListRegionOperationsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListRegionOperationsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(OperationList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(OperationList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListRegionOperationsHttpRequest, OperationList, ListRegionOperationsPagedResponse> + LIST_REGION_OPERATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRegionOperationsHttpRequest, OperationList, ListRegionOperationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListRegionOperationsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create( + callable, LIST_REGION_OPERATIONS_PAGE_STR_DESC, request, context); + return ListRegionOperationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for RegionOperationStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteRegionOperationSettings; + private final UnaryCallSettings.Builder + getRegionOperationSettings; + private final PagedCallSettings.Builder< + ListRegionOperationsHttpRequest, OperationList, ListRegionOperationsPagedResponse> + listRegionOperationsSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteRegionOperationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getRegionOperationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listRegionOperationsSettings = + PagedCallSettings.newBuilder(LIST_REGION_OPERATIONS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteRegionOperationSettings, + getRegionOperationSettings, + listRegionOperationsSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteRegionOperationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getRegionOperationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listRegionOperationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(RegionOperationStubSettings settings) { + super(settings); + + deleteRegionOperationSettings = settings.deleteRegionOperationSettings.toBuilder(); + getRegionOperationSettings = settings.getRegionOperationSettings.toBuilder(); + listRegionOperationsSettings = settings.listRegionOperationsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteRegionOperationSettings, + getRegionOperationSettings, + listRegionOperationsSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteRegionOperation. */ + public UnaryCallSettings.Builder + deleteRegionOperationSettings() { + return deleteRegionOperationSettings; + } + + /** Returns the builder for the settings used for calls to getRegionOperation. */ + public UnaryCallSettings.Builder + getRegionOperationSettings() { + return getRegionOperationSettings; + } + + /** Returns the builder for the settings used for calls to listRegionOperations. */ + public PagedCallSettings.Builder< + ListRegionOperationsHttpRequest, OperationList, ListRegionOperationsPagedResponse> + listRegionOperationsSettings() { + return listRegionOperationsSettings; + } + + @Override + public RegionOperationStubSettings build() throws IOException { + return new RegionOperationStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionStub.java new file mode 100644 index 000000000000..6bcf9a4e29fa --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionStub.java @@ -0,0 +1,57 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionClient.ListRegionsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.GetRegionHttpRequest; +import com.google.cloud.compute.v1.ListRegionsHttpRequest; +import com.google.cloud.compute.v1.Region; +import com.google.cloud.compute.v1.RegionList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class RegionStub implements BackgroundResource { + + @BetaApi + public UnaryCallable getRegionCallable() { + throw new UnsupportedOperationException("Not implemented: getRegionCallable()"); + } + + @BetaApi + public UnaryCallable + listRegionsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionsPagedCallable()"); + } + + @BetaApi + public UnaryCallable listRegionsCallable() { + throw new UnsupportedOperationException("Not implemented: listRegionsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionStubSettings.java new file mode 100644 index 000000000000..45044fc42d3a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RegionStubSettings.java @@ -0,0 +1,368 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RegionClient.ListRegionsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.GetRegionHttpRequest; +import com.google.cloud.compute.v1.ListRegionsHttpRequest; +import com.google.cloud.compute.v1.Region; +import com.google.cloud.compute.v1.RegionList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RegionStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getRegion to 30 seconds: + * + *

+ * 
+ * RegionStubSettings.Builder regionSettingsBuilder =
+ *     RegionStubSettings.newBuilder();
+ * regionSettingsBuilder.getRegionSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RegionStubSettings regionSettings = regionSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RegionStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings getRegionSettings; + private final PagedCallSettings + listRegionsSettings; + + /** Returns the object with the settings used for calls to getRegion. */ + public UnaryCallSettings getRegionSettings() { + return getRegionSettings; + } + + /** Returns the object with the settings used for calls to listRegions. */ + public PagedCallSettings + listRegionsSettings() { + return listRegionsSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RegionStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonRegionStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(RegionStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RegionStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getRegionSettings = settingsBuilder.getRegionSettings().build(); + listRegionsSettings = settingsBuilder.listRegionsSettings().build(); + } + + private static final PagedListDescriptor + LIST_REGIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRegionsHttpRequest injectToken( + ListRegionsHttpRequest payload, String token) { + return ListRegionsHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListRegionsHttpRequest injectPageSize( + ListRegionsHttpRequest payload, int pageSize) { + return ListRegionsHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListRegionsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(RegionList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(RegionList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListRegionsHttpRequest, RegionList, ListRegionsPagedResponse> + LIST_REGIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRegionsHttpRequest, RegionList, ListRegionsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListRegionsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_REGIONS_PAGE_STR_DESC, request, context); + return ListRegionsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for RegionStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder getRegionSettings; + private final PagedCallSettings.Builder< + ListRegionsHttpRequest, RegionList, ListRegionsPagedResponse> + listRegionsSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getRegionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listRegionsSettings = PagedCallSettings.newBuilder(LIST_REGIONS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of(getRegionSettings, listRegionsSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .getRegionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listRegionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(RegionStubSettings settings) { + super(settings); + + getRegionSettings = settings.getRegionSettings.toBuilder(); + listRegionsSettings = settings.listRegionsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(getRegionSettings, listRegionsSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to getRegion. */ + public UnaryCallSettings.Builder getRegionSettings() { + return getRegionSettings; + } + + /** Returns the builder for the settings used for calls to listRegions. */ + public PagedCallSettings.Builder + listRegionsSettings() { + return listRegionsSettings; + } + + @Override + public RegionStubSettings build() throws IOException { + return new RegionStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouteStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouteStub.java new file mode 100644 index 000000000000..a39b9b670eeb --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouteStub.java @@ -0,0 +1,69 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RouteClient.ListRoutesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteRouteHttpRequest; +import com.google.cloud.compute.v1.GetRouteHttpRequest; +import com.google.cloud.compute.v1.InsertRouteHttpRequest; +import com.google.cloud.compute.v1.ListRoutesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.Route; +import com.google.cloud.compute.v1.RouteList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class RouteStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteRouteCallable() { + throw new UnsupportedOperationException("Not implemented: deleteRouteCallable()"); + } + + @BetaApi + public UnaryCallable getRouteCallable() { + throw new UnsupportedOperationException("Not implemented: getRouteCallable()"); + } + + @BetaApi + public UnaryCallable insertRouteCallable() { + throw new UnsupportedOperationException("Not implemented: insertRouteCallable()"); + } + + @BetaApi + public UnaryCallable listRoutesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listRoutesPagedCallable()"); + } + + @BetaApi + public UnaryCallable listRoutesCallable() { + throw new UnsupportedOperationException("Not implemented: listRoutesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouteStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouteStubSettings.java new file mode 100644 index 000000000000..f37082e4f972 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouteStubSettings.java @@ -0,0 +1,414 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RouteClient.ListRoutesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteRouteHttpRequest; +import com.google.cloud.compute.v1.GetRouteHttpRequest; +import com.google.cloud.compute.v1.InsertRouteHttpRequest; +import com.google.cloud.compute.v1.ListRoutesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.Route; +import com.google.cloud.compute.v1.RouteList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RouteStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteRoute to 30 seconds: + * + *

+ * 
+ * RouteStubSettings.Builder routeSettingsBuilder =
+ *     RouteStubSettings.newBuilder();
+ * routeSettingsBuilder.deleteRouteSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RouteStubSettings routeSettings = routeSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RouteStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings deleteRouteSettings; + private final UnaryCallSettings getRouteSettings; + private final UnaryCallSettings insertRouteSettings; + private final PagedCallSettings + listRoutesSettings; + + /** Returns the object with the settings used for calls to deleteRoute. */ + public UnaryCallSettings deleteRouteSettings() { + return deleteRouteSettings; + } + + /** Returns the object with the settings used for calls to getRoute. */ + public UnaryCallSettings getRouteSettings() { + return getRouteSettings; + } + + /** Returns the object with the settings used for calls to insertRoute. */ + public UnaryCallSettings insertRouteSettings() { + return insertRouteSettings; + } + + /** Returns the object with the settings used for calls to listRoutes. */ + public PagedCallSettings + listRoutesSettings() { + return listRoutesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RouteStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonRouteStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(RouteStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RouteStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteRouteSettings = settingsBuilder.deleteRouteSettings().build(); + getRouteSettings = settingsBuilder.getRouteSettings().build(); + insertRouteSettings = settingsBuilder.insertRouteSettings().build(); + listRoutesSettings = settingsBuilder.listRoutesSettings().build(); + } + + private static final PagedListDescriptor + LIST_ROUTES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRoutesHttpRequest injectToken(ListRoutesHttpRequest payload, String token) { + return ListRoutesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListRoutesHttpRequest injectPageSize( + ListRoutesHttpRequest payload, int pageSize) { + return ListRoutesHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListRoutesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(RouteList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(RouteList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListRoutesHttpRequest, RouteList, ListRoutesPagedResponse> + LIST_ROUTES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRoutesHttpRequest, RouteList, ListRoutesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListRoutesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_ROUTES_PAGE_STR_DESC, request, context); + return ListRoutesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for RouteStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder deleteRouteSettings; + private final UnaryCallSettings.Builder getRouteSettings; + private final UnaryCallSettings.Builder insertRouteSettings; + private final PagedCallSettings.Builder< + ListRoutesHttpRequest, RouteList, ListRoutesPagedResponse> + listRoutesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteRouteSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getRouteSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertRouteSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listRoutesSettings = PagedCallSettings.newBuilder(LIST_ROUTES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteRouteSettings, getRouteSettings, insertRouteSettings, listRoutesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteRouteSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getRouteSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertRouteSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listRoutesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(RouteStubSettings settings) { + super(settings); + + deleteRouteSettings = settings.deleteRouteSettings.toBuilder(); + getRouteSettings = settings.getRouteSettings.toBuilder(); + insertRouteSettings = settings.insertRouteSettings.toBuilder(); + listRoutesSettings = settings.listRoutesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteRouteSettings, getRouteSettings, insertRouteSettings, listRoutesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteRoute. */ + public UnaryCallSettings.Builder deleteRouteSettings() { + return deleteRouteSettings; + } + + /** Returns the builder for the settings used for calls to getRoute. */ + public UnaryCallSettings.Builder getRouteSettings() { + return getRouteSettings; + } + + /** Returns the builder for the settings used for calls to insertRoute. */ + public UnaryCallSettings.Builder insertRouteSettings() { + return insertRouteSettings; + } + + /** Returns the builder for the settings used for calls to listRoutes. */ + public PagedCallSettings.Builder + listRoutesSettings() { + return listRoutesSettings; + } + + @Override + public RouteStubSettings build() throws IOException { + return new RouteStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouterStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouterStub.java new file mode 100644 index 000000000000..7abe4c7450e2 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouterStub.java @@ -0,0 +1,113 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RouterClient.AggregatedListRoutersPagedResponse; +import static com.google.cloud.compute.v1.RouterClient.ListRoutersPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListRoutersHttpRequest; +import com.google.cloud.compute.v1.DeleteRouterHttpRequest; +import com.google.cloud.compute.v1.GetRouterHttpRequest; +import com.google.cloud.compute.v1.GetRouterStatusRouterHttpRequest; +import com.google.cloud.compute.v1.InsertRouterHttpRequest; +import com.google.cloud.compute.v1.ListRoutersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchRouterHttpRequest; +import com.google.cloud.compute.v1.PreviewRouterHttpRequest; +import com.google.cloud.compute.v1.Router; +import com.google.cloud.compute.v1.RouterAggregatedList; +import com.google.cloud.compute.v1.RouterList; +import com.google.cloud.compute.v1.RouterStatusResponse; +import com.google.cloud.compute.v1.RoutersPreviewResponse; +import com.google.cloud.compute.v1.UpdateRouterHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class RouterStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + aggregatedListRoutersPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListRoutersPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListRoutersCallable() { + throw new UnsupportedOperationException("Not implemented: aggregatedListRoutersCallable()"); + } + + @BetaApi + public UnaryCallable deleteRouterCallable() { + throw new UnsupportedOperationException("Not implemented: deleteRouterCallable()"); + } + + @BetaApi + public UnaryCallable getRouterCallable() { + throw new UnsupportedOperationException("Not implemented: getRouterCallable()"); + } + + @BetaApi + public UnaryCallable + getRouterStatusRouterCallable() { + throw new UnsupportedOperationException("Not implemented: getRouterStatusRouterCallable()"); + } + + @BetaApi + public UnaryCallable insertRouterCallable() { + throw new UnsupportedOperationException("Not implemented: insertRouterCallable()"); + } + + @BetaApi + public UnaryCallable + listRoutersPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listRoutersPagedCallable()"); + } + + @BetaApi + public UnaryCallable listRoutersCallable() { + throw new UnsupportedOperationException("Not implemented: listRoutersCallable()"); + } + + @BetaApi + public UnaryCallable patchRouterCallable() { + throw new UnsupportedOperationException("Not implemented: patchRouterCallable()"); + } + + @BetaApi + public UnaryCallable previewRouterCallable() { + throw new UnsupportedOperationException("Not implemented: previewRouterCallable()"); + } + + @BetaApi + public UnaryCallable updateRouterCallable() { + throw new UnsupportedOperationException("Not implemented: updateRouterCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouterStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouterStubSettings.java new file mode 100644 index 000000000000..1c379f2dc19a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/RouterStubSettings.java @@ -0,0 +1,633 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.RouterClient.AggregatedListRoutersPagedResponse; +import static com.google.cloud.compute.v1.RouterClient.ListRoutersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListRoutersHttpRequest; +import com.google.cloud.compute.v1.DeleteRouterHttpRequest; +import com.google.cloud.compute.v1.GetRouterHttpRequest; +import com.google.cloud.compute.v1.GetRouterStatusRouterHttpRequest; +import com.google.cloud.compute.v1.InsertRouterHttpRequest; +import com.google.cloud.compute.v1.ListRoutersHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchRouterHttpRequest; +import com.google.cloud.compute.v1.PreviewRouterHttpRequest; +import com.google.cloud.compute.v1.Router; +import com.google.cloud.compute.v1.RouterAggregatedList; +import com.google.cloud.compute.v1.RouterList; +import com.google.cloud.compute.v1.RouterStatusResponse; +import com.google.cloud.compute.v1.RoutersPreviewResponse; +import com.google.cloud.compute.v1.RoutersScopedList; +import com.google.cloud.compute.v1.UpdateRouterHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link RouterStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteRouter to 30 seconds: + * + *

+ * 
+ * RouterStubSettings.Builder routerSettingsBuilder =
+ *     RouterStubSettings.newBuilder();
+ * routerSettingsBuilder.deleteRouterSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * RouterStubSettings routerSettings = routerSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class RouterStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListRoutersHttpRequest, RouterAggregatedList, + AggregatedListRoutersPagedResponse> + aggregatedListRoutersSettings; + private final UnaryCallSettings deleteRouterSettings; + private final UnaryCallSettings getRouterSettings; + private final UnaryCallSettings + getRouterStatusRouterSettings; + private final UnaryCallSettings insertRouterSettings; + private final PagedCallSettings + listRoutersSettings; + private final UnaryCallSettings patchRouterSettings; + private final UnaryCallSettings + previewRouterSettings; + private final UnaryCallSettings updateRouterSettings; + + /** Returns the object with the settings used for calls to aggregatedListRouters. */ + public PagedCallSettings< + AggregatedListRoutersHttpRequest, RouterAggregatedList, + AggregatedListRoutersPagedResponse> + aggregatedListRoutersSettings() { + return aggregatedListRoutersSettings; + } + + /** Returns the object with the settings used for calls to deleteRouter. */ + public UnaryCallSettings deleteRouterSettings() { + return deleteRouterSettings; + } + + /** Returns the object with the settings used for calls to getRouter. */ + public UnaryCallSettings getRouterSettings() { + return getRouterSettings; + } + + /** Returns the object with the settings used for calls to getRouterStatusRouter. */ + public UnaryCallSettings + getRouterStatusRouterSettings() { + return getRouterStatusRouterSettings; + } + + /** Returns the object with the settings used for calls to insertRouter. */ + public UnaryCallSettings insertRouterSettings() { + return insertRouterSettings; + } + + /** Returns the object with the settings used for calls to listRouters. */ + public PagedCallSettings + listRoutersSettings() { + return listRoutersSettings; + } + + /** Returns the object with the settings used for calls to patchRouter. */ + public UnaryCallSettings patchRouterSettings() { + return patchRouterSettings; + } + + /** Returns the object with the settings used for calls to previewRouter. */ + public UnaryCallSettings + previewRouterSettings() { + return previewRouterSettings; + } + + /** Returns the object with the settings used for calls to updateRouter. */ + public UnaryCallSettings updateRouterSettings() { + return updateRouterSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public RouterStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonRouterStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(RouterStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected RouterStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListRoutersSettings = settingsBuilder.aggregatedListRoutersSettings().build(); + deleteRouterSettings = settingsBuilder.deleteRouterSettings().build(); + getRouterSettings = settingsBuilder.getRouterSettings().build(); + getRouterStatusRouterSettings = settingsBuilder.getRouterStatusRouterSettings().build(); + insertRouterSettings = settingsBuilder.insertRouterSettings().build(); + listRoutersSettings = settingsBuilder.listRoutersSettings().build(); + patchRouterSettings = settingsBuilder.patchRouterSettings().build(); + previewRouterSettings = settingsBuilder.previewRouterSettings().build(); + updateRouterSettings = settingsBuilder.updateRouterSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListRoutersHttpRequest, RouterAggregatedList, RoutersScopedList> + AGGREGATED_LIST_ROUTERS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListRoutersHttpRequest, RouterAggregatedList, RoutersScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListRoutersHttpRequest injectToken( + AggregatedListRoutersHttpRequest payload, String token) { + return AggregatedListRoutersHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListRoutersHttpRequest injectPageSize( + AggregatedListRoutersHttpRequest payload, int pageSize) { + return AggregatedListRoutersHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListRoutersHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(RouterAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(RouterAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor + LIST_ROUTERS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRoutersHttpRequest injectToken( + ListRoutersHttpRequest payload, String token) { + return ListRoutersHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListRoutersHttpRequest injectPageSize( + ListRoutersHttpRequest payload, int pageSize) { + return ListRoutersHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListRoutersHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(RouterList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(RouterList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListRoutersHttpRequest, RouterAggregatedList, + AggregatedListRoutersPagedResponse> + AGGREGATED_LIST_ROUTERS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListRoutersHttpRequest, RouterAggregatedList, + AggregatedListRoutersPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + AggregatedListRoutersHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, AGGREGATED_LIST_ROUTERS_PAGE_STR_DESC, request, context); + return AggregatedListRoutersPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListRoutersHttpRequest, RouterList, ListRoutersPagedResponse> + LIST_ROUTERS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRoutersHttpRequest, RouterList, ListRoutersPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListRoutersHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_ROUTERS_PAGE_STR_DESC, request, context); + return ListRoutersPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for RouterStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListRoutersHttpRequest, RouterAggregatedList, + AggregatedListRoutersPagedResponse> + aggregatedListRoutersSettings; + private final UnaryCallSettings.Builder + deleteRouterSettings; + private final UnaryCallSettings.Builder getRouterSettings; + private final UnaryCallSettings.Builder + getRouterStatusRouterSettings; + private final UnaryCallSettings.Builder + insertRouterSettings; + private final PagedCallSettings.Builder< + ListRoutersHttpRequest, RouterList, ListRoutersPagedResponse> + listRoutersSettings; + private final UnaryCallSettings.Builder patchRouterSettings; + private final UnaryCallSettings.Builder + previewRouterSettings; + private final UnaryCallSettings.Builder + updateRouterSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListRoutersSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_ROUTERS_PAGE_STR_FACT); + + deleteRouterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getRouterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getRouterStatusRouterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertRouterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listRoutersSettings = PagedCallSettings.newBuilder(LIST_ROUTERS_PAGE_STR_FACT); + + patchRouterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + previewRouterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateRouterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListRoutersSettings, + deleteRouterSettings, + getRouterSettings, + getRouterStatusRouterSettings, + insertRouterSettings, + listRoutersSettings, + patchRouterSettings, + previewRouterSettings, + updateRouterSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListRoutersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteRouterSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getRouterSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getRouterStatusRouterSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertRouterSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listRoutersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchRouterSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .previewRouterSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateRouterSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(RouterStubSettings settings) { + super(settings); + + aggregatedListRoutersSettings = settings.aggregatedListRoutersSettings.toBuilder(); + deleteRouterSettings = settings.deleteRouterSettings.toBuilder(); + getRouterSettings = settings.getRouterSettings.toBuilder(); + getRouterStatusRouterSettings = settings.getRouterStatusRouterSettings.toBuilder(); + insertRouterSettings = settings.insertRouterSettings.toBuilder(); + listRoutersSettings = settings.listRoutersSettings.toBuilder(); + patchRouterSettings = settings.patchRouterSettings.toBuilder(); + previewRouterSettings = settings.previewRouterSettings.toBuilder(); + updateRouterSettings = settings.updateRouterSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListRoutersSettings, + deleteRouterSettings, + getRouterSettings, + getRouterStatusRouterSettings, + insertRouterSettings, + listRoutersSettings, + patchRouterSettings, + previewRouterSettings, + updateRouterSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListRouters. */ + public PagedCallSettings.Builder< + AggregatedListRoutersHttpRequest, RouterAggregatedList, + AggregatedListRoutersPagedResponse> + aggregatedListRoutersSettings() { + return aggregatedListRoutersSettings; + } + + /** Returns the builder for the settings used for calls to deleteRouter. */ + public UnaryCallSettings.Builder deleteRouterSettings() { + return deleteRouterSettings; + } + + /** Returns the builder for the settings used for calls to getRouter. */ + public UnaryCallSettings.Builder getRouterSettings() { + return getRouterSettings; + } + + /** Returns the builder for the settings used for calls to getRouterStatusRouter. */ + public UnaryCallSettings.Builder + getRouterStatusRouterSettings() { + return getRouterStatusRouterSettings; + } + + /** Returns the builder for the settings used for calls to insertRouter. */ + public UnaryCallSettings.Builder insertRouterSettings() { + return insertRouterSettings; + } + + /** Returns the builder for the settings used for calls to listRouters. */ + public PagedCallSettings.Builder + listRoutersSettings() { + return listRoutersSettings; + } + + /** Returns the builder for the settings used for calls to patchRouter. */ + public UnaryCallSettings.Builder patchRouterSettings() { + return patchRouterSettings; + } + + /** Returns the builder for the settings used for calls to previewRouter. */ + public UnaryCallSettings.Builder + previewRouterSettings() { + return previewRouterSettings; + } + + /** Returns the builder for the settings used for calls to updateRouter. */ + public UnaryCallSettings.Builder updateRouterSettings() { + return updateRouterSettings; + } + + @Override + public RouterStubSettings build() throws IOException { + return new RouterStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SnapshotStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SnapshotStub.java new file mode 100644 index 000000000000..fe21a5908d56 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SnapshotStub.java @@ -0,0 +1,70 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SnapshotClient.ListSnapshotsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteSnapshotHttpRequest; +import com.google.cloud.compute.v1.GetSnapshotHttpRequest; +import com.google.cloud.compute.v1.ListSnapshotsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetLabelsSnapshotHttpRequest; +import com.google.cloud.compute.v1.Snapshot; +import com.google.cloud.compute.v1.SnapshotList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class SnapshotStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteSnapshotCallable() { + throw new UnsupportedOperationException("Not implemented: deleteSnapshotCallable()"); + } + + @BetaApi + public UnaryCallable getSnapshotCallable() { + throw new UnsupportedOperationException("Not implemented: getSnapshotCallable()"); + } + + @BetaApi + public UnaryCallable + listSnapshotsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listSnapshotsPagedCallable()"); + } + + @BetaApi + public UnaryCallable listSnapshotsCallable() { + throw new UnsupportedOperationException("Not implemented: listSnapshotsCallable()"); + } + + @BetaApi + public UnaryCallable setLabelsSnapshotCallable() { + throw new UnsupportedOperationException("Not implemented: setLabelsSnapshotCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SnapshotStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SnapshotStubSettings.java new file mode 100644 index 000000000000..a7646118c60d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SnapshotStubSettings.java @@ -0,0 +1,428 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SnapshotClient.ListSnapshotsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteSnapshotHttpRequest; +import com.google.cloud.compute.v1.GetSnapshotHttpRequest; +import com.google.cloud.compute.v1.ListSnapshotsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetLabelsSnapshotHttpRequest; +import com.google.cloud.compute.v1.Snapshot; +import com.google.cloud.compute.v1.SnapshotList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link SnapshotStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteSnapshot to 30 seconds: + * + *

+ * 
+ * SnapshotStubSettings.Builder snapshotSettingsBuilder =
+ *     SnapshotStubSettings.newBuilder();
+ * snapshotSettingsBuilder.deleteSnapshotSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * SnapshotStubSettings snapshotSettings = snapshotSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SnapshotStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings deleteSnapshotSettings; + private final UnaryCallSettings getSnapshotSettings; + private final PagedCallSettings< + ListSnapshotsHttpRequest, SnapshotList, ListSnapshotsPagedResponse> + listSnapshotsSettings; + private final UnaryCallSettings + setLabelsSnapshotSettings; + + /** Returns the object with the settings used for calls to deleteSnapshot. */ + public UnaryCallSettings deleteSnapshotSettings() { + return deleteSnapshotSettings; + } + + /** Returns the object with the settings used for calls to getSnapshot. */ + public UnaryCallSettings getSnapshotSettings() { + return getSnapshotSettings; + } + + /** Returns the object with the settings used for calls to listSnapshots. */ + public PagedCallSettings + listSnapshotsSettings() { + return listSnapshotsSettings; + } + + /** Returns the object with the settings used for calls to setLabelsSnapshot. */ + public UnaryCallSettings setLabelsSnapshotSettings() { + return setLabelsSnapshotSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public SnapshotStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonSnapshotStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(SnapshotStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SnapshotStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteSnapshotSettings = settingsBuilder.deleteSnapshotSettings().build(); + getSnapshotSettings = settingsBuilder.getSnapshotSettings().build(); + listSnapshotsSettings = settingsBuilder.listSnapshotsSettings().build(); + setLabelsSnapshotSettings = settingsBuilder.setLabelsSnapshotSettings().build(); + } + + private static final PagedListDescriptor + LIST_SNAPSHOTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSnapshotsHttpRequest injectToken( + ListSnapshotsHttpRequest payload, String token) { + return ListSnapshotsHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSnapshotsHttpRequest injectPageSize( + ListSnapshotsHttpRequest payload, int pageSize) { + return ListSnapshotsHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListSnapshotsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(SnapshotList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(SnapshotList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListSnapshotsHttpRequest, SnapshotList, ListSnapshotsPagedResponse> + LIST_SNAPSHOTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSnapshotsHttpRequest, SnapshotList, ListSnapshotsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSnapshotsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_SNAPSHOTS_PAGE_STR_DESC, request, context); + return ListSnapshotsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for SnapshotStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteSnapshotSettings; + private final UnaryCallSettings.Builder getSnapshotSettings; + private final PagedCallSettings.Builder< + ListSnapshotsHttpRequest, SnapshotList, ListSnapshotsPagedResponse> + listSnapshotsSettings; + private final UnaryCallSettings.Builder + setLabelsSnapshotSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteSnapshotSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getSnapshotSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listSnapshotsSettings = PagedCallSettings.newBuilder(LIST_SNAPSHOTS_PAGE_STR_FACT); + + setLabelsSnapshotSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteSnapshotSettings, + getSnapshotSettings, + listSnapshotsSettings, + setLabelsSnapshotSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteSnapshotSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getSnapshotSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listSnapshotsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setLabelsSnapshotSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(SnapshotStubSettings settings) { + super(settings); + + deleteSnapshotSettings = settings.deleteSnapshotSettings.toBuilder(); + getSnapshotSettings = settings.getSnapshotSettings.toBuilder(); + listSnapshotsSettings = settings.listSnapshotsSettings.toBuilder(); + setLabelsSnapshotSettings = settings.setLabelsSnapshotSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteSnapshotSettings, + getSnapshotSettings, + listSnapshotsSettings, + setLabelsSnapshotSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteSnapshot. */ + public UnaryCallSettings.Builder + deleteSnapshotSettings() { + return deleteSnapshotSettings; + } + + /** Returns the builder for the settings used for calls to getSnapshot. */ + public UnaryCallSettings.Builder getSnapshotSettings() { + return getSnapshotSettings; + } + + /** Returns the builder for the settings used for calls to listSnapshots. */ + public PagedCallSettings.Builder< + ListSnapshotsHttpRequest, SnapshotList, ListSnapshotsPagedResponse> + listSnapshotsSettings() { + return listSnapshotsSettings; + } + + /** Returns the builder for the settings used for calls to setLabelsSnapshot. */ + public UnaryCallSettings.Builder + setLabelsSnapshotSettings() { + return setLabelsSnapshotSettings; + } + + @Override + public SnapshotStubSettings build() throws IOException { + return new SnapshotStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslCertificateStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslCertificateStub.java new file mode 100644 index 000000000000..5faa091d4e6c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslCertificateStub.java @@ -0,0 +1,71 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SslCertificateClient.ListSslCertificatesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteSslCertificateHttpRequest; +import com.google.cloud.compute.v1.GetSslCertificateHttpRequest; +import com.google.cloud.compute.v1.InsertSslCertificateHttpRequest; +import com.google.cloud.compute.v1.ListSslCertificatesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SslCertificate; +import com.google.cloud.compute.v1.SslCertificateList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class SslCertificateStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteSslCertificateCallable() { + throw new UnsupportedOperationException("Not implemented: deleteSslCertificateCallable()"); + } + + @BetaApi + public UnaryCallable getSslCertificateCallable() { + throw new UnsupportedOperationException("Not implemented: getSslCertificateCallable()"); + } + + @BetaApi + public UnaryCallable insertSslCertificateCallable() { + throw new UnsupportedOperationException("Not implemented: insertSslCertificateCallable()"); + } + + @BetaApi + public UnaryCallable + listSslCertificatesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listSslCertificatesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listSslCertificatesCallable() { + throw new UnsupportedOperationException("Not implemented: listSslCertificatesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslCertificateStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslCertificateStubSettings.java new file mode 100644 index 000000000000..fe0cf6eafb07 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslCertificateStubSettings.java @@ -0,0 +1,445 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SslCertificateClient.ListSslCertificatesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteSslCertificateHttpRequest; +import com.google.cloud.compute.v1.GetSslCertificateHttpRequest; +import com.google.cloud.compute.v1.InsertSslCertificateHttpRequest; +import com.google.cloud.compute.v1.ListSslCertificatesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SslCertificate; +import com.google.cloud.compute.v1.SslCertificateList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link SslCertificateStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteSslCertificate to 30 seconds: + * + *

+ * 
+ * SslCertificateStubSettings.Builder sslCertificateSettingsBuilder =
+ *     SslCertificateStubSettings.newBuilder();
+ * sslCertificateSettingsBuilder.deleteSslCertificateSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * SslCertificateStubSettings sslCertificateSettings = sslCertificateSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SslCertificateStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteSslCertificateSettings; + private final UnaryCallSettings + getSslCertificateSettings; + private final UnaryCallSettings + insertSslCertificateSettings; + private final PagedCallSettings< + ListSslCertificatesHttpRequest, SslCertificateList, ListSslCertificatesPagedResponse> + listSslCertificatesSettings; + + /** Returns the object with the settings used for calls to deleteSslCertificate. */ + public UnaryCallSettings + deleteSslCertificateSettings() { + return deleteSslCertificateSettings; + } + + /** Returns the object with the settings used for calls to getSslCertificate. */ + public UnaryCallSettings + getSslCertificateSettings() { + return getSslCertificateSettings; + } + + /** Returns the object with the settings used for calls to insertSslCertificate. */ + public UnaryCallSettings + insertSslCertificateSettings() { + return insertSslCertificateSettings; + } + + /** Returns the object with the settings used for calls to listSslCertificates. */ + public PagedCallSettings< + ListSslCertificatesHttpRequest, SslCertificateList, ListSslCertificatesPagedResponse> + listSslCertificatesSettings() { + return listSslCertificatesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public SslCertificateStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonSslCertificateStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(SslCertificateStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SslCertificateStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteSslCertificateSettings = settingsBuilder.deleteSslCertificateSettings().build(); + getSslCertificateSettings = settingsBuilder.getSslCertificateSettings().build(); + insertSslCertificateSettings = settingsBuilder.insertSslCertificateSettings().build(); + listSslCertificatesSettings = settingsBuilder.listSslCertificatesSettings().build(); + } + + private static final PagedListDescriptor< + ListSslCertificatesHttpRequest, SslCertificateList, SslCertificate> + LIST_SSL_CERTIFICATES_PAGE_STR_DESC = + new PagedListDescriptor< + ListSslCertificatesHttpRequest, SslCertificateList, SslCertificate>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSslCertificatesHttpRequest injectToken( + ListSslCertificatesHttpRequest payload, String token) { + return ListSslCertificatesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSslCertificatesHttpRequest injectPageSize( + ListSslCertificatesHttpRequest payload, int pageSize) { + return ListSslCertificatesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListSslCertificatesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(SslCertificateList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(SslCertificateList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListSslCertificatesHttpRequest, SslCertificateList, ListSslCertificatesPagedResponse> + LIST_SSL_CERTIFICATES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSslCertificatesHttpRequest, SslCertificateList, + ListSslCertificatesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSslCertificatesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_SSL_CERTIFICATES_PAGE_STR_DESC, request, context); + return ListSslCertificatesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for SslCertificateStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteSslCertificateSettings; + private final UnaryCallSettings.Builder + getSslCertificateSettings; + private final UnaryCallSettings.Builder + insertSslCertificateSettings; + private final PagedCallSettings.Builder< + ListSslCertificatesHttpRequest, SslCertificateList, ListSslCertificatesPagedResponse> + listSslCertificatesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteSslCertificateSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getSslCertificateSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertSslCertificateSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listSslCertificatesSettings = + PagedCallSettings.newBuilder(LIST_SSL_CERTIFICATES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteSslCertificateSettings, + getSslCertificateSettings, + insertSslCertificateSettings, + listSslCertificatesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteSslCertificateSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getSslCertificateSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertSslCertificateSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listSslCertificatesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(SslCertificateStubSettings settings) { + super(settings); + + deleteSslCertificateSettings = settings.deleteSslCertificateSettings.toBuilder(); + getSslCertificateSettings = settings.getSslCertificateSettings.toBuilder(); + insertSslCertificateSettings = settings.insertSslCertificateSettings.toBuilder(); + listSslCertificatesSettings = settings.listSslCertificatesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteSslCertificateSettings, + getSslCertificateSettings, + insertSslCertificateSettings, + listSslCertificatesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteSslCertificate. */ + public UnaryCallSettings.Builder + deleteSslCertificateSettings() { + return deleteSslCertificateSettings; + } + + /** Returns the builder for the settings used for calls to getSslCertificate. */ + public UnaryCallSettings.Builder + getSslCertificateSettings() { + return getSslCertificateSettings; + } + + /** Returns the builder for the settings used for calls to insertSslCertificate. */ + public UnaryCallSettings.Builder + insertSslCertificateSettings() { + return insertSslCertificateSettings; + } + + /** Returns the builder for the settings used for calls to listSslCertificates. */ + public PagedCallSettings.Builder< + ListSslCertificatesHttpRequest, SslCertificateList, ListSslCertificatesPagedResponse> + listSslCertificatesSettings() { + return listSslCertificatesSettings; + } + + @Override + public SslCertificateStubSettings build() throws IOException { + return new SslCertificateStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslPolicyStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslPolicyStub.java new file mode 100644 index 000000000000..dbf578db3371 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslPolicyStub.java @@ -0,0 +1,86 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SslPolicyClient.ListSslPoliciesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteSslPolicyHttpRequest; +import com.google.cloud.compute.v1.GetSslPolicyHttpRequest; +import com.google.cloud.compute.v1.InsertSslPolicyHttpRequest; +import com.google.cloud.compute.v1.ListAvailableFeaturesSslPoliciesHttpRequest; +import com.google.cloud.compute.v1.ListSslPoliciesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchSslPolicyHttpRequest; +import com.google.cloud.compute.v1.SslPoliciesList; +import com.google.cloud.compute.v1.SslPoliciesListAvailableFeaturesResponse; +import com.google.cloud.compute.v1.SslPolicy; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class SslPolicyStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteSslPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: deleteSslPolicyCallable()"); + } + + @BetaApi + public UnaryCallable getSslPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getSslPolicyCallable()"); + } + + @BetaApi + public UnaryCallable insertSslPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: insertSslPolicyCallable()"); + } + + @BetaApi + public UnaryCallable + listSslPoliciesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listSslPoliciesPagedCallable()"); + } + + @BetaApi + public UnaryCallable listSslPoliciesCallable() { + throw new UnsupportedOperationException("Not implemented: listSslPoliciesCallable()"); + } + + @BetaApi + public UnaryCallable< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesCallable() { + throw new UnsupportedOperationException( + "Not implemented: listAvailableFeaturesSslPoliciesCallable()"); + } + + @BetaApi + public UnaryCallable patchSslPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: patchSslPolicyCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslPolicyStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslPolicyStubSettings.java new file mode 100644 index 000000000000..48096607a206 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SslPolicyStubSettings.java @@ -0,0 +1,490 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SslPolicyClient.ListSslPoliciesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteSslPolicyHttpRequest; +import com.google.cloud.compute.v1.GetSslPolicyHttpRequest; +import com.google.cloud.compute.v1.InsertSslPolicyHttpRequest; +import com.google.cloud.compute.v1.ListAvailableFeaturesSslPoliciesHttpRequest; +import com.google.cloud.compute.v1.ListSslPoliciesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchSslPolicyHttpRequest; +import com.google.cloud.compute.v1.SslPoliciesList; +import com.google.cloud.compute.v1.SslPoliciesListAvailableFeaturesResponse; +import com.google.cloud.compute.v1.SslPolicy; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link SslPolicyStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteSslPolicy to 30 seconds: + * + *

+ * 
+ * SslPolicyStubSettings.Builder sslPolicySettingsBuilder =
+ *     SslPolicyStubSettings.newBuilder();
+ * sslPolicySettingsBuilder.deleteSslPolicySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * SslPolicyStubSettings sslPolicySettings = sslPolicySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SslPolicyStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings deleteSslPolicySettings; + private final UnaryCallSettings getSslPolicySettings; + private final UnaryCallSettings insertSslPolicySettings; + private final PagedCallSettings< + ListSslPoliciesHttpRequest, SslPoliciesList, ListSslPoliciesPagedResponse> + listSslPoliciesSettings; + private final UnaryCallSettings< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesSettings; + private final UnaryCallSettings patchSslPolicySettings; + + /** Returns the object with the settings used for calls to deleteSslPolicy. */ + public UnaryCallSettings deleteSslPolicySettings() { + return deleteSslPolicySettings; + } + + /** Returns the object with the settings used for calls to getSslPolicy. */ + public UnaryCallSettings getSslPolicySettings() { + return getSslPolicySettings; + } + + /** Returns the object with the settings used for calls to insertSslPolicy. */ + public UnaryCallSettings insertSslPolicySettings() { + return insertSslPolicySettings; + } + + /** Returns the object with the settings used for calls to listSslPolicies. */ + public PagedCallSettings< + ListSslPoliciesHttpRequest, SslPoliciesList, ListSslPoliciesPagedResponse> + listSslPoliciesSettings() { + return listSslPoliciesSettings; + } + + /** Returns the object with the settings used for calls to listAvailableFeaturesSslPolicies. */ + public UnaryCallSettings< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesSettings() { + return listAvailableFeaturesSslPoliciesSettings; + } + + /** Returns the object with the settings used for calls to patchSslPolicy. */ + public UnaryCallSettings patchSslPolicySettings() { + return patchSslPolicySettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public SslPolicyStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonSslPolicyStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(SslPolicyStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SslPolicyStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteSslPolicySettings = settingsBuilder.deleteSslPolicySettings().build(); + getSslPolicySettings = settingsBuilder.getSslPolicySettings().build(); + insertSslPolicySettings = settingsBuilder.insertSslPolicySettings().build(); + listSslPoliciesSettings = settingsBuilder.listSslPoliciesSettings().build(); + listAvailableFeaturesSslPoliciesSettings = + settingsBuilder.listAvailableFeaturesSslPoliciesSettings().build(); + patchSslPolicySettings = settingsBuilder.patchSslPolicySettings().build(); + } + + private static final PagedListDescriptor + LIST_SSL_POLICIES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSslPoliciesHttpRequest injectToken( + ListSslPoliciesHttpRequest payload, String token) { + return ListSslPoliciesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSslPoliciesHttpRequest injectPageSize( + ListSslPoliciesHttpRequest payload, int pageSize) { + return ListSslPoliciesHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListSslPoliciesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(SslPoliciesList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(SslPoliciesList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListSslPoliciesHttpRequest, SslPoliciesList, ListSslPoliciesPagedResponse> + LIST_SSL_POLICIES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSslPoliciesHttpRequest, SslPoliciesList, ListSslPoliciesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSslPoliciesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_SSL_POLICIES_PAGE_STR_DESC, request, context); + return ListSslPoliciesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for SslPolicyStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteSslPolicySettings; + private final UnaryCallSettings.Builder + getSslPolicySettings; + private final UnaryCallSettings.Builder + insertSslPolicySettings; + private final PagedCallSettings.Builder< + ListSslPoliciesHttpRequest, SslPoliciesList, ListSslPoliciesPagedResponse> + listSslPoliciesSettings; + private final UnaryCallSettings.Builder< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesSettings; + private final UnaryCallSettings.Builder + patchSslPolicySettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteSslPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getSslPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertSslPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listSslPoliciesSettings = PagedCallSettings.newBuilder(LIST_SSL_POLICIES_PAGE_STR_FACT); + + listAvailableFeaturesSslPoliciesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + patchSslPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteSslPolicySettings, + getSslPolicySettings, + insertSslPolicySettings, + listSslPoliciesSettings, + listAvailableFeaturesSslPoliciesSettings, + patchSslPolicySettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteSslPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getSslPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertSslPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listSslPoliciesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listAvailableFeaturesSslPoliciesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchSslPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(SslPolicyStubSettings settings) { + super(settings); + + deleteSslPolicySettings = settings.deleteSslPolicySettings.toBuilder(); + getSslPolicySettings = settings.getSslPolicySettings.toBuilder(); + insertSslPolicySettings = settings.insertSslPolicySettings.toBuilder(); + listSslPoliciesSettings = settings.listSslPoliciesSettings.toBuilder(); + listAvailableFeaturesSslPoliciesSettings = + settings.listAvailableFeaturesSslPoliciesSettings.toBuilder(); + patchSslPolicySettings = settings.patchSslPolicySettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteSslPolicySettings, + getSslPolicySettings, + insertSslPolicySettings, + listSslPoliciesSettings, + listAvailableFeaturesSslPoliciesSettings, + patchSslPolicySettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteSslPolicy. */ + public UnaryCallSettings.Builder + deleteSslPolicySettings() { + return deleteSslPolicySettings; + } + + /** Returns the builder for the settings used for calls to getSslPolicy. */ + public UnaryCallSettings.Builder getSslPolicySettings() { + return getSslPolicySettings; + } + + /** Returns the builder for the settings used for calls to insertSslPolicy. */ + public UnaryCallSettings.Builder + insertSslPolicySettings() { + return insertSslPolicySettings; + } + + /** Returns the builder for the settings used for calls to listSslPolicies. */ + public PagedCallSettings.Builder< + ListSslPoliciesHttpRequest, SslPoliciesList, ListSslPoliciesPagedResponse> + listSslPoliciesSettings() { + return listSslPoliciesSettings; + } + + /** Returns the builder for the settings used for calls to listAvailableFeaturesSslPolicies. */ + public UnaryCallSettings.Builder< + ListAvailableFeaturesSslPoliciesHttpRequest, SslPoliciesListAvailableFeaturesResponse> + listAvailableFeaturesSslPoliciesSettings() { + return listAvailableFeaturesSslPoliciesSettings; + } + + /** Returns the builder for the settings used for calls to patchSslPolicy. */ + public UnaryCallSettings.Builder + patchSslPolicySettings() { + return patchSslPolicySettings; + } + + @Override + public SslPolicyStubSettings build() throws IOException { + return new SslPolicyStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SubnetworkStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SubnetworkStub.java new file mode 100644 index 000000000000..2f42ed4f54e4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SubnetworkStub.java @@ -0,0 +1,108 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SubnetworkClient.AggregatedListSubnetworksPagedResponse; +import static com.google.cloud.compute.v1.SubnetworkClient.ListSubnetworksPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListSubnetworksHttpRequest; +import com.google.cloud.compute.v1.DeleteSubnetworkHttpRequest; +import com.google.cloud.compute.v1.ExpandIpCidrRangeSubnetworkHttpRequest; +import com.google.cloud.compute.v1.GetSubnetworkHttpRequest; +import com.google.cloud.compute.v1.InsertSubnetworkHttpRequest; +import com.google.cloud.compute.v1.ListSubnetworksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchSubnetworkHttpRequest; +import com.google.cloud.compute.v1.SetPrivateIpGoogleAccessSubnetworkHttpRequest; +import com.google.cloud.compute.v1.Subnetwork; +import com.google.cloud.compute.v1.SubnetworkAggregatedList; +import com.google.cloud.compute.v1.SubnetworkList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class SubnetworkStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + aggregatedListSubnetworksPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListSubnetworksPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListSubnetworksCallable() { + throw new UnsupportedOperationException("Not implemented: aggregatedListSubnetworksCallable()"); + } + + @BetaApi + public UnaryCallable deleteSubnetworkCallable() { + throw new UnsupportedOperationException("Not implemented: deleteSubnetworkCallable()"); + } + + @BetaApi + public UnaryCallable + expandIpCidrRangeSubnetworkCallable() { + throw new UnsupportedOperationException( + "Not implemented: expandIpCidrRangeSubnetworkCallable()"); + } + + @BetaApi + public UnaryCallable getSubnetworkCallable() { + throw new UnsupportedOperationException("Not implemented: getSubnetworkCallable()"); + } + + @BetaApi + public UnaryCallable insertSubnetworkCallable() { + throw new UnsupportedOperationException("Not implemented: insertSubnetworkCallable()"); + } + + @BetaApi + public UnaryCallable + listSubnetworksPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listSubnetworksPagedCallable()"); + } + + @BetaApi + public UnaryCallable listSubnetworksCallable() { + throw new UnsupportedOperationException("Not implemented: listSubnetworksCallable()"); + } + + @BetaApi + public UnaryCallable patchSubnetworkCallable() { + throw new UnsupportedOperationException("Not implemented: patchSubnetworkCallable()"); + } + + @BetaApi + public UnaryCallable + setPrivateIpGoogleAccessSubnetworkCallable() { + throw new UnsupportedOperationException( + "Not implemented: setPrivateIpGoogleAccessSubnetworkCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SubnetworkStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SubnetworkStubSettings.java new file mode 100644 index 000000000000..fc76af86aa9c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/SubnetworkStubSettings.java @@ -0,0 +1,627 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.SubnetworkClient.AggregatedListSubnetworksPagedResponse; +import static com.google.cloud.compute.v1.SubnetworkClient.ListSubnetworksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListSubnetworksHttpRequest; +import com.google.cloud.compute.v1.DeleteSubnetworkHttpRequest; +import com.google.cloud.compute.v1.ExpandIpCidrRangeSubnetworkHttpRequest; +import com.google.cloud.compute.v1.GetSubnetworkHttpRequest; +import com.google.cloud.compute.v1.InsertSubnetworkHttpRequest; +import com.google.cloud.compute.v1.ListSubnetworksHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchSubnetworkHttpRequest; +import com.google.cloud.compute.v1.SetPrivateIpGoogleAccessSubnetworkHttpRequest; +import com.google.cloud.compute.v1.Subnetwork; +import com.google.cloud.compute.v1.SubnetworkAggregatedList; +import com.google.cloud.compute.v1.SubnetworkList; +import com.google.cloud.compute.v1.SubnetworksScopedList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link SubnetworkStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteSubnetwork to 30 seconds: + * + *

+ * 
+ * SubnetworkStubSettings.Builder subnetworkSettingsBuilder =
+ *     SubnetworkStubSettings.newBuilder();
+ * subnetworkSettingsBuilder.deleteSubnetworkSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * SubnetworkStubSettings subnetworkSettings = subnetworkSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class SubnetworkStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + AggregatedListSubnetworksPagedResponse> + aggregatedListSubnetworksSettings; + private final UnaryCallSettings deleteSubnetworkSettings; + private final UnaryCallSettings + expandIpCidrRangeSubnetworkSettings; + private final UnaryCallSettings getSubnetworkSettings; + private final UnaryCallSettings insertSubnetworkSettings; + private final PagedCallSettings< + ListSubnetworksHttpRequest, SubnetworkList, ListSubnetworksPagedResponse> + listSubnetworksSettings; + private final UnaryCallSettings patchSubnetworkSettings; + private final UnaryCallSettings + setPrivateIpGoogleAccessSubnetworkSettings; + + /** Returns the object with the settings used for calls to aggregatedListSubnetworks. */ + public PagedCallSettings< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + AggregatedListSubnetworksPagedResponse> + aggregatedListSubnetworksSettings() { + return aggregatedListSubnetworksSettings; + } + + /** Returns the object with the settings used for calls to deleteSubnetwork. */ + public UnaryCallSettings deleteSubnetworkSettings() { + return deleteSubnetworkSettings; + } + + /** Returns the object with the settings used for calls to expandIpCidrRangeSubnetwork. */ + public UnaryCallSettings + expandIpCidrRangeSubnetworkSettings() { + return expandIpCidrRangeSubnetworkSettings; + } + + /** Returns the object with the settings used for calls to getSubnetwork. */ + public UnaryCallSettings getSubnetworkSettings() { + return getSubnetworkSettings; + } + + /** Returns the object with the settings used for calls to insertSubnetwork. */ + public UnaryCallSettings insertSubnetworkSettings() { + return insertSubnetworkSettings; + } + + /** Returns the object with the settings used for calls to listSubnetworks. */ + public PagedCallSettings + listSubnetworksSettings() { + return listSubnetworksSettings; + } + + /** Returns the object with the settings used for calls to patchSubnetwork. */ + public UnaryCallSettings patchSubnetworkSettings() { + return patchSubnetworkSettings; + } + + /** Returns the object with the settings used for calls to setPrivateIpGoogleAccessSubnetwork. */ + public UnaryCallSettings + setPrivateIpGoogleAccessSubnetworkSettings() { + return setPrivateIpGoogleAccessSubnetworkSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public SubnetworkStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonSubnetworkStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(SubnetworkStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SubnetworkStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListSubnetworksSettings = settingsBuilder.aggregatedListSubnetworksSettings().build(); + deleteSubnetworkSettings = settingsBuilder.deleteSubnetworkSettings().build(); + expandIpCidrRangeSubnetworkSettings = + settingsBuilder.expandIpCidrRangeSubnetworkSettings().build(); + getSubnetworkSettings = settingsBuilder.getSubnetworkSettings().build(); + insertSubnetworkSettings = settingsBuilder.insertSubnetworkSettings().build(); + listSubnetworksSettings = settingsBuilder.listSubnetworksSettings().build(); + patchSubnetworkSettings = settingsBuilder.patchSubnetworkSettings().build(); + setPrivateIpGoogleAccessSubnetworkSettings = + settingsBuilder.setPrivateIpGoogleAccessSubnetworkSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, SubnetworksScopedList> + AGGREGATED_LIST_SUBNETWORKS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + SubnetworksScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListSubnetworksHttpRequest injectToken( + AggregatedListSubnetworksHttpRequest payload, String token) { + return AggregatedListSubnetworksHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListSubnetworksHttpRequest injectPageSize( + AggregatedListSubnetworksHttpRequest payload, int pageSize) { + return AggregatedListSubnetworksHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListSubnetworksHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(SubnetworkAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + SubnetworkAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor + LIST_SUBNETWORKS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSubnetworksHttpRequest injectToken( + ListSubnetworksHttpRequest payload, String token) { + return ListSubnetworksHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSubnetworksHttpRequest injectPageSize( + ListSubnetworksHttpRequest payload, int pageSize) { + return ListSubnetworksHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListSubnetworksHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(SubnetworkList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(SubnetworkList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + AggregatedListSubnetworksPagedResponse> + AGGREGATED_LIST_SUBNETWORKS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + AggregatedListSubnetworksPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + AggregatedListSubnetworksHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + SubnetworksScopedList> + pageContext = + PageContext.create( + callable, AGGREGATED_LIST_SUBNETWORKS_PAGE_STR_DESC, request, context); + return AggregatedListSubnetworksPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListSubnetworksHttpRequest, SubnetworkList, ListSubnetworksPagedResponse> + LIST_SUBNETWORKS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSubnetworksHttpRequest, SubnetworkList, ListSubnetworksPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSubnetworksHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_SUBNETWORKS_PAGE_STR_DESC, request, context); + return ListSubnetworksPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for SubnetworkStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + AggregatedListSubnetworksPagedResponse> + aggregatedListSubnetworksSettings; + private final UnaryCallSettings.Builder + deleteSubnetworkSettings; + private final UnaryCallSettings.Builder + expandIpCidrRangeSubnetworkSettings; + private final UnaryCallSettings.Builder + getSubnetworkSettings; + private final UnaryCallSettings.Builder + insertSubnetworkSettings; + private final PagedCallSettings.Builder< + ListSubnetworksHttpRequest, SubnetworkList, ListSubnetworksPagedResponse> + listSubnetworksSettings; + private final UnaryCallSettings.Builder + patchSubnetworkSettings; + private final UnaryCallSettings.Builder< + SetPrivateIpGoogleAccessSubnetworkHttpRequest, Operation> + setPrivateIpGoogleAccessSubnetworkSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListSubnetworksSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_SUBNETWORKS_PAGE_STR_FACT); + + deleteSubnetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + expandIpCidrRangeSubnetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getSubnetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertSubnetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listSubnetworksSettings = PagedCallSettings.newBuilder(LIST_SUBNETWORKS_PAGE_STR_FACT); + + patchSubnetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setPrivateIpGoogleAccessSubnetworkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListSubnetworksSettings, + deleteSubnetworkSettings, + expandIpCidrRangeSubnetworkSettings, + getSubnetworkSettings, + insertSubnetworkSettings, + listSubnetworksSettings, + patchSubnetworkSettings, + setPrivateIpGoogleAccessSubnetworkSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListSubnetworksSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteSubnetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .expandIpCidrRangeSubnetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getSubnetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertSubnetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listSubnetworksSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchSubnetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setPrivateIpGoogleAccessSubnetworkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(SubnetworkStubSettings settings) { + super(settings); + + aggregatedListSubnetworksSettings = settings.aggregatedListSubnetworksSettings.toBuilder(); + deleteSubnetworkSettings = settings.deleteSubnetworkSettings.toBuilder(); + expandIpCidrRangeSubnetworkSettings = + settings.expandIpCidrRangeSubnetworkSettings.toBuilder(); + getSubnetworkSettings = settings.getSubnetworkSettings.toBuilder(); + insertSubnetworkSettings = settings.insertSubnetworkSettings.toBuilder(); + listSubnetworksSettings = settings.listSubnetworksSettings.toBuilder(); + patchSubnetworkSettings = settings.patchSubnetworkSettings.toBuilder(); + setPrivateIpGoogleAccessSubnetworkSettings = + settings.setPrivateIpGoogleAccessSubnetworkSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListSubnetworksSettings, + deleteSubnetworkSettings, + expandIpCidrRangeSubnetworkSettings, + getSubnetworkSettings, + insertSubnetworkSettings, + listSubnetworksSettings, + patchSubnetworkSettings, + setPrivateIpGoogleAccessSubnetworkSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListSubnetworks. */ + public PagedCallSettings.Builder< + AggregatedListSubnetworksHttpRequest, SubnetworkAggregatedList, + AggregatedListSubnetworksPagedResponse> + aggregatedListSubnetworksSettings() { + return aggregatedListSubnetworksSettings; + } + + /** Returns the builder for the settings used for calls to deleteSubnetwork. */ + public UnaryCallSettings.Builder + deleteSubnetworkSettings() { + return deleteSubnetworkSettings; + } + + /** Returns the builder for the settings used for calls to expandIpCidrRangeSubnetwork. */ + public UnaryCallSettings.Builder + expandIpCidrRangeSubnetworkSettings() { + return expandIpCidrRangeSubnetworkSettings; + } + + /** Returns the builder for the settings used for calls to getSubnetwork. */ + public UnaryCallSettings.Builder getSubnetworkSettings() { + return getSubnetworkSettings; + } + + /** Returns the builder for the settings used for calls to insertSubnetwork. */ + public UnaryCallSettings.Builder + insertSubnetworkSettings() { + return insertSubnetworkSettings; + } + + /** Returns the builder for the settings used for calls to listSubnetworks. */ + public PagedCallSettings.Builder< + ListSubnetworksHttpRequest, SubnetworkList, ListSubnetworksPagedResponse> + listSubnetworksSettings() { + return listSubnetworksSettings; + } + + /** Returns the builder for the settings used for calls to patchSubnetwork. */ + public UnaryCallSettings.Builder + patchSubnetworkSettings() { + return patchSubnetworkSettings; + } + + /** + * Returns the builder for the settings used for calls to setPrivateIpGoogleAccessSubnetwork. + */ + public UnaryCallSettings.Builder + setPrivateIpGoogleAccessSubnetworkSettings() { + return setPrivateIpGoogleAccessSubnetworkSettings; + } + + @Override + public SubnetworkStubSettings build() throws IOException { + return new SubnetworkStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpProxyStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpProxyStub.java new file mode 100644 index 000000000000..60b9a7405540 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpProxyStub.java @@ -0,0 +1,82 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetHttpProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetUrlMapTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.TargetHttpProxy; +import com.google.cloud.compute.v1.TargetHttpProxyList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class TargetHttpProxyStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + deleteTargetHttpProxyCallable() { + throw new UnsupportedOperationException("Not implemented: deleteTargetHttpProxyCallable()"); + } + + @BetaApi + public UnaryCallable + getTargetHttpProxyCallable() { + throw new UnsupportedOperationException("Not implemented: getTargetHttpProxyCallable()"); + } + + @BetaApi + public UnaryCallable + insertTargetHttpProxyCallable() { + throw new UnsupportedOperationException("Not implemented: insertTargetHttpProxyCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetHttpProxiesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listTargetHttpProxiesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetHttpProxiesCallable() { + throw new UnsupportedOperationException("Not implemented: listTargetHttpProxiesCallable()"); + } + + @BetaApi + public UnaryCallable + setUrlMapTargetHttpProxyCallable() { + throw new UnsupportedOperationException("Not implemented: setUrlMapTargetHttpProxyCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpProxyStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpProxyStubSettings.java new file mode 100644 index 000000000000..adf9b921b5dd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpProxyStubSettings.java @@ -0,0 +1,477 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetHttpProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetUrlMapTargetHttpProxyHttpRequest; +import com.google.cloud.compute.v1.TargetHttpProxy; +import com.google.cloud.compute.v1.TargetHttpProxyList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetHttpProxyStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetHttpProxy to 30 seconds: + * + *

+ * 
+ * TargetHttpProxyStubSettings.Builder targetHttpProxySettingsBuilder =
+ *     TargetHttpProxyStubSettings.newBuilder();
+ * targetHttpProxySettingsBuilder.deleteTargetHttpProxySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetHttpProxyStubSettings targetHttpProxySettings = targetHttpProxySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetHttpProxyStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteTargetHttpProxySettings; + private final UnaryCallSettings + getTargetHttpProxySettings; + private final UnaryCallSettings + insertTargetHttpProxySettings; + private final PagedCallSettings< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, ListTargetHttpProxiesPagedResponse> + listTargetHttpProxiesSettings; + private final UnaryCallSettings + setUrlMapTargetHttpProxySettings; + + /** Returns the object with the settings used for calls to deleteTargetHttpProxy. */ + public UnaryCallSettings + deleteTargetHttpProxySettings() { + return deleteTargetHttpProxySettings; + } + + /** Returns the object with the settings used for calls to getTargetHttpProxy. */ + public UnaryCallSettings + getTargetHttpProxySettings() { + return getTargetHttpProxySettings; + } + + /** Returns the object with the settings used for calls to insertTargetHttpProxy. */ + public UnaryCallSettings + insertTargetHttpProxySettings() { + return insertTargetHttpProxySettings; + } + + /** Returns the object with the settings used for calls to listTargetHttpProxies. */ + public PagedCallSettings< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, ListTargetHttpProxiesPagedResponse> + listTargetHttpProxiesSettings() { + return listTargetHttpProxiesSettings; + } + + /** Returns the object with the settings used for calls to setUrlMapTargetHttpProxy. */ + public UnaryCallSettings + setUrlMapTargetHttpProxySettings() { + return setUrlMapTargetHttpProxySettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetHttpProxyStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonTargetHttpProxyStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(TargetHttpProxyStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetHttpProxyStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteTargetHttpProxySettings = settingsBuilder.deleteTargetHttpProxySettings().build(); + getTargetHttpProxySettings = settingsBuilder.getTargetHttpProxySettings().build(); + insertTargetHttpProxySettings = settingsBuilder.insertTargetHttpProxySettings().build(); + listTargetHttpProxiesSettings = settingsBuilder.listTargetHttpProxiesSettings().build(); + setUrlMapTargetHttpProxySettings = settingsBuilder.setUrlMapTargetHttpProxySettings().build(); + } + + private static final PagedListDescriptor< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, TargetHttpProxy> + LIST_TARGET_HTTP_PROXIES_PAGE_STR_DESC = + new PagedListDescriptor< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, TargetHttpProxy>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTargetHttpProxiesHttpRequest injectToken( + ListTargetHttpProxiesHttpRequest payload, String token) { + return ListTargetHttpProxiesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListTargetHttpProxiesHttpRequest injectPageSize( + ListTargetHttpProxiesHttpRequest payload, int pageSize) { + return ListTargetHttpProxiesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListTargetHttpProxiesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(TargetHttpProxyList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(TargetHttpProxyList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, ListTargetHttpProxiesPagedResponse> + LIST_TARGET_HTTP_PROXIES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, + ListTargetHttpProxiesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTargetHttpProxiesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_TARGET_HTTP_PROXIES_PAGE_STR_DESC, request, context); + return ListTargetHttpProxiesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for TargetHttpProxyStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteTargetHttpProxySettings; + private final UnaryCallSettings.Builder + getTargetHttpProxySettings; + private final UnaryCallSettings.Builder + insertTargetHttpProxySettings; + private final PagedCallSettings.Builder< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, + ListTargetHttpProxiesPagedResponse> + listTargetHttpProxiesSettings; + private final UnaryCallSettings.Builder + setUrlMapTargetHttpProxySettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteTargetHttpProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getTargetHttpProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertTargetHttpProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listTargetHttpProxiesSettings = + PagedCallSettings.newBuilder(LIST_TARGET_HTTP_PROXIES_PAGE_STR_FACT); + + setUrlMapTargetHttpProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteTargetHttpProxySettings, + getTargetHttpProxySettings, + insertTargetHttpProxySettings, + listTargetHttpProxiesSettings, + setUrlMapTargetHttpProxySettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteTargetHttpProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getTargetHttpProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertTargetHttpProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listTargetHttpProxiesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setUrlMapTargetHttpProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(TargetHttpProxyStubSettings settings) { + super(settings); + + deleteTargetHttpProxySettings = settings.deleteTargetHttpProxySettings.toBuilder(); + getTargetHttpProxySettings = settings.getTargetHttpProxySettings.toBuilder(); + insertTargetHttpProxySettings = settings.insertTargetHttpProxySettings.toBuilder(); + listTargetHttpProxiesSettings = settings.listTargetHttpProxiesSettings.toBuilder(); + setUrlMapTargetHttpProxySettings = settings.setUrlMapTargetHttpProxySettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteTargetHttpProxySettings, + getTargetHttpProxySettings, + insertTargetHttpProxySettings, + listTargetHttpProxiesSettings, + setUrlMapTargetHttpProxySettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteTargetHttpProxy. */ + public UnaryCallSettings.Builder + deleteTargetHttpProxySettings() { + return deleteTargetHttpProxySettings; + } + + /** Returns the builder for the settings used for calls to getTargetHttpProxy. */ + public UnaryCallSettings.Builder + getTargetHttpProxySettings() { + return getTargetHttpProxySettings; + } + + /** Returns the builder for the settings used for calls to insertTargetHttpProxy. */ + public UnaryCallSettings.Builder + insertTargetHttpProxySettings() { + return insertTargetHttpProxySettings; + } + + /** Returns the builder for the settings used for calls to listTargetHttpProxies. */ + public PagedCallSettings.Builder< + ListTargetHttpProxiesHttpRequest, TargetHttpProxyList, + ListTargetHttpProxiesPagedResponse> + listTargetHttpProxiesSettings() { + return listTargetHttpProxiesSettings; + } + + /** Returns the builder for the settings used for calls to setUrlMapTargetHttpProxy. */ + public UnaryCallSettings.Builder + setUrlMapTargetHttpProxySettings() { + return setUrlMapTargetHttpProxySettings; + } + + @Override + public TargetHttpProxyStubSettings build() throws IOException { + return new TargetHttpProxyStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpsProxyStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpsProxyStub.java new file mode 100644 index 000000000000..343f601b5e60 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpsProxyStub.java @@ -0,0 +1,98 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetHttpsProxyClient.ListTargetHttpsProxiesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetHttpsProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetSslCertificatesTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.SetSslPolicyTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.SetUrlMapTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.TargetHttpsProxy; +import com.google.cloud.compute.v1.TargetHttpsProxyList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class TargetHttpsProxyStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + deleteTargetHttpsProxyCallable() { + throw new UnsupportedOperationException("Not implemented: deleteTargetHttpsProxyCallable()"); + } + + @BetaApi + public UnaryCallable + getTargetHttpsProxyCallable() { + throw new UnsupportedOperationException("Not implemented: getTargetHttpsProxyCallable()"); + } + + @BetaApi + public UnaryCallable + insertTargetHttpsProxyCallable() { + throw new UnsupportedOperationException("Not implemented: insertTargetHttpsProxyCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetHttpsProxiesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listTargetHttpsProxiesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetHttpsProxiesCallable() { + throw new UnsupportedOperationException("Not implemented: listTargetHttpsProxiesCallable()"); + } + + @BetaApi + public UnaryCallable + setSslCertificatesTargetHttpsProxyCallable() { + throw new UnsupportedOperationException( + "Not implemented: setSslCertificatesTargetHttpsProxyCallable()"); + } + + @BetaApi + public UnaryCallable + setSslPolicyTargetHttpsProxyCallable() { + throw new UnsupportedOperationException( + "Not implemented: setSslPolicyTargetHttpsProxyCallable()"); + } + + @BetaApi + public UnaryCallable + setUrlMapTargetHttpsProxyCallable() { + throw new UnsupportedOperationException("Not implemented: setUrlMapTargetHttpsProxyCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpsProxyStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpsProxyStubSettings.java new file mode 100644 index 000000000000..fc3650a47ac5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetHttpsProxyStubSettings.java @@ -0,0 +1,543 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetHttpsProxyClient.ListTargetHttpsProxiesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetHttpsProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetSslCertificatesTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.SetSslPolicyTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.SetUrlMapTargetHttpsProxyHttpRequest; +import com.google.cloud.compute.v1.TargetHttpsProxy; +import com.google.cloud.compute.v1.TargetHttpsProxyList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetHttpsProxyStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetHttpsProxy to 30 seconds: + * + *

+ * 
+ * TargetHttpsProxyStubSettings.Builder targetHttpsProxySettingsBuilder =
+ *     TargetHttpsProxyStubSettings.newBuilder();
+ * targetHttpsProxySettingsBuilder.deleteTargetHttpsProxySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetHttpsProxyStubSettings targetHttpsProxySettings = targetHttpsProxySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetHttpsProxyStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteTargetHttpsProxySettings; + private final UnaryCallSettings + getTargetHttpsProxySettings; + private final UnaryCallSettings + insertTargetHttpsProxySettings; + private final PagedCallSettings< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, + ListTargetHttpsProxiesPagedResponse> + listTargetHttpsProxiesSettings; + private final UnaryCallSettings + setSslCertificatesTargetHttpsProxySettings; + private final UnaryCallSettings + setSslPolicyTargetHttpsProxySettings; + private final UnaryCallSettings + setUrlMapTargetHttpsProxySettings; + + /** Returns the object with the settings used for calls to deleteTargetHttpsProxy. */ + public UnaryCallSettings + deleteTargetHttpsProxySettings() { + return deleteTargetHttpsProxySettings; + } + + /** Returns the object with the settings used for calls to getTargetHttpsProxy. */ + public UnaryCallSettings + getTargetHttpsProxySettings() { + return getTargetHttpsProxySettings; + } + + /** Returns the object with the settings used for calls to insertTargetHttpsProxy. */ + public UnaryCallSettings + insertTargetHttpsProxySettings() { + return insertTargetHttpsProxySettings; + } + + /** Returns the object with the settings used for calls to listTargetHttpsProxies. */ + public PagedCallSettings< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, + ListTargetHttpsProxiesPagedResponse> + listTargetHttpsProxiesSettings() { + return listTargetHttpsProxiesSettings; + } + + /** Returns the object with the settings used for calls to setSslCertificatesTargetHttpsProxy. */ + public UnaryCallSettings + setSslCertificatesTargetHttpsProxySettings() { + return setSslCertificatesTargetHttpsProxySettings; + } + + /** Returns the object with the settings used for calls to setSslPolicyTargetHttpsProxy. */ + public UnaryCallSettings + setSslPolicyTargetHttpsProxySettings() { + return setSslPolicyTargetHttpsProxySettings; + } + + /** Returns the object with the settings used for calls to setUrlMapTargetHttpsProxy. */ + public UnaryCallSettings + setUrlMapTargetHttpsProxySettings() { + return setUrlMapTargetHttpsProxySettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetHttpsProxyStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonTargetHttpsProxyStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(TargetHttpsProxyStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetHttpsProxyStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteTargetHttpsProxySettings = settingsBuilder.deleteTargetHttpsProxySettings().build(); + getTargetHttpsProxySettings = settingsBuilder.getTargetHttpsProxySettings().build(); + insertTargetHttpsProxySettings = settingsBuilder.insertTargetHttpsProxySettings().build(); + listTargetHttpsProxiesSettings = settingsBuilder.listTargetHttpsProxiesSettings().build(); + setSslCertificatesTargetHttpsProxySettings = + settingsBuilder.setSslCertificatesTargetHttpsProxySettings().build(); + setSslPolicyTargetHttpsProxySettings = + settingsBuilder.setSslPolicyTargetHttpsProxySettings().build(); + setUrlMapTargetHttpsProxySettings = settingsBuilder.setUrlMapTargetHttpsProxySettings().build(); + } + + private static final PagedListDescriptor< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, TargetHttpsProxy> + LIST_TARGET_HTTPS_PROXIES_PAGE_STR_DESC = + new PagedListDescriptor< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, TargetHttpsProxy>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTargetHttpsProxiesHttpRequest injectToken( + ListTargetHttpsProxiesHttpRequest payload, String token) { + return ListTargetHttpsProxiesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListTargetHttpsProxiesHttpRequest injectPageSize( + ListTargetHttpsProxiesHttpRequest payload, int pageSize) { + return ListTargetHttpsProxiesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListTargetHttpsProxiesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(TargetHttpsProxyList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(TargetHttpsProxyList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, + ListTargetHttpsProxiesPagedResponse> + LIST_TARGET_HTTPS_PROXIES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, + ListTargetHttpsProxiesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTargetHttpsProxiesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_TARGET_HTTPS_PROXIES_PAGE_STR_DESC, request, context); + return ListTargetHttpsProxiesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for TargetHttpsProxyStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteTargetHttpsProxySettings; + private final UnaryCallSettings.Builder + getTargetHttpsProxySettings; + private final UnaryCallSettings.Builder + insertTargetHttpsProxySettings; + private final PagedCallSettings.Builder< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, + ListTargetHttpsProxiesPagedResponse> + listTargetHttpsProxiesSettings; + private final UnaryCallSettings.Builder< + SetSslCertificatesTargetHttpsProxyHttpRequest, Operation> + setSslCertificatesTargetHttpsProxySettings; + private final UnaryCallSettings.Builder + setSslPolicyTargetHttpsProxySettings; + private final UnaryCallSettings.Builder + setUrlMapTargetHttpsProxySettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteTargetHttpsProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getTargetHttpsProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertTargetHttpsProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listTargetHttpsProxiesSettings = + PagedCallSettings.newBuilder(LIST_TARGET_HTTPS_PROXIES_PAGE_STR_FACT); + + setSslCertificatesTargetHttpsProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setSslPolicyTargetHttpsProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setUrlMapTargetHttpsProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteTargetHttpsProxySettings, + getTargetHttpsProxySettings, + insertTargetHttpsProxySettings, + listTargetHttpsProxiesSettings, + setSslCertificatesTargetHttpsProxySettings, + setSslPolicyTargetHttpsProxySettings, + setUrlMapTargetHttpsProxySettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteTargetHttpsProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getTargetHttpsProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertTargetHttpsProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listTargetHttpsProxiesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setSslCertificatesTargetHttpsProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setSslPolicyTargetHttpsProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setUrlMapTargetHttpsProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(TargetHttpsProxyStubSettings settings) { + super(settings); + + deleteTargetHttpsProxySettings = settings.deleteTargetHttpsProxySettings.toBuilder(); + getTargetHttpsProxySettings = settings.getTargetHttpsProxySettings.toBuilder(); + insertTargetHttpsProxySettings = settings.insertTargetHttpsProxySettings.toBuilder(); + listTargetHttpsProxiesSettings = settings.listTargetHttpsProxiesSettings.toBuilder(); + setSslCertificatesTargetHttpsProxySettings = + settings.setSslCertificatesTargetHttpsProxySettings.toBuilder(); + setSslPolicyTargetHttpsProxySettings = + settings.setSslPolicyTargetHttpsProxySettings.toBuilder(); + setUrlMapTargetHttpsProxySettings = settings.setUrlMapTargetHttpsProxySettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteTargetHttpsProxySettings, + getTargetHttpsProxySettings, + insertTargetHttpsProxySettings, + listTargetHttpsProxiesSettings, + setSslCertificatesTargetHttpsProxySettings, + setSslPolicyTargetHttpsProxySettings, + setUrlMapTargetHttpsProxySettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteTargetHttpsProxy. */ + public UnaryCallSettings.Builder + deleteTargetHttpsProxySettings() { + return deleteTargetHttpsProxySettings; + } + + /** Returns the builder for the settings used for calls to getTargetHttpsProxy. */ + public UnaryCallSettings.Builder + getTargetHttpsProxySettings() { + return getTargetHttpsProxySettings; + } + + /** Returns the builder for the settings used for calls to insertTargetHttpsProxy. */ + public UnaryCallSettings.Builder + insertTargetHttpsProxySettings() { + return insertTargetHttpsProxySettings; + } + + /** Returns the builder for the settings used for calls to listTargetHttpsProxies. */ + public PagedCallSettings.Builder< + ListTargetHttpsProxiesHttpRequest, TargetHttpsProxyList, + ListTargetHttpsProxiesPagedResponse> + listTargetHttpsProxiesSettings() { + return listTargetHttpsProxiesSettings; + } + + /** + * Returns the builder for the settings used for calls to setSslCertificatesTargetHttpsProxy. + */ + public UnaryCallSettings.Builder + setSslCertificatesTargetHttpsProxySettings() { + return setSslCertificatesTargetHttpsProxySettings; + } + + /** Returns the builder for the settings used for calls to setSslPolicyTargetHttpsProxy. */ + public UnaryCallSettings.Builder + setSslPolicyTargetHttpsProxySettings() { + return setSslPolicyTargetHttpsProxySettings; + } + + /** Returns the builder for the settings used for calls to setUrlMapTargetHttpsProxy. */ + public UnaryCallSettings.Builder + setUrlMapTargetHttpsProxySettings() { + return setUrlMapTargetHttpsProxySettings; + } + + @Override + public TargetHttpsProxyStubSettings build() throws IOException { + return new TargetHttpsProxyStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetInstanceStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetInstanceStub.java new file mode 100644 index 000000000000..733993de1451 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetInstanceStub.java @@ -0,0 +1,89 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetInstanceClient.AggregatedListTargetInstancesPagedResponse; +import static com.google.cloud.compute.v1.TargetInstanceClient.ListTargetInstancesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListTargetInstancesHttpRequest; +import com.google.cloud.compute.v1.DeleteTargetInstanceHttpRequest; +import com.google.cloud.compute.v1.GetTargetInstanceHttpRequest; +import com.google.cloud.compute.v1.InsertTargetInstanceHttpRequest; +import com.google.cloud.compute.v1.ListTargetInstancesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.TargetInstance; +import com.google.cloud.compute.v1.TargetInstanceAggregatedList; +import com.google.cloud.compute.v1.TargetInstanceList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class TargetInstanceStub implements BackgroundResource { + + @BetaApi + public UnaryCallable< + AggregatedListTargetInstancesHttpRequest, AggregatedListTargetInstancesPagedResponse> + aggregatedListTargetInstancesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListTargetInstancesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListTargetInstancesCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListTargetInstancesCallable()"); + } + + @BetaApi + public UnaryCallable deleteTargetInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: deleteTargetInstanceCallable()"); + } + + @BetaApi + public UnaryCallable getTargetInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: getTargetInstanceCallable()"); + } + + @BetaApi + public UnaryCallable insertTargetInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: insertTargetInstanceCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetInstancesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listTargetInstancesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetInstancesCallable() { + throw new UnsupportedOperationException("Not implemented: listTargetInstancesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetInstanceStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetInstanceStubSettings.java new file mode 100644 index 000000000000..4ada09b98847 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetInstanceStubSettings.java @@ -0,0 +1,561 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetInstanceClient.AggregatedListTargetInstancesPagedResponse; +import static com.google.cloud.compute.v1.TargetInstanceClient.ListTargetInstancesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListTargetInstancesHttpRequest; +import com.google.cloud.compute.v1.DeleteTargetInstanceHttpRequest; +import com.google.cloud.compute.v1.GetTargetInstanceHttpRequest; +import com.google.cloud.compute.v1.InsertTargetInstanceHttpRequest; +import com.google.cloud.compute.v1.ListTargetInstancesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.TargetInstance; +import com.google.cloud.compute.v1.TargetInstanceAggregatedList; +import com.google.cloud.compute.v1.TargetInstanceList; +import com.google.cloud.compute.v1.TargetInstancesScopedList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetInstanceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetInstance to 30 seconds: + * + *

+ * 
+ * TargetInstanceStubSettings.Builder targetInstanceSettingsBuilder =
+ *     TargetInstanceStubSettings.newBuilder();
+ * targetInstanceSettingsBuilder.deleteTargetInstanceSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetInstanceStubSettings targetInstanceSettings = targetInstanceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetInstanceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + AggregatedListTargetInstancesPagedResponse> + aggregatedListTargetInstancesSettings; + private final UnaryCallSettings + deleteTargetInstanceSettings; + private final UnaryCallSettings + getTargetInstanceSettings; + private final UnaryCallSettings + insertTargetInstanceSettings; + private final PagedCallSettings< + ListTargetInstancesHttpRequest, TargetInstanceList, ListTargetInstancesPagedResponse> + listTargetInstancesSettings; + + /** Returns the object with the settings used for calls to aggregatedListTargetInstances. */ + public PagedCallSettings< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + AggregatedListTargetInstancesPagedResponse> + aggregatedListTargetInstancesSettings() { + return aggregatedListTargetInstancesSettings; + } + + /** Returns the object with the settings used for calls to deleteTargetInstance. */ + public UnaryCallSettings + deleteTargetInstanceSettings() { + return deleteTargetInstanceSettings; + } + + /** Returns the object with the settings used for calls to getTargetInstance. */ + public UnaryCallSettings + getTargetInstanceSettings() { + return getTargetInstanceSettings; + } + + /** Returns the object with the settings used for calls to insertTargetInstance. */ + public UnaryCallSettings + insertTargetInstanceSettings() { + return insertTargetInstanceSettings; + } + + /** Returns the object with the settings used for calls to listTargetInstances. */ + public PagedCallSettings< + ListTargetInstancesHttpRequest, TargetInstanceList, ListTargetInstancesPagedResponse> + listTargetInstancesSettings() { + return listTargetInstancesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetInstanceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonTargetInstanceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(TargetInstanceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetInstanceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListTargetInstancesSettings = + settingsBuilder.aggregatedListTargetInstancesSettings().build(); + deleteTargetInstanceSettings = settingsBuilder.deleteTargetInstanceSettings().build(); + getTargetInstanceSettings = settingsBuilder.getTargetInstanceSettings().build(); + insertTargetInstanceSettings = settingsBuilder.insertTargetInstanceSettings().build(); + listTargetInstancesSettings = settingsBuilder.listTargetInstancesSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + TargetInstancesScopedList> + AGGREGATED_LIST_TARGET_INSTANCES_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + TargetInstancesScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListTargetInstancesHttpRequest injectToken( + AggregatedListTargetInstancesHttpRequest payload, String token) { + return AggregatedListTargetInstancesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListTargetInstancesHttpRequest injectPageSize( + AggregatedListTargetInstancesHttpRequest payload, int pageSize) { + return AggregatedListTargetInstancesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListTargetInstancesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(TargetInstanceAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + TargetInstanceAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor< + ListTargetInstancesHttpRequest, TargetInstanceList, TargetInstance> + LIST_TARGET_INSTANCES_PAGE_STR_DESC = + new PagedListDescriptor< + ListTargetInstancesHttpRequest, TargetInstanceList, TargetInstance>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTargetInstancesHttpRequest injectToken( + ListTargetInstancesHttpRequest payload, String token) { + return ListTargetInstancesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListTargetInstancesHttpRequest injectPageSize( + ListTargetInstancesHttpRequest payload, int pageSize) { + return ListTargetInstancesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListTargetInstancesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(TargetInstanceList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(TargetInstanceList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + AggregatedListTargetInstancesPagedResponse> + AGGREGATED_LIST_TARGET_INSTANCES_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + AggregatedListTargetInstancesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList> + callable, + AggregatedListTargetInstancesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + TargetInstancesScopedList> + pageContext = + PageContext.create( + callable, + AGGREGATED_LIST_TARGET_INSTANCES_PAGE_STR_DESC, + request, + context); + return AggregatedListTargetInstancesPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListTargetInstancesHttpRequest, TargetInstanceList, ListTargetInstancesPagedResponse> + LIST_TARGET_INSTANCES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTargetInstancesHttpRequest, TargetInstanceList, + ListTargetInstancesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTargetInstancesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_TARGET_INSTANCES_PAGE_STR_DESC, request, context); + return ListTargetInstancesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for TargetInstanceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + AggregatedListTargetInstancesPagedResponse> + aggregatedListTargetInstancesSettings; + private final UnaryCallSettings.Builder + deleteTargetInstanceSettings; + private final UnaryCallSettings.Builder + getTargetInstanceSettings; + private final UnaryCallSettings.Builder + insertTargetInstanceSettings; + private final PagedCallSettings.Builder< + ListTargetInstancesHttpRequest, TargetInstanceList, ListTargetInstancesPagedResponse> + listTargetInstancesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListTargetInstancesSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_TARGET_INSTANCES_PAGE_STR_FACT); + + deleteTargetInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getTargetInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertTargetInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listTargetInstancesSettings = + PagedCallSettings.newBuilder(LIST_TARGET_INSTANCES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListTargetInstancesSettings, + deleteTargetInstanceSettings, + getTargetInstanceSettings, + insertTargetInstanceSettings, + listTargetInstancesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListTargetInstancesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteTargetInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getTargetInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertTargetInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listTargetInstancesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(TargetInstanceStubSettings settings) { + super(settings); + + aggregatedListTargetInstancesSettings = + settings.aggregatedListTargetInstancesSettings.toBuilder(); + deleteTargetInstanceSettings = settings.deleteTargetInstanceSettings.toBuilder(); + getTargetInstanceSettings = settings.getTargetInstanceSettings.toBuilder(); + insertTargetInstanceSettings = settings.insertTargetInstanceSettings.toBuilder(); + listTargetInstancesSettings = settings.listTargetInstancesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListTargetInstancesSettings, + deleteTargetInstanceSettings, + getTargetInstanceSettings, + insertTargetInstanceSettings, + listTargetInstancesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListTargetInstances. */ + public PagedCallSettings.Builder< + AggregatedListTargetInstancesHttpRequest, TargetInstanceAggregatedList, + AggregatedListTargetInstancesPagedResponse> + aggregatedListTargetInstancesSettings() { + return aggregatedListTargetInstancesSettings; + } + + /** Returns the builder for the settings used for calls to deleteTargetInstance. */ + public UnaryCallSettings.Builder + deleteTargetInstanceSettings() { + return deleteTargetInstanceSettings; + } + + /** Returns the builder for the settings used for calls to getTargetInstance. */ + public UnaryCallSettings.Builder + getTargetInstanceSettings() { + return getTargetInstanceSettings; + } + + /** Returns the builder for the settings used for calls to insertTargetInstance. */ + public UnaryCallSettings.Builder + insertTargetInstanceSettings() { + return insertTargetInstanceSettings; + } + + /** Returns the builder for the settings used for calls to listTargetInstances. */ + public PagedCallSettings.Builder< + ListTargetInstancesHttpRequest, TargetInstanceList, ListTargetInstancesPagedResponse> + listTargetInstancesSettings() { + return listTargetInstancesSettings; + } + + @Override + public TargetInstanceStubSettings build() throws IOException { + return new TargetInstanceStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetPoolStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetPoolStub.java new file mode 100644 index 000000000000..1124cae057b4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetPoolStub.java @@ -0,0 +1,129 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetPoolClient.AggregatedListTargetPoolsPagedResponse; +import static com.google.cloud.compute.v1.TargetPoolClient.ListTargetPoolsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AddHealthCheckTargetPoolHttpRequest; +import com.google.cloud.compute.v1.AddInstanceTargetPoolHttpRequest; +import com.google.cloud.compute.v1.AggregatedListTargetPoolsHttpRequest; +import com.google.cloud.compute.v1.DeleteTargetPoolHttpRequest; +import com.google.cloud.compute.v1.GetHealthTargetPoolHttpRequest; +import com.google.cloud.compute.v1.GetTargetPoolHttpRequest; +import com.google.cloud.compute.v1.InsertTargetPoolHttpRequest; +import com.google.cloud.compute.v1.ListTargetPoolsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.RemoveHealthCheckTargetPoolHttpRequest; +import com.google.cloud.compute.v1.RemoveInstanceTargetPoolHttpRequest; +import com.google.cloud.compute.v1.SetBackupTargetPoolHttpRequest; +import com.google.cloud.compute.v1.TargetPool; +import com.google.cloud.compute.v1.TargetPoolAggregatedList; +import com.google.cloud.compute.v1.TargetPoolInstanceHealth; +import com.google.cloud.compute.v1.TargetPoolList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class TargetPoolStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + addHealthCheckTargetPoolCallable() { + throw new UnsupportedOperationException("Not implemented: addHealthCheckTargetPoolCallable()"); + } + + @BetaApi + public UnaryCallable + addInstanceTargetPoolCallable() { + throw new UnsupportedOperationException("Not implemented: addInstanceTargetPoolCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListTargetPoolsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListTargetPoolsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListTargetPoolsCallable() { + throw new UnsupportedOperationException("Not implemented: aggregatedListTargetPoolsCallable()"); + } + + @BetaApi + public UnaryCallable deleteTargetPoolCallable() { + throw new UnsupportedOperationException("Not implemented: deleteTargetPoolCallable()"); + } + + @BetaApi + public UnaryCallable getTargetPoolCallable() { + throw new UnsupportedOperationException("Not implemented: getTargetPoolCallable()"); + } + + @BetaApi + public UnaryCallable + getHealthTargetPoolCallable() { + throw new UnsupportedOperationException("Not implemented: getHealthTargetPoolCallable()"); + } + + @BetaApi + public UnaryCallable insertTargetPoolCallable() { + throw new UnsupportedOperationException("Not implemented: insertTargetPoolCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetPoolsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listTargetPoolsPagedCallable()"); + } + + @BetaApi + public UnaryCallable listTargetPoolsCallable() { + throw new UnsupportedOperationException("Not implemented: listTargetPoolsCallable()"); + } + + @BetaApi + public UnaryCallable + removeHealthCheckTargetPoolCallable() { + throw new UnsupportedOperationException( + "Not implemented: removeHealthCheckTargetPoolCallable()"); + } + + @BetaApi + public UnaryCallable + removeInstanceTargetPoolCallable() { + throw new UnsupportedOperationException("Not implemented: removeInstanceTargetPoolCallable()"); + } + + @BetaApi + public UnaryCallable setBackupTargetPoolCallable() { + throw new UnsupportedOperationException("Not implemented: setBackupTargetPoolCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetPoolStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetPoolStubSettings.java new file mode 100644 index 000000000000..239def189ab1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetPoolStubSettings.java @@ -0,0 +1,710 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetPoolClient.AggregatedListTargetPoolsPagedResponse; +import static com.google.cloud.compute.v1.TargetPoolClient.ListTargetPoolsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AddHealthCheckTargetPoolHttpRequest; +import com.google.cloud.compute.v1.AddInstanceTargetPoolHttpRequest; +import com.google.cloud.compute.v1.AggregatedListTargetPoolsHttpRequest; +import com.google.cloud.compute.v1.DeleteTargetPoolHttpRequest; +import com.google.cloud.compute.v1.GetHealthTargetPoolHttpRequest; +import com.google.cloud.compute.v1.GetTargetPoolHttpRequest; +import com.google.cloud.compute.v1.InsertTargetPoolHttpRequest; +import com.google.cloud.compute.v1.ListTargetPoolsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.RemoveHealthCheckTargetPoolHttpRequest; +import com.google.cloud.compute.v1.RemoveInstanceTargetPoolHttpRequest; +import com.google.cloud.compute.v1.SetBackupTargetPoolHttpRequest; +import com.google.cloud.compute.v1.TargetPool; +import com.google.cloud.compute.v1.TargetPoolAggregatedList; +import com.google.cloud.compute.v1.TargetPoolInstanceHealth; +import com.google.cloud.compute.v1.TargetPoolList; +import com.google.cloud.compute.v1.TargetPoolsScopedList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetPoolStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of addHealthCheckTargetPool to 30 seconds: + * + *

+ * 
+ * TargetPoolStubSettings.Builder targetPoolSettingsBuilder =
+ *     TargetPoolStubSettings.newBuilder();
+ * targetPoolSettingsBuilder.addHealthCheckTargetPoolSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetPoolStubSettings targetPoolSettings = targetPoolSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetPoolStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + addHealthCheckTargetPoolSettings; + private final UnaryCallSettings + addInstanceTargetPoolSettings; + private final PagedCallSettings< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + AggregatedListTargetPoolsPagedResponse> + aggregatedListTargetPoolsSettings; + private final UnaryCallSettings deleteTargetPoolSettings; + private final UnaryCallSettings getTargetPoolSettings; + private final UnaryCallSettings + getHealthTargetPoolSettings; + private final UnaryCallSettings insertTargetPoolSettings; + private final PagedCallSettings< + ListTargetPoolsHttpRequest, TargetPoolList, ListTargetPoolsPagedResponse> + listTargetPoolsSettings; + private final UnaryCallSettings + removeHealthCheckTargetPoolSettings; + private final UnaryCallSettings + removeInstanceTargetPoolSettings; + private final UnaryCallSettings + setBackupTargetPoolSettings; + + /** Returns the object with the settings used for calls to addHealthCheckTargetPool. */ + public UnaryCallSettings + addHealthCheckTargetPoolSettings() { + return addHealthCheckTargetPoolSettings; + } + + /** Returns the object with the settings used for calls to addInstanceTargetPool. */ + public UnaryCallSettings + addInstanceTargetPoolSettings() { + return addInstanceTargetPoolSettings; + } + + /** Returns the object with the settings used for calls to aggregatedListTargetPools. */ + public PagedCallSettings< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + AggregatedListTargetPoolsPagedResponse> + aggregatedListTargetPoolsSettings() { + return aggregatedListTargetPoolsSettings; + } + + /** Returns the object with the settings used for calls to deleteTargetPool. */ + public UnaryCallSettings deleteTargetPoolSettings() { + return deleteTargetPoolSettings; + } + + /** Returns the object with the settings used for calls to getTargetPool. */ + public UnaryCallSettings getTargetPoolSettings() { + return getTargetPoolSettings; + } + + /** Returns the object with the settings used for calls to getHealthTargetPool. */ + public UnaryCallSettings + getHealthTargetPoolSettings() { + return getHealthTargetPoolSettings; + } + + /** Returns the object with the settings used for calls to insertTargetPool. */ + public UnaryCallSettings insertTargetPoolSettings() { + return insertTargetPoolSettings; + } + + /** Returns the object with the settings used for calls to listTargetPools. */ + public PagedCallSettings + listTargetPoolsSettings() { + return listTargetPoolsSettings; + } + + /** Returns the object with the settings used for calls to removeHealthCheckTargetPool. */ + public UnaryCallSettings + removeHealthCheckTargetPoolSettings() { + return removeHealthCheckTargetPoolSettings; + } + + /** Returns the object with the settings used for calls to removeInstanceTargetPool. */ + public UnaryCallSettings + removeInstanceTargetPoolSettings() { + return removeInstanceTargetPoolSettings; + } + + /** Returns the object with the settings used for calls to setBackupTargetPool. */ + public UnaryCallSettings + setBackupTargetPoolSettings() { + return setBackupTargetPoolSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetPoolStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonTargetPoolStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(TargetPoolStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetPoolStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + addHealthCheckTargetPoolSettings = settingsBuilder.addHealthCheckTargetPoolSettings().build(); + addInstanceTargetPoolSettings = settingsBuilder.addInstanceTargetPoolSettings().build(); + aggregatedListTargetPoolsSettings = settingsBuilder.aggregatedListTargetPoolsSettings().build(); + deleteTargetPoolSettings = settingsBuilder.deleteTargetPoolSettings().build(); + getTargetPoolSettings = settingsBuilder.getTargetPoolSettings().build(); + getHealthTargetPoolSettings = settingsBuilder.getHealthTargetPoolSettings().build(); + insertTargetPoolSettings = settingsBuilder.insertTargetPoolSettings().build(); + listTargetPoolsSettings = settingsBuilder.listTargetPoolsSettings().build(); + removeHealthCheckTargetPoolSettings = + settingsBuilder.removeHealthCheckTargetPoolSettings().build(); + removeInstanceTargetPoolSettings = settingsBuilder.removeInstanceTargetPoolSettings().build(); + setBackupTargetPoolSettings = settingsBuilder.setBackupTargetPoolSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, TargetPoolsScopedList> + AGGREGATED_LIST_TARGET_POOLS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + TargetPoolsScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListTargetPoolsHttpRequest injectToken( + AggregatedListTargetPoolsHttpRequest payload, String token) { + return AggregatedListTargetPoolsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListTargetPoolsHttpRequest injectPageSize( + AggregatedListTargetPoolsHttpRequest payload, int pageSize) { + return AggregatedListTargetPoolsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListTargetPoolsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(TargetPoolAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + TargetPoolAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor + LIST_TARGET_POOLS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTargetPoolsHttpRequest injectToken( + ListTargetPoolsHttpRequest payload, String token) { + return ListTargetPoolsHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListTargetPoolsHttpRequest injectPageSize( + ListTargetPoolsHttpRequest payload, int pageSize) { + return ListTargetPoolsHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListTargetPoolsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(TargetPoolList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(TargetPoolList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + AggregatedListTargetPoolsPagedResponse> + AGGREGATED_LIST_TARGET_POOLS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + AggregatedListTargetPoolsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + AggregatedListTargetPoolsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + TargetPoolsScopedList> + pageContext = + PageContext.create( + callable, AGGREGATED_LIST_TARGET_POOLS_PAGE_STR_DESC, request, context); + return AggregatedListTargetPoolsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListTargetPoolsHttpRequest, TargetPoolList, ListTargetPoolsPagedResponse> + LIST_TARGET_POOLS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTargetPoolsHttpRequest, TargetPoolList, ListTargetPoolsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTargetPoolsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_TARGET_POOLS_PAGE_STR_DESC, request, context); + return ListTargetPoolsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for TargetPoolStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + addHealthCheckTargetPoolSettings; + private final UnaryCallSettings.Builder + addInstanceTargetPoolSettings; + private final PagedCallSettings.Builder< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + AggregatedListTargetPoolsPagedResponse> + aggregatedListTargetPoolsSettings; + private final UnaryCallSettings.Builder + deleteTargetPoolSettings; + private final UnaryCallSettings.Builder + getTargetPoolSettings; + private final UnaryCallSettings.Builder< + GetHealthTargetPoolHttpRequest, TargetPoolInstanceHealth> + getHealthTargetPoolSettings; + private final UnaryCallSettings.Builder + insertTargetPoolSettings; + private final PagedCallSettings.Builder< + ListTargetPoolsHttpRequest, TargetPoolList, ListTargetPoolsPagedResponse> + listTargetPoolsSettings; + private final UnaryCallSettings.Builder + removeHealthCheckTargetPoolSettings; + private final UnaryCallSettings.Builder + removeInstanceTargetPoolSettings; + private final UnaryCallSettings.Builder + setBackupTargetPoolSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + addHealthCheckTargetPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + addInstanceTargetPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + aggregatedListTargetPoolsSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_TARGET_POOLS_PAGE_STR_FACT); + + deleteTargetPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getTargetPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getHealthTargetPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertTargetPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listTargetPoolsSettings = PagedCallSettings.newBuilder(LIST_TARGET_POOLS_PAGE_STR_FACT); + + removeHealthCheckTargetPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + removeInstanceTargetPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setBackupTargetPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + addHealthCheckTargetPoolSettings, + addInstanceTargetPoolSettings, + aggregatedListTargetPoolsSettings, + deleteTargetPoolSettings, + getTargetPoolSettings, + getHealthTargetPoolSettings, + insertTargetPoolSettings, + listTargetPoolsSettings, + removeHealthCheckTargetPoolSettings, + removeInstanceTargetPoolSettings, + setBackupTargetPoolSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .addHealthCheckTargetPoolSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .addInstanceTargetPoolSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .aggregatedListTargetPoolsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteTargetPoolSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getTargetPoolSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getHealthTargetPoolSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertTargetPoolSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listTargetPoolsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .removeHealthCheckTargetPoolSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .removeInstanceTargetPoolSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setBackupTargetPoolSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(TargetPoolStubSettings settings) { + super(settings); + + addHealthCheckTargetPoolSettings = settings.addHealthCheckTargetPoolSettings.toBuilder(); + addInstanceTargetPoolSettings = settings.addInstanceTargetPoolSettings.toBuilder(); + aggregatedListTargetPoolsSettings = settings.aggregatedListTargetPoolsSettings.toBuilder(); + deleteTargetPoolSettings = settings.deleteTargetPoolSettings.toBuilder(); + getTargetPoolSettings = settings.getTargetPoolSettings.toBuilder(); + getHealthTargetPoolSettings = settings.getHealthTargetPoolSettings.toBuilder(); + insertTargetPoolSettings = settings.insertTargetPoolSettings.toBuilder(); + listTargetPoolsSettings = settings.listTargetPoolsSettings.toBuilder(); + removeHealthCheckTargetPoolSettings = + settings.removeHealthCheckTargetPoolSettings.toBuilder(); + removeInstanceTargetPoolSettings = settings.removeInstanceTargetPoolSettings.toBuilder(); + setBackupTargetPoolSettings = settings.setBackupTargetPoolSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + addHealthCheckTargetPoolSettings, + addInstanceTargetPoolSettings, + aggregatedListTargetPoolsSettings, + deleteTargetPoolSettings, + getTargetPoolSettings, + getHealthTargetPoolSettings, + insertTargetPoolSettings, + listTargetPoolsSettings, + removeHealthCheckTargetPoolSettings, + removeInstanceTargetPoolSettings, + setBackupTargetPoolSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to addHealthCheckTargetPool. */ + public UnaryCallSettings.Builder + addHealthCheckTargetPoolSettings() { + return addHealthCheckTargetPoolSettings; + } + + /** Returns the builder for the settings used for calls to addInstanceTargetPool. */ + public UnaryCallSettings.Builder + addInstanceTargetPoolSettings() { + return addInstanceTargetPoolSettings; + } + + /** Returns the builder for the settings used for calls to aggregatedListTargetPools. */ + public PagedCallSettings.Builder< + AggregatedListTargetPoolsHttpRequest, TargetPoolAggregatedList, + AggregatedListTargetPoolsPagedResponse> + aggregatedListTargetPoolsSettings() { + return aggregatedListTargetPoolsSettings; + } + + /** Returns the builder for the settings used for calls to deleteTargetPool. */ + public UnaryCallSettings.Builder + deleteTargetPoolSettings() { + return deleteTargetPoolSettings; + } + + /** Returns the builder for the settings used for calls to getTargetPool. */ + public UnaryCallSettings.Builder getTargetPoolSettings() { + return getTargetPoolSettings; + } + + /** Returns the builder for the settings used for calls to getHealthTargetPool. */ + public UnaryCallSettings.Builder + getHealthTargetPoolSettings() { + return getHealthTargetPoolSettings; + } + + /** Returns the builder for the settings used for calls to insertTargetPool. */ + public UnaryCallSettings.Builder + insertTargetPoolSettings() { + return insertTargetPoolSettings; + } + + /** Returns the builder for the settings used for calls to listTargetPools. */ + public PagedCallSettings.Builder< + ListTargetPoolsHttpRequest, TargetPoolList, ListTargetPoolsPagedResponse> + listTargetPoolsSettings() { + return listTargetPoolsSettings; + } + + /** Returns the builder for the settings used for calls to removeHealthCheckTargetPool. */ + public UnaryCallSettings.Builder + removeHealthCheckTargetPoolSettings() { + return removeHealthCheckTargetPoolSettings; + } + + /** Returns the builder for the settings used for calls to removeInstanceTargetPool. */ + public UnaryCallSettings.Builder + removeInstanceTargetPoolSettings() { + return removeInstanceTargetPoolSettings; + } + + /** Returns the builder for the settings used for calls to setBackupTargetPool. */ + public UnaryCallSettings.Builder + setBackupTargetPoolSettings() { + return setBackupTargetPoolSettings; + } + + @Override + public TargetPoolStubSettings build() throws IOException { + return new TargetPoolStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetSslProxyStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetSslProxyStub.java new file mode 100644 index 000000000000..4197e356e044 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetSslProxyStub.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetSslProxyClient.ListTargetSslProxiesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetSslProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetBackendServiceTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.SetProxyHeaderTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.SetSslCertificatesTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.SetSslPolicyTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.TargetSslProxy; +import com.google.cloud.compute.v1.TargetSslProxyList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class TargetSslProxyStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteTargetSslProxyCallable() { + throw new UnsupportedOperationException("Not implemented: deleteTargetSslProxyCallable()"); + } + + @BetaApi + public UnaryCallable getTargetSslProxyCallable() { + throw new UnsupportedOperationException("Not implemented: getTargetSslProxyCallable()"); + } + + @BetaApi + public UnaryCallable insertTargetSslProxyCallable() { + throw new UnsupportedOperationException("Not implemented: insertTargetSslProxyCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetSslProxiesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listTargetSslProxiesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetSslProxiesCallable() { + throw new UnsupportedOperationException("Not implemented: listTargetSslProxiesCallable()"); + } + + @BetaApi + public UnaryCallable + setBackendServiceTargetSslProxyCallable() { + throw new UnsupportedOperationException( + "Not implemented: setBackendServiceTargetSslProxyCallable()"); + } + + @BetaApi + public UnaryCallable + setProxyHeaderTargetSslProxyCallable() { + throw new UnsupportedOperationException( + "Not implemented: setProxyHeaderTargetSslProxyCallable()"); + } + + @BetaApi + public UnaryCallable + setSslCertificatesTargetSslProxyCallable() { + throw new UnsupportedOperationException( + "Not implemented: setSslCertificatesTargetSslProxyCallable()"); + } + + @BetaApi + public UnaryCallable + setSslPolicyTargetSslProxyCallable() { + throw new UnsupportedOperationException( + "Not implemented: setSslPolicyTargetSslProxyCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetSslProxyStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetSslProxyStubSettings.java new file mode 100644 index 000000000000..1b9d9d804bce --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetSslProxyStubSettings.java @@ -0,0 +1,566 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetSslProxyClient.ListTargetSslProxiesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetSslProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetBackendServiceTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.SetProxyHeaderTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.SetSslCertificatesTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.SetSslPolicyTargetSslProxyHttpRequest; +import com.google.cloud.compute.v1.TargetSslProxy; +import com.google.cloud.compute.v1.TargetSslProxyList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetSslProxyStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetSslProxy to 30 seconds: + * + *

+ * 
+ * TargetSslProxyStubSettings.Builder targetSslProxySettingsBuilder =
+ *     TargetSslProxyStubSettings.newBuilder();
+ * targetSslProxySettingsBuilder.deleteTargetSslProxySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetSslProxyStubSettings targetSslProxySettings = targetSslProxySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetSslProxyStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteTargetSslProxySettings; + private final UnaryCallSettings + getTargetSslProxySettings; + private final UnaryCallSettings + insertTargetSslProxySettings; + private final PagedCallSettings< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, ListTargetSslProxiesPagedResponse> + listTargetSslProxiesSettings; + private final UnaryCallSettings + setBackendServiceTargetSslProxySettings; + private final UnaryCallSettings + setProxyHeaderTargetSslProxySettings; + private final UnaryCallSettings + setSslCertificatesTargetSslProxySettings; + private final UnaryCallSettings + setSslPolicyTargetSslProxySettings; + + /** Returns the object with the settings used for calls to deleteTargetSslProxy. */ + public UnaryCallSettings + deleteTargetSslProxySettings() { + return deleteTargetSslProxySettings; + } + + /** Returns the object with the settings used for calls to getTargetSslProxy. */ + public UnaryCallSettings + getTargetSslProxySettings() { + return getTargetSslProxySettings; + } + + /** Returns the object with the settings used for calls to insertTargetSslProxy. */ + public UnaryCallSettings + insertTargetSslProxySettings() { + return insertTargetSslProxySettings; + } + + /** Returns the object with the settings used for calls to listTargetSslProxies. */ + public PagedCallSettings< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, ListTargetSslProxiesPagedResponse> + listTargetSslProxiesSettings() { + return listTargetSslProxiesSettings; + } + + /** Returns the object with the settings used for calls to setBackendServiceTargetSslProxy. */ + public UnaryCallSettings + setBackendServiceTargetSslProxySettings() { + return setBackendServiceTargetSslProxySettings; + } + + /** Returns the object with the settings used for calls to setProxyHeaderTargetSslProxy. */ + public UnaryCallSettings + setProxyHeaderTargetSslProxySettings() { + return setProxyHeaderTargetSslProxySettings; + } + + /** Returns the object with the settings used for calls to setSslCertificatesTargetSslProxy. */ + public UnaryCallSettings + setSslCertificatesTargetSslProxySettings() { + return setSslCertificatesTargetSslProxySettings; + } + + /** Returns the object with the settings used for calls to setSslPolicyTargetSslProxy. */ + public UnaryCallSettings + setSslPolicyTargetSslProxySettings() { + return setSslPolicyTargetSslProxySettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetSslProxyStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonTargetSslProxyStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(TargetSslProxyStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetSslProxyStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteTargetSslProxySettings = settingsBuilder.deleteTargetSslProxySettings().build(); + getTargetSslProxySettings = settingsBuilder.getTargetSslProxySettings().build(); + insertTargetSslProxySettings = settingsBuilder.insertTargetSslProxySettings().build(); + listTargetSslProxiesSettings = settingsBuilder.listTargetSslProxiesSettings().build(); + setBackendServiceTargetSslProxySettings = + settingsBuilder.setBackendServiceTargetSslProxySettings().build(); + setProxyHeaderTargetSslProxySettings = + settingsBuilder.setProxyHeaderTargetSslProxySettings().build(); + setSslCertificatesTargetSslProxySettings = + settingsBuilder.setSslCertificatesTargetSslProxySettings().build(); + setSslPolicyTargetSslProxySettings = + settingsBuilder.setSslPolicyTargetSslProxySettings().build(); + } + + private static final PagedListDescriptor< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, TargetSslProxy> + LIST_TARGET_SSL_PROXIES_PAGE_STR_DESC = + new PagedListDescriptor< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, TargetSslProxy>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTargetSslProxiesHttpRequest injectToken( + ListTargetSslProxiesHttpRequest payload, String token) { + return ListTargetSslProxiesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListTargetSslProxiesHttpRequest injectPageSize( + ListTargetSslProxiesHttpRequest payload, int pageSize) { + return ListTargetSslProxiesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListTargetSslProxiesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(TargetSslProxyList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(TargetSslProxyList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, ListTargetSslProxiesPagedResponse> + LIST_TARGET_SSL_PROXIES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, + ListTargetSslProxiesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTargetSslProxiesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_TARGET_SSL_PROXIES_PAGE_STR_DESC, request, context); + return ListTargetSslProxiesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for TargetSslProxyStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteTargetSslProxySettings; + private final UnaryCallSettings.Builder + getTargetSslProxySettings; + private final UnaryCallSettings.Builder + insertTargetSslProxySettings; + private final PagedCallSettings.Builder< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, ListTargetSslProxiesPagedResponse> + listTargetSslProxiesSettings; + private final UnaryCallSettings.Builder + setBackendServiceTargetSslProxySettings; + private final UnaryCallSettings.Builder + setProxyHeaderTargetSslProxySettings; + private final UnaryCallSettings.Builder + setSslCertificatesTargetSslProxySettings; + private final UnaryCallSettings.Builder + setSslPolicyTargetSslProxySettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteTargetSslProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getTargetSslProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertTargetSslProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listTargetSslProxiesSettings = + PagedCallSettings.newBuilder(LIST_TARGET_SSL_PROXIES_PAGE_STR_FACT); + + setBackendServiceTargetSslProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setProxyHeaderTargetSslProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setSslCertificatesTargetSslProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setSslPolicyTargetSslProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteTargetSslProxySettings, + getTargetSslProxySettings, + insertTargetSslProxySettings, + listTargetSslProxiesSettings, + setBackendServiceTargetSslProxySettings, + setProxyHeaderTargetSslProxySettings, + setSslCertificatesTargetSslProxySettings, + setSslPolicyTargetSslProxySettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteTargetSslProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getTargetSslProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertTargetSslProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listTargetSslProxiesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setBackendServiceTargetSslProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setProxyHeaderTargetSslProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setSslCertificatesTargetSslProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setSslPolicyTargetSslProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(TargetSslProxyStubSettings settings) { + super(settings); + + deleteTargetSslProxySettings = settings.deleteTargetSslProxySettings.toBuilder(); + getTargetSslProxySettings = settings.getTargetSslProxySettings.toBuilder(); + insertTargetSslProxySettings = settings.insertTargetSslProxySettings.toBuilder(); + listTargetSslProxiesSettings = settings.listTargetSslProxiesSettings.toBuilder(); + setBackendServiceTargetSslProxySettings = + settings.setBackendServiceTargetSslProxySettings.toBuilder(); + setProxyHeaderTargetSslProxySettings = + settings.setProxyHeaderTargetSslProxySettings.toBuilder(); + setSslCertificatesTargetSslProxySettings = + settings.setSslCertificatesTargetSslProxySettings.toBuilder(); + setSslPolicyTargetSslProxySettings = settings.setSslPolicyTargetSslProxySettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteTargetSslProxySettings, + getTargetSslProxySettings, + insertTargetSslProxySettings, + listTargetSslProxiesSettings, + setBackendServiceTargetSslProxySettings, + setProxyHeaderTargetSslProxySettings, + setSslCertificatesTargetSslProxySettings, + setSslPolicyTargetSslProxySettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteTargetSslProxy. */ + public UnaryCallSettings.Builder + deleteTargetSslProxySettings() { + return deleteTargetSslProxySettings; + } + + /** Returns the builder for the settings used for calls to getTargetSslProxy. */ + public UnaryCallSettings.Builder + getTargetSslProxySettings() { + return getTargetSslProxySettings; + } + + /** Returns the builder for the settings used for calls to insertTargetSslProxy. */ + public UnaryCallSettings.Builder + insertTargetSslProxySettings() { + return insertTargetSslProxySettings; + } + + /** Returns the builder for the settings used for calls to listTargetSslProxies. */ + public PagedCallSettings.Builder< + ListTargetSslProxiesHttpRequest, TargetSslProxyList, ListTargetSslProxiesPagedResponse> + listTargetSslProxiesSettings() { + return listTargetSslProxiesSettings; + } + + /** Returns the builder for the settings used for calls to setBackendServiceTargetSslProxy. */ + public UnaryCallSettings.Builder + setBackendServiceTargetSslProxySettings() { + return setBackendServiceTargetSslProxySettings; + } + + /** Returns the builder for the settings used for calls to setProxyHeaderTargetSslProxy. */ + public UnaryCallSettings.Builder + setProxyHeaderTargetSslProxySettings() { + return setProxyHeaderTargetSslProxySettings; + } + + /** Returns the builder for the settings used for calls to setSslCertificatesTargetSslProxy. */ + public UnaryCallSettings.Builder + setSslCertificatesTargetSslProxySettings() { + return setSslCertificatesTargetSslProxySettings; + } + + /** Returns the builder for the settings used for calls to setSslPolicyTargetSslProxy. */ + public UnaryCallSettings.Builder + setSslPolicyTargetSslProxySettings() { + return setSslPolicyTargetSslProxySettings; + } + + @Override + public TargetSslProxyStubSettings build() throws IOException { + return new TargetSslProxyStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetTcpProxyStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetTcpProxyStub.java new file mode 100644 index 000000000000..4c6a492564a1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetTcpProxyStub.java @@ -0,0 +1,87 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetTcpProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetBackendServiceTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.SetProxyHeaderTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.TargetTcpProxy; +import com.google.cloud.compute.v1.TargetTcpProxyList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class TargetTcpProxyStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteTargetTcpProxyCallable() { + throw new UnsupportedOperationException("Not implemented: deleteTargetTcpProxyCallable()"); + } + + @BetaApi + public UnaryCallable getTargetTcpProxyCallable() { + throw new UnsupportedOperationException("Not implemented: getTargetTcpProxyCallable()"); + } + + @BetaApi + public UnaryCallable insertTargetTcpProxyCallable() { + throw new UnsupportedOperationException("Not implemented: insertTargetTcpProxyCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetTcpProxiesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listTargetTcpProxiesPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetTcpProxiesCallable() { + throw new UnsupportedOperationException("Not implemented: listTargetTcpProxiesCallable()"); + } + + @BetaApi + public UnaryCallable + setBackendServiceTargetTcpProxyCallable() { + throw new UnsupportedOperationException( + "Not implemented: setBackendServiceTargetTcpProxyCallable()"); + } + + @BetaApi + public UnaryCallable + setProxyHeaderTargetTcpProxyCallable() { + throw new UnsupportedOperationException( + "Not implemented: setProxyHeaderTargetTcpProxyCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetTcpProxyStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetTcpProxyStubSettings.java new file mode 100644 index 000000000000..211cb213e68e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetTcpProxyStubSettings.java @@ -0,0 +1,507 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.GetTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.InsertTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.ListTargetTcpProxiesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.SetBackendServiceTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.SetProxyHeaderTargetTcpProxyHttpRequest; +import com.google.cloud.compute.v1.TargetTcpProxy; +import com.google.cloud.compute.v1.TargetTcpProxyList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetTcpProxyStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetTcpProxy to 30 seconds: + * + *

+ * 
+ * TargetTcpProxyStubSettings.Builder targetTcpProxySettingsBuilder =
+ *     TargetTcpProxyStubSettings.newBuilder();
+ * targetTcpProxySettingsBuilder.deleteTargetTcpProxySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetTcpProxyStubSettings targetTcpProxySettings = targetTcpProxySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetTcpProxyStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings + deleteTargetTcpProxySettings; + private final UnaryCallSettings + getTargetTcpProxySettings; + private final UnaryCallSettings + insertTargetTcpProxySettings; + private final PagedCallSettings< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, ListTargetTcpProxiesPagedResponse> + listTargetTcpProxiesSettings; + private final UnaryCallSettings + setBackendServiceTargetTcpProxySettings; + private final UnaryCallSettings + setProxyHeaderTargetTcpProxySettings; + + /** Returns the object with the settings used for calls to deleteTargetTcpProxy. */ + public UnaryCallSettings + deleteTargetTcpProxySettings() { + return deleteTargetTcpProxySettings; + } + + /** Returns the object with the settings used for calls to getTargetTcpProxy. */ + public UnaryCallSettings + getTargetTcpProxySettings() { + return getTargetTcpProxySettings; + } + + /** Returns the object with the settings used for calls to insertTargetTcpProxy. */ + public UnaryCallSettings + insertTargetTcpProxySettings() { + return insertTargetTcpProxySettings; + } + + /** Returns the object with the settings used for calls to listTargetTcpProxies. */ + public PagedCallSettings< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, ListTargetTcpProxiesPagedResponse> + listTargetTcpProxiesSettings() { + return listTargetTcpProxiesSettings; + } + + /** Returns the object with the settings used for calls to setBackendServiceTargetTcpProxy. */ + public UnaryCallSettings + setBackendServiceTargetTcpProxySettings() { + return setBackendServiceTargetTcpProxySettings; + } + + /** Returns the object with the settings used for calls to setProxyHeaderTargetTcpProxy. */ + public UnaryCallSettings + setProxyHeaderTargetTcpProxySettings() { + return setProxyHeaderTargetTcpProxySettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetTcpProxyStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonTargetTcpProxyStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(TargetTcpProxyStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetTcpProxyStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteTargetTcpProxySettings = settingsBuilder.deleteTargetTcpProxySettings().build(); + getTargetTcpProxySettings = settingsBuilder.getTargetTcpProxySettings().build(); + insertTargetTcpProxySettings = settingsBuilder.insertTargetTcpProxySettings().build(); + listTargetTcpProxiesSettings = settingsBuilder.listTargetTcpProxiesSettings().build(); + setBackendServiceTargetTcpProxySettings = + settingsBuilder.setBackendServiceTargetTcpProxySettings().build(); + setProxyHeaderTargetTcpProxySettings = + settingsBuilder.setProxyHeaderTargetTcpProxySettings().build(); + } + + private static final PagedListDescriptor< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, TargetTcpProxy> + LIST_TARGET_TCP_PROXIES_PAGE_STR_DESC = + new PagedListDescriptor< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, TargetTcpProxy>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTargetTcpProxiesHttpRequest injectToken( + ListTargetTcpProxiesHttpRequest payload, String token) { + return ListTargetTcpProxiesHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListTargetTcpProxiesHttpRequest injectPageSize( + ListTargetTcpProxiesHttpRequest payload, int pageSize) { + return ListTargetTcpProxiesHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListTargetTcpProxiesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(TargetTcpProxyList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(TargetTcpProxyList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, ListTargetTcpProxiesPagedResponse> + LIST_TARGET_TCP_PROXIES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, + ListTargetTcpProxiesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTargetTcpProxiesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_TARGET_TCP_PROXIES_PAGE_STR_DESC, request, context); + return ListTargetTcpProxiesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for TargetTcpProxyStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteTargetTcpProxySettings; + private final UnaryCallSettings.Builder + getTargetTcpProxySettings; + private final UnaryCallSettings.Builder + insertTargetTcpProxySettings; + private final PagedCallSettings.Builder< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, ListTargetTcpProxiesPagedResponse> + listTargetTcpProxiesSettings; + private final UnaryCallSettings.Builder + setBackendServiceTargetTcpProxySettings; + private final UnaryCallSettings.Builder + setProxyHeaderTargetTcpProxySettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteTargetTcpProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getTargetTcpProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertTargetTcpProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listTargetTcpProxiesSettings = + PagedCallSettings.newBuilder(LIST_TARGET_TCP_PROXIES_PAGE_STR_FACT); + + setBackendServiceTargetTcpProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setProxyHeaderTargetTcpProxySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteTargetTcpProxySettings, + getTargetTcpProxySettings, + insertTargetTcpProxySettings, + listTargetTcpProxiesSettings, + setBackendServiceTargetTcpProxySettings, + setProxyHeaderTargetTcpProxySettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteTargetTcpProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getTargetTcpProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertTargetTcpProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listTargetTcpProxiesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setBackendServiceTargetTcpProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setProxyHeaderTargetTcpProxySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(TargetTcpProxyStubSettings settings) { + super(settings); + + deleteTargetTcpProxySettings = settings.deleteTargetTcpProxySettings.toBuilder(); + getTargetTcpProxySettings = settings.getTargetTcpProxySettings.toBuilder(); + insertTargetTcpProxySettings = settings.insertTargetTcpProxySettings.toBuilder(); + listTargetTcpProxiesSettings = settings.listTargetTcpProxiesSettings.toBuilder(); + setBackendServiceTargetTcpProxySettings = + settings.setBackendServiceTargetTcpProxySettings.toBuilder(); + setProxyHeaderTargetTcpProxySettings = + settings.setProxyHeaderTargetTcpProxySettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteTargetTcpProxySettings, + getTargetTcpProxySettings, + insertTargetTcpProxySettings, + listTargetTcpProxiesSettings, + setBackendServiceTargetTcpProxySettings, + setProxyHeaderTargetTcpProxySettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteTargetTcpProxy. */ + public UnaryCallSettings.Builder + deleteTargetTcpProxySettings() { + return deleteTargetTcpProxySettings; + } + + /** Returns the builder for the settings used for calls to getTargetTcpProxy. */ + public UnaryCallSettings.Builder + getTargetTcpProxySettings() { + return getTargetTcpProxySettings; + } + + /** Returns the builder for the settings used for calls to insertTargetTcpProxy. */ + public UnaryCallSettings.Builder + insertTargetTcpProxySettings() { + return insertTargetTcpProxySettings; + } + + /** Returns the builder for the settings used for calls to listTargetTcpProxies. */ + public PagedCallSettings.Builder< + ListTargetTcpProxiesHttpRequest, TargetTcpProxyList, ListTargetTcpProxiesPagedResponse> + listTargetTcpProxiesSettings() { + return listTargetTcpProxiesSettings; + } + + /** Returns the builder for the settings used for calls to setBackendServiceTargetTcpProxy. */ + public UnaryCallSettings.Builder + setBackendServiceTargetTcpProxySettings() { + return setBackendServiceTargetTcpProxySettings; + } + + /** Returns the builder for the settings used for calls to setProxyHeaderTargetTcpProxy. */ + public UnaryCallSettings.Builder + setProxyHeaderTargetTcpProxySettings() { + return setProxyHeaderTargetTcpProxySettings; + } + + @Override + public TargetTcpProxyStubSettings build() throws IOException { + return new TargetTcpProxyStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetVpnGatewayStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetVpnGatewayStub.java new file mode 100644 index 000000000000..aa8b3f9d2150 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetVpnGatewayStub.java @@ -0,0 +1,93 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse; +import static com.google.cloud.compute.v1.TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListTargetVpnGatewaysHttpRequest; +import com.google.cloud.compute.v1.DeleteTargetVpnGatewayHttpRequest; +import com.google.cloud.compute.v1.GetTargetVpnGatewayHttpRequest; +import com.google.cloud.compute.v1.InsertTargetVpnGatewayHttpRequest; +import com.google.cloud.compute.v1.ListTargetVpnGatewaysHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.TargetVpnGateway; +import com.google.cloud.compute.v1.TargetVpnGatewayAggregatedList; +import com.google.cloud.compute.v1.TargetVpnGatewayList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class TargetVpnGatewayStub implements BackgroundResource { + + @BetaApi + public UnaryCallable< + AggregatedListTargetVpnGatewaysHttpRequest, AggregatedListTargetVpnGatewaysPagedResponse> + aggregatedListTargetVpnGatewaysPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListTargetVpnGatewaysPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListTargetVpnGatewaysCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListTargetVpnGatewaysCallable()"); + } + + @BetaApi + public UnaryCallable + deleteTargetVpnGatewayCallable() { + throw new UnsupportedOperationException("Not implemented: deleteTargetVpnGatewayCallable()"); + } + + @BetaApi + public UnaryCallable + getTargetVpnGatewayCallable() { + throw new UnsupportedOperationException("Not implemented: getTargetVpnGatewayCallable()"); + } + + @BetaApi + public UnaryCallable + insertTargetVpnGatewayCallable() { + throw new UnsupportedOperationException("Not implemented: insertTargetVpnGatewayCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetVpnGatewaysPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listTargetVpnGatewaysPagedCallable()"); + } + + @BetaApi + public UnaryCallable + listTargetVpnGatewaysCallable() { + throw new UnsupportedOperationException("Not implemented: listTargetVpnGatewaysCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetVpnGatewayStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetVpnGatewayStubSettings.java new file mode 100644 index 000000000000..c25b3c56abdf --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/TargetVpnGatewayStubSettings.java @@ -0,0 +1,568 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse; +import static com.google.cloud.compute.v1.TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListTargetVpnGatewaysHttpRequest; +import com.google.cloud.compute.v1.DeleteTargetVpnGatewayHttpRequest; +import com.google.cloud.compute.v1.GetTargetVpnGatewayHttpRequest; +import com.google.cloud.compute.v1.InsertTargetVpnGatewayHttpRequest; +import com.google.cloud.compute.v1.ListTargetVpnGatewaysHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.TargetVpnGateway; +import com.google.cloud.compute.v1.TargetVpnGatewayAggregatedList; +import com.google.cloud.compute.v1.TargetVpnGatewayList; +import com.google.cloud.compute.v1.TargetVpnGatewaysScopedList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TargetVpnGatewayStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteTargetVpnGateway to 30 seconds: + * + *

+ * 
+ * TargetVpnGatewayStubSettings.Builder targetVpnGatewaySettingsBuilder =
+ *     TargetVpnGatewayStubSettings.newBuilder();
+ * targetVpnGatewaySettingsBuilder.deleteTargetVpnGatewaySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TargetVpnGatewayStubSettings targetVpnGatewaySettings = targetVpnGatewaySettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TargetVpnGatewayStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + AggregatedListTargetVpnGatewaysPagedResponse> + aggregatedListTargetVpnGatewaysSettings; + private final UnaryCallSettings + deleteTargetVpnGatewaySettings; + private final UnaryCallSettings + getTargetVpnGatewaySettings; + private final UnaryCallSettings + insertTargetVpnGatewaySettings; + private final PagedCallSettings< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, + ListTargetVpnGatewaysPagedResponse> + listTargetVpnGatewaysSettings; + + /** Returns the object with the settings used for calls to aggregatedListTargetVpnGateways. */ + public PagedCallSettings< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + AggregatedListTargetVpnGatewaysPagedResponse> + aggregatedListTargetVpnGatewaysSettings() { + return aggregatedListTargetVpnGatewaysSettings; + } + + /** Returns the object with the settings used for calls to deleteTargetVpnGateway. */ + public UnaryCallSettings + deleteTargetVpnGatewaySettings() { + return deleteTargetVpnGatewaySettings; + } + + /** Returns the object with the settings used for calls to getTargetVpnGateway. */ + public UnaryCallSettings + getTargetVpnGatewaySettings() { + return getTargetVpnGatewaySettings; + } + + /** Returns the object with the settings used for calls to insertTargetVpnGateway. */ + public UnaryCallSettings + insertTargetVpnGatewaySettings() { + return insertTargetVpnGatewaySettings; + } + + /** Returns the object with the settings used for calls to listTargetVpnGateways. */ + public PagedCallSettings< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, + ListTargetVpnGatewaysPagedResponse> + listTargetVpnGatewaysSettings() { + return listTargetVpnGatewaysSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TargetVpnGatewayStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonTargetVpnGatewayStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(TargetVpnGatewayStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TargetVpnGatewayStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListTargetVpnGatewaysSettings = + settingsBuilder.aggregatedListTargetVpnGatewaysSettings().build(); + deleteTargetVpnGatewaySettings = settingsBuilder.deleteTargetVpnGatewaySettings().build(); + getTargetVpnGatewaySettings = settingsBuilder.getTargetVpnGatewaySettings().build(); + insertTargetVpnGatewaySettings = settingsBuilder.insertTargetVpnGatewaySettings().build(); + listTargetVpnGatewaysSettings = settingsBuilder.listTargetVpnGatewaysSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + TargetVpnGatewaysScopedList> + AGGREGATED_LIST_TARGET_VPN_GATEWAYS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + TargetVpnGatewaysScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListTargetVpnGatewaysHttpRequest injectToken( + AggregatedListTargetVpnGatewaysHttpRequest payload, String token) { + return AggregatedListTargetVpnGatewaysHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListTargetVpnGatewaysHttpRequest injectPageSize( + AggregatedListTargetVpnGatewaysHttpRequest payload, int pageSize) { + return AggregatedListTargetVpnGatewaysHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListTargetVpnGatewaysHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(TargetVpnGatewayAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + TargetVpnGatewayAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, TargetVpnGateway> + LIST_TARGET_VPN_GATEWAYS_PAGE_STR_DESC = + new PagedListDescriptor< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, TargetVpnGateway>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTargetVpnGatewaysHttpRequest injectToken( + ListTargetVpnGatewaysHttpRequest payload, String token) { + return ListTargetVpnGatewaysHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListTargetVpnGatewaysHttpRequest injectPageSize( + ListTargetVpnGatewaysHttpRequest payload, int pageSize) { + return ListTargetVpnGatewaysHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListTargetVpnGatewaysHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(TargetVpnGatewayList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(TargetVpnGatewayList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + AggregatedListTargetVpnGatewaysPagedResponse> + AGGREGATED_LIST_TARGET_VPN_GATEWAYS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + AggregatedListTargetVpnGatewaysPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList> + callable, + AggregatedListTargetVpnGatewaysHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + TargetVpnGatewaysScopedList> + pageContext = + PageContext.create( + callable, + AGGREGATED_LIST_TARGET_VPN_GATEWAYS_PAGE_STR_DESC, + request, + context); + return AggregatedListTargetVpnGatewaysPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, + ListTargetVpnGatewaysPagedResponse> + LIST_TARGET_VPN_GATEWAYS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, + ListTargetVpnGatewaysPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTargetVpnGatewaysHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_TARGET_VPN_GATEWAYS_PAGE_STR_DESC, request, context); + return ListTargetVpnGatewaysPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for TargetVpnGatewayStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + AggregatedListTargetVpnGatewaysPagedResponse> + aggregatedListTargetVpnGatewaysSettings; + private final UnaryCallSettings.Builder + deleteTargetVpnGatewaySettings; + private final UnaryCallSettings.Builder + getTargetVpnGatewaySettings; + private final UnaryCallSettings.Builder + insertTargetVpnGatewaySettings; + private final PagedCallSettings.Builder< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, + ListTargetVpnGatewaysPagedResponse> + listTargetVpnGatewaysSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListTargetVpnGatewaysSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_TARGET_VPN_GATEWAYS_PAGE_STR_FACT); + + deleteTargetVpnGatewaySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getTargetVpnGatewaySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertTargetVpnGatewaySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listTargetVpnGatewaysSettings = + PagedCallSettings.newBuilder(LIST_TARGET_VPN_GATEWAYS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListTargetVpnGatewaysSettings, + deleteTargetVpnGatewaySettings, + getTargetVpnGatewaySettings, + insertTargetVpnGatewaySettings, + listTargetVpnGatewaysSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListTargetVpnGatewaysSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteTargetVpnGatewaySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getTargetVpnGatewaySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertTargetVpnGatewaySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listTargetVpnGatewaysSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(TargetVpnGatewayStubSettings settings) { + super(settings); + + aggregatedListTargetVpnGatewaysSettings = + settings.aggregatedListTargetVpnGatewaysSettings.toBuilder(); + deleteTargetVpnGatewaySettings = settings.deleteTargetVpnGatewaySettings.toBuilder(); + getTargetVpnGatewaySettings = settings.getTargetVpnGatewaySettings.toBuilder(); + insertTargetVpnGatewaySettings = settings.insertTargetVpnGatewaySettings.toBuilder(); + listTargetVpnGatewaysSettings = settings.listTargetVpnGatewaysSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListTargetVpnGatewaysSettings, + deleteTargetVpnGatewaySettings, + getTargetVpnGatewaySettings, + insertTargetVpnGatewaySettings, + listTargetVpnGatewaysSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListTargetVpnGateways. */ + public PagedCallSettings.Builder< + AggregatedListTargetVpnGatewaysHttpRequest, TargetVpnGatewayAggregatedList, + AggregatedListTargetVpnGatewaysPagedResponse> + aggregatedListTargetVpnGatewaysSettings() { + return aggregatedListTargetVpnGatewaysSettings; + } + + /** Returns the builder for the settings used for calls to deleteTargetVpnGateway. */ + public UnaryCallSettings.Builder + deleteTargetVpnGatewaySettings() { + return deleteTargetVpnGatewaySettings; + } + + /** Returns the builder for the settings used for calls to getTargetVpnGateway. */ + public UnaryCallSettings.Builder + getTargetVpnGatewaySettings() { + return getTargetVpnGatewaySettings; + } + + /** Returns the builder for the settings used for calls to insertTargetVpnGateway. */ + public UnaryCallSettings.Builder + insertTargetVpnGatewaySettings() { + return insertTargetVpnGatewaySettings; + } + + /** Returns the builder for the settings used for calls to listTargetVpnGateways. */ + public PagedCallSettings.Builder< + ListTargetVpnGatewaysHttpRequest, TargetVpnGatewayList, + ListTargetVpnGatewaysPagedResponse> + listTargetVpnGatewaysSettings() { + return listTargetVpnGatewaysSettings; + } + + @Override + public TargetVpnGatewayStubSettings build() throws IOException { + return new TargetVpnGatewayStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/UrlMapStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/UrlMapStub.java new file mode 100644 index 000000000000..2e5980d94ee1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/UrlMapStub.java @@ -0,0 +1,97 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.UrlMapClient.ListUrlMapsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteUrlMapHttpRequest; +import com.google.cloud.compute.v1.GetUrlMapHttpRequest; +import com.google.cloud.compute.v1.InsertUrlMapHttpRequest; +import com.google.cloud.compute.v1.InvalidateCacheUrlMapHttpRequest; +import com.google.cloud.compute.v1.ListUrlMapsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchUrlMapHttpRequest; +import com.google.cloud.compute.v1.UpdateUrlMapHttpRequest; +import com.google.cloud.compute.v1.UrlMap; +import com.google.cloud.compute.v1.UrlMapList; +import com.google.cloud.compute.v1.UrlMapsValidateResponse; +import com.google.cloud.compute.v1.ValidateUrlMapHttpRequest; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class UrlMapStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteUrlMapCallable() { + throw new UnsupportedOperationException("Not implemented: deleteUrlMapCallable()"); + } + + @BetaApi + public UnaryCallable getUrlMapCallable() { + throw new UnsupportedOperationException("Not implemented: getUrlMapCallable()"); + } + + @BetaApi + public UnaryCallable insertUrlMapCallable() { + throw new UnsupportedOperationException("Not implemented: insertUrlMapCallable()"); + } + + @BetaApi + public UnaryCallable + invalidateCacheUrlMapCallable() { + throw new UnsupportedOperationException("Not implemented: invalidateCacheUrlMapCallable()"); + } + + @BetaApi + public UnaryCallable + listUrlMapsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listUrlMapsPagedCallable()"); + } + + @BetaApi + public UnaryCallable listUrlMapsCallable() { + throw new UnsupportedOperationException("Not implemented: listUrlMapsCallable()"); + } + + @BetaApi + public UnaryCallable patchUrlMapCallable() { + throw new UnsupportedOperationException("Not implemented: patchUrlMapCallable()"); + } + + @BetaApi + public UnaryCallable updateUrlMapCallable() { + throw new UnsupportedOperationException("Not implemented: updateUrlMapCallable()"); + } + + @BetaApi + public UnaryCallable + validateUrlMapCallable() { + throw new UnsupportedOperationException("Not implemented: validateUrlMapCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/UrlMapStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/UrlMapStubSettings.java new file mode 100644 index 000000000000..9be5fe064fb2 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/UrlMapStubSettings.java @@ -0,0 +1,529 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.UrlMapClient.ListUrlMapsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteUrlMapHttpRequest; +import com.google.cloud.compute.v1.GetUrlMapHttpRequest; +import com.google.cloud.compute.v1.InsertUrlMapHttpRequest; +import com.google.cloud.compute.v1.InvalidateCacheUrlMapHttpRequest; +import com.google.cloud.compute.v1.ListUrlMapsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.PatchUrlMapHttpRequest; +import com.google.cloud.compute.v1.UpdateUrlMapHttpRequest; +import com.google.cloud.compute.v1.UrlMap; +import com.google.cloud.compute.v1.UrlMapList; +import com.google.cloud.compute.v1.UrlMapsValidateResponse; +import com.google.cloud.compute.v1.ValidateUrlMapHttpRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link UrlMapStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteUrlMap to 30 seconds: + * + *

+ * 
+ * UrlMapStubSettings.Builder urlMapSettingsBuilder =
+ *     UrlMapStubSettings.newBuilder();
+ * urlMapSettingsBuilder.deleteUrlMapSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * UrlMapStubSettings urlMapSettings = urlMapSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class UrlMapStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings deleteUrlMapSettings; + private final UnaryCallSettings getUrlMapSettings; + private final UnaryCallSettings insertUrlMapSettings; + private final UnaryCallSettings + invalidateCacheUrlMapSettings; + private final PagedCallSettings + listUrlMapsSettings; + private final UnaryCallSettings patchUrlMapSettings; + private final UnaryCallSettings updateUrlMapSettings; + private final UnaryCallSettings + validateUrlMapSettings; + + /** Returns the object with the settings used for calls to deleteUrlMap. */ + public UnaryCallSettings deleteUrlMapSettings() { + return deleteUrlMapSettings; + } + + /** Returns the object with the settings used for calls to getUrlMap. */ + public UnaryCallSettings getUrlMapSettings() { + return getUrlMapSettings; + } + + /** Returns the object with the settings used for calls to insertUrlMap. */ + public UnaryCallSettings insertUrlMapSettings() { + return insertUrlMapSettings; + } + + /** Returns the object with the settings used for calls to invalidateCacheUrlMap. */ + public UnaryCallSettings + invalidateCacheUrlMapSettings() { + return invalidateCacheUrlMapSettings; + } + + /** Returns the object with the settings used for calls to listUrlMaps. */ + public PagedCallSettings + listUrlMapsSettings() { + return listUrlMapsSettings; + } + + /** Returns the object with the settings used for calls to patchUrlMap. */ + public UnaryCallSettings patchUrlMapSettings() { + return patchUrlMapSettings; + } + + /** Returns the object with the settings used for calls to updateUrlMap. */ + public UnaryCallSettings updateUrlMapSettings() { + return updateUrlMapSettings; + } + + /** Returns the object with the settings used for calls to validateUrlMap. */ + public UnaryCallSettings + validateUrlMapSettings() { + return validateUrlMapSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public UrlMapStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonUrlMapStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(UrlMapStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected UrlMapStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteUrlMapSettings = settingsBuilder.deleteUrlMapSettings().build(); + getUrlMapSettings = settingsBuilder.getUrlMapSettings().build(); + insertUrlMapSettings = settingsBuilder.insertUrlMapSettings().build(); + invalidateCacheUrlMapSettings = settingsBuilder.invalidateCacheUrlMapSettings().build(); + listUrlMapsSettings = settingsBuilder.listUrlMapsSettings().build(); + patchUrlMapSettings = settingsBuilder.patchUrlMapSettings().build(); + updateUrlMapSettings = settingsBuilder.updateUrlMapSettings().build(); + validateUrlMapSettings = settingsBuilder.validateUrlMapSettings().build(); + } + + private static final PagedListDescriptor + LIST_URL_MAPS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListUrlMapsHttpRequest injectToken( + ListUrlMapsHttpRequest payload, String token) { + return ListUrlMapsHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListUrlMapsHttpRequest injectPageSize( + ListUrlMapsHttpRequest payload, int pageSize) { + return ListUrlMapsHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListUrlMapsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(UrlMapList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(UrlMapList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListUrlMapsHttpRequest, UrlMapList, ListUrlMapsPagedResponse> + LIST_URL_MAPS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListUrlMapsHttpRequest, UrlMapList, ListUrlMapsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListUrlMapsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_URL_MAPS_PAGE_STR_DESC, request, context); + return ListUrlMapsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for UrlMapStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteUrlMapSettings; + private final UnaryCallSettings.Builder getUrlMapSettings; + private final UnaryCallSettings.Builder + insertUrlMapSettings; + private final UnaryCallSettings.Builder + invalidateCacheUrlMapSettings; + private final PagedCallSettings.Builder< + ListUrlMapsHttpRequest, UrlMapList, ListUrlMapsPagedResponse> + listUrlMapsSettings; + private final UnaryCallSettings.Builder patchUrlMapSettings; + private final UnaryCallSettings.Builder + updateUrlMapSettings; + private final UnaryCallSettings.Builder + validateUrlMapSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteUrlMapSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getUrlMapSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertUrlMapSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + invalidateCacheUrlMapSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listUrlMapsSettings = PagedCallSettings.newBuilder(LIST_URL_MAPS_PAGE_STR_FACT); + + patchUrlMapSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateUrlMapSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + validateUrlMapSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteUrlMapSettings, + getUrlMapSettings, + insertUrlMapSettings, + invalidateCacheUrlMapSettings, + listUrlMapsSettings, + patchUrlMapSettings, + updateUrlMapSettings, + validateUrlMapSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteUrlMapSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getUrlMapSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertUrlMapSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .invalidateCacheUrlMapSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listUrlMapsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .patchUrlMapSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateUrlMapSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .validateUrlMapSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(UrlMapStubSettings settings) { + super(settings); + + deleteUrlMapSettings = settings.deleteUrlMapSettings.toBuilder(); + getUrlMapSettings = settings.getUrlMapSettings.toBuilder(); + insertUrlMapSettings = settings.insertUrlMapSettings.toBuilder(); + invalidateCacheUrlMapSettings = settings.invalidateCacheUrlMapSettings.toBuilder(); + listUrlMapsSettings = settings.listUrlMapsSettings.toBuilder(); + patchUrlMapSettings = settings.patchUrlMapSettings.toBuilder(); + updateUrlMapSettings = settings.updateUrlMapSettings.toBuilder(); + validateUrlMapSettings = settings.validateUrlMapSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteUrlMapSettings, + getUrlMapSettings, + insertUrlMapSettings, + invalidateCacheUrlMapSettings, + listUrlMapsSettings, + patchUrlMapSettings, + updateUrlMapSettings, + validateUrlMapSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteUrlMap. */ + public UnaryCallSettings.Builder deleteUrlMapSettings() { + return deleteUrlMapSettings; + } + + /** Returns the builder for the settings used for calls to getUrlMap. */ + public UnaryCallSettings.Builder getUrlMapSettings() { + return getUrlMapSettings; + } + + /** Returns the builder for the settings used for calls to insertUrlMap. */ + public UnaryCallSettings.Builder insertUrlMapSettings() { + return insertUrlMapSettings; + } + + /** Returns the builder for the settings used for calls to invalidateCacheUrlMap. */ + public UnaryCallSettings.Builder + invalidateCacheUrlMapSettings() { + return invalidateCacheUrlMapSettings; + } + + /** Returns the builder for the settings used for calls to listUrlMaps. */ + public PagedCallSettings.Builder + listUrlMapsSettings() { + return listUrlMapsSettings; + } + + /** Returns the builder for the settings used for calls to patchUrlMap. */ + public UnaryCallSettings.Builder patchUrlMapSettings() { + return patchUrlMapSettings; + } + + /** Returns the builder for the settings used for calls to updateUrlMap. */ + public UnaryCallSettings.Builder updateUrlMapSettings() { + return updateUrlMapSettings; + } + + /** Returns the builder for the settings used for calls to validateUrlMap. */ + public UnaryCallSettings.Builder + validateUrlMapSettings() { + return validateUrlMapSettings; + } + + @Override + public UrlMapStubSettings build() throws IOException { + return new UrlMapStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/VpnTunnelStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/VpnTunnelStub.java new file mode 100644 index 000000000000..0d606eb8e489 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/VpnTunnelStub.java @@ -0,0 +1,86 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.VpnTunnelClient.AggregatedListVpnTunnelsPagedResponse; +import static com.google.cloud.compute.v1.VpnTunnelClient.ListVpnTunnelsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListVpnTunnelsHttpRequest; +import com.google.cloud.compute.v1.DeleteVpnTunnelHttpRequest; +import com.google.cloud.compute.v1.GetVpnTunnelHttpRequest; +import com.google.cloud.compute.v1.InsertVpnTunnelHttpRequest; +import com.google.cloud.compute.v1.ListVpnTunnelsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.VpnTunnel; +import com.google.cloud.compute.v1.VpnTunnelAggregatedList; +import com.google.cloud.compute.v1.VpnTunnelList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class VpnTunnelStub implements BackgroundResource { + + @BetaApi + public UnaryCallable + aggregatedListVpnTunnelsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: aggregatedListVpnTunnelsPagedCallable()"); + } + + @BetaApi + public UnaryCallable + aggregatedListVpnTunnelsCallable() { + throw new UnsupportedOperationException("Not implemented: aggregatedListVpnTunnelsCallable()"); + } + + @BetaApi + public UnaryCallable deleteVpnTunnelCallable() { + throw new UnsupportedOperationException("Not implemented: deleteVpnTunnelCallable()"); + } + + @BetaApi + public UnaryCallable getVpnTunnelCallable() { + throw new UnsupportedOperationException("Not implemented: getVpnTunnelCallable()"); + } + + @BetaApi + public UnaryCallable insertVpnTunnelCallable() { + throw new UnsupportedOperationException("Not implemented: insertVpnTunnelCallable()"); + } + + @BetaApi + public UnaryCallable + listVpnTunnelsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listVpnTunnelsPagedCallable()"); + } + + @BetaApi + public UnaryCallable listVpnTunnelsCallable() { + throw new UnsupportedOperationException("Not implemented: listVpnTunnelsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/VpnTunnelStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/VpnTunnelStubSettings.java new file mode 100644 index 000000000000..e62fa9c01226 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/VpnTunnelStubSettings.java @@ -0,0 +1,536 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.VpnTunnelClient.AggregatedListVpnTunnelsPagedResponse; +import static com.google.cloud.compute.v1.VpnTunnelClient.ListVpnTunnelsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.AggregatedListVpnTunnelsHttpRequest; +import com.google.cloud.compute.v1.DeleteVpnTunnelHttpRequest; +import com.google.cloud.compute.v1.GetVpnTunnelHttpRequest; +import com.google.cloud.compute.v1.InsertVpnTunnelHttpRequest; +import com.google.cloud.compute.v1.ListVpnTunnelsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.VpnTunnel; +import com.google.cloud.compute.v1.VpnTunnelAggregatedList; +import com.google.cloud.compute.v1.VpnTunnelList; +import com.google.cloud.compute.v1.VpnTunnelsScopedList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link VpnTunnelStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteVpnTunnel to 30 seconds: + * + *

+ * 
+ * VpnTunnelStubSettings.Builder vpnTunnelSettingsBuilder =
+ *     VpnTunnelStubSettings.newBuilder();
+ * vpnTunnelSettingsBuilder.deleteVpnTunnelSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * VpnTunnelStubSettings vpnTunnelSettings = vpnTunnelSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class VpnTunnelStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final PagedCallSettings< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, + AggregatedListVpnTunnelsPagedResponse> + aggregatedListVpnTunnelsSettings; + private final UnaryCallSettings deleteVpnTunnelSettings; + private final UnaryCallSettings getVpnTunnelSettings; + private final UnaryCallSettings insertVpnTunnelSettings; + private final PagedCallSettings< + ListVpnTunnelsHttpRequest, VpnTunnelList, ListVpnTunnelsPagedResponse> + listVpnTunnelsSettings; + + /** Returns the object with the settings used for calls to aggregatedListVpnTunnels. */ + public PagedCallSettings< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, + AggregatedListVpnTunnelsPagedResponse> + aggregatedListVpnTunnelsSettings() { + return aggregatedListVpnTunnelsSettings; + } + + /** Returns the object with the settings used for calls to deleteVpnTunnel. */ + public UnaryCallSettings deleteVpnTunnelSettings() { + return deleteVpnTunnelSettings; + } + + /** Returns the object with the settings used for calls to getVpnTunnel. */ + public UnaryCallSettings getVpnTunnelSettings() { + return getVpnTunnelSettings; + } + + /** Returns the object with the settings used for calls to insertVpnTunnel. */ + public UnaryCallSettings insertVpnTunnelSettings() { + return insertVpnTunnelSettings; + } + + /** Returns the object with the settings used for calls to listVpnTunnels. */ + public PagedCallSettings + listVpnTunnelsSettings() { + return listVpnTunnelsSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public VpnTunnelStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonVpnTunnelStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(VpnTunnelStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected VpnTunnelStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + aggregatedListVpnTunnelsSettings = settingsBuilder.aggregatedListVpnTunnelsSettings().build(); + deleteVpnTunnelSettings = settingsBuilder.deleteVpnTunnelSettings().build(); + getVpnTunnelSettings = settingsBuilder.getVpnTunnelSettings().build(); + insertVpnTunnelSettings = settingsBuilder.insertVpnTunnelSettings().build(); + listVpnTunnelsSettings = settingsBuilder.listVpnTunnelsSettings().build(); + } + + private static final PagedListDescriptor< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, VpnTunnelsScopedList> + AGGREGATED_LIST_VPN_TUNNELS_PAGE_STR_DESC = + new PagedListDescriptor< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, + VpnTunnelsScopedList>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public AggregatedListVpnTunnelsHttpRequest injectToken( + AggregatedListVpnTunnelsHttpRequest payload, String token) { + return AggregatedListVpnTunnelsHttpRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public AggregatedListVpnTunnelsHttpRequest injectPageSize( + AggregatedListVpnTunnelsHttpRequest payload, int pageSize) { + return AggregatedListVpnTunnelsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(AggregatedListVpnTunnelsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(VpnTunnelAggregatedList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + VpnTunnelAggregatedList payload) { + return payload.getItemsMap().values(); + } + }; + + private static final PagedListDescriptor + LIST_VPN_TUNNELS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListVpnTunnelsHttpRequest injectToken( + ListVpnTunnelsHttpRequest payload, String token) { + return ListVpnTunnelsHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListVpnTunnelsHttpRequest injectPageSize( + ListVpnTunnelsHttpRequest payload, int pageSize) { + return ListVpnTunnelsHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListVpnTunnelsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(VpnTunnelList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(VpnTunnelList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, + AggregatedListVpnTunnelsPagedResponse> + AGGREGATED_LIST_VPN_TUNNELS_PAGE_STR_FACT = + new PagedListResponseFactory< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, + AggregatedListVpnTunnelsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + AggregatedListVpnTunnelsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, + VpnTunnelsScopedList> + pageContext = + PageContext.create( + callable, AGGREGATED_LIST_VPN_TUNNELS_PAGE_STR_DESC, request, context); + return AggregatedListVpnTunnelsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListVpnTunnelsHttpRequest, VpnTunnelList, ListVpnTunnelsPagedResponse> + LIST_VPN_TUNNELS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListVpnTunnelsHttpRequest, VpnTunnelList, ListVpnTunnelsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListVpnTunnelsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_VPN_TUNNELS_PAGE_STR_DESC, request, context); + return ListVpnTunnelsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for VpnTunnelStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, + AggregatedListVpnTunnelsPagedResponse> + aggregatedListVpnTunnelsSettings; + private final UnaryCallSettings.Builder + deleteVpnTunnelSettings; + private final UnaryCallSettings.Builder + getVpnTunnelSettings; + private final UnaryCallSettings.Builder + insertVpnTunnelSettings; + private final PagedCallSettings.Builder< + ListVpnTunnelsHttpRequest, VpnTunnelList, ListVpnTunnelsPagedResponse> + listVpnTunnelsSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + aggregatedListVpnTunnelsSettings = + PagedCallSettings.newBuilder(AGGREGATED_LIST_VPN_TUNNELS_PAGE_STR_FACT); + + deleteVpnTunnelSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getVpnTunnelSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + insertVpnTunnelSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listVpnTunnelsSettings = PagedCallSettings.newBuilder(LIST_VPN_TUNNELS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListVpnTunnelsSettings, + deleteVpnTunnelSettings, + getVpnTunnelSettings, + insertVpnTunnelSettings, + listVpnTunnelsSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .aggregatedListVpnTunnelsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteVpnTunnelSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getVpnTunnelSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .insertVpnTunnelSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listVpnTunnelsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(VpnTunnelStubSettings settings) { + super(settings); + + aggregatedListVpnTunnelsSettings = settings.aggregatedListVpnTunnelsSettings.toBuilder(); + deleteVpnTunnelSettings = settings.deleteVpnTunnelSettings.toBuilder(); + getVpnTunnelSettings = settings.getVpnTunnelSettings.toBuilder(); + insertVpnTunnelSettings = settings.insertVpnTunnelSettings.toBuilder(); + listVpnTunnelsSettings = settings.listVpnTunnelsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + aggregatedListVpnTunnelsSettings, + deleteVpnTunnelSettings, + getVpnTunnelSettings, + insertVpnTunnelSettings, + listVpnTunnelsSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to aggregatedListVpnTunnels. */ + public PagedCallSettings.Builder< + AggregatedListVpnTunnelsHttpRequest, VpnTunnelAggregatedList, + AggregatedListVpnTunnelsPagedResponse> + aggregatedListVpnTunnelsSettings() { + return aggregatedListVpnTunnelsSettings; + } + + /** Returns the builder for the settings used for calls to deleteVpnTunnel. */ + public UnaryCallSettings.Builder + deleteVpnTunnelSettings() { + return deleteVpnTunnelSettings; + } + + /** Returns the builder for the settings used for calls to getVpnTunnel. */ + public UnaryCallSettings.Builder getVpnTunnelSettings() { + return getVpnTunnelSettings; + } + + /** Returns the builder for the settings used for calls to insertVpnTunnel. */ + public UnaryCallSettings.Builder + insertVpnTunnelSettings() { + return insertVpnTunnelSettings; + } + + /** Returns the builder for the settings used for calls to listVpnTunnels. */ + public PagedCallSettings.Builder< + ListVpnTunnelsHttpRequest, VpnTunnelList, ListVpnTunnelsPagedResponse> + listVpnTunnelsSettings() { + return listVpnTunnelsSettings; + } + + @Override + public VpnTunnelStubSettings build() throws IOException { + return new VpnTunnelStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneOperationStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneOperationStub.java new file mode 100644 index 000000000000..b7c536fee7c6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneOperationStub.java @@ -0,0 +1,63 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ZoneOperationClient.ListZoneOperationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteZoneOperationHttpRequest; +import com.google.cloud.compute.v1.GetZoneOperationHttpRequest; +import com.google.cloud.compute.v1.ListZoneOperationsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.OperationList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class ZoneOperationStub implements BackgroundResource { + + @BetaApi + public UnaryCallable deleteZoneOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteZoneOperationCallable()"); + } + + @BetaApi + public UnaryCallable getZoneOperationCallable() { + throw new UnsupportedOperationException("Not implemented: getZoneOperationCallable()"); + } + + @BetaApi + public UnaryCallable + listZoneOperationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listZoneOperationsPagedCallable()"); + } + + @BetaApi + public UnaryCallable listZoneOperationsCallable() { + throw new UnsupportedOperationException("Not implemented: listZoneOperationsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneOperationStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneOperationStubSettings.java new file mode 100644 index 000000000000..dc9421bdf3c9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneOperationStubSettings.java @@ -0,0 +1,403 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ZoneOperationClient.ListZoneOperationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.DeleteZoneOperationHttpRequest; +import com.google.cloud.compute.v1.GetZoneOperationHttpRequest; +import com.google.cloud.compute.v1.ListZoneOperationsHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.OperationList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link ZoneOperationStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of deleteZoneOperation to 30 seconds: + * + *

+ * 
+ * ZoneOperationStubSettings.Builder zoneOperationSettingsBuilder =
+ *     ZoneOperationStubSettings.newBuilder();
+ * zoneOperationSettingsBuilder.deleteZoneOperationSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * ZoneOperationStubSettings zoneOperationSettings = zoneOperationSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ZoneOperationStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings deleteZoneOperationSettings; + private final UnaryCallSettings getZoneOperationSettings; + private final PagedCallSettings< + ListZoneOperationsHttpRequest, OperationList, ListZoneOperationsPagedResponse> + listZoneOperationsSettings; + + /** Returns the object with the settings used for calls to deleteZoneOperation. */ + public UnaryCallSettings deleteZoneOperationSettings() { + return deleteZoneOperationSettings; + } + + /** Returns the object with the settings used for calls to getZoneOperation. */ + public UnaryCallSettings getZoneOperationSettings() { + return getZoneOperationSettings; + } + + /** Returns the object with the settings used for calls to listZoneOperations. */ + public PagedCallSettings< + ListZoneOperationsHttpRequest, OperationList, ListZoneOperationsPagedResponse> + listZoneOperationsSettings() { + return listZoneOperationsSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ZoneOperationStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonZoneOperationStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ZoneOperationStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ZoneOperationStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + deleteZoneOperationSettings = settingsBuilder.deleteZoneOperationSettings().build(); + getZoneOperationSettings = settingsBuilder.getZoneOperationSettings().build(); + listZoneOperationsSettings = settingsBuilder.listZoneOperationsSettings().build(); + } + + private static final PagedListDescriptor + LIST_ZONE_OPERATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListZoneOperationsHttpRequest injectToken( + ListZoneOperationsHttpRequest payload, String token) { + return ListZoneOperationsHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListZoneOperationsHttpRequest injectPageSize( + ListZoneOperationsHttpRequest payload, int pageSize) { + return ListZoneOperationsHttpRequest.newBuilder(payload) + .setMaxResults(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListZoneOperationsHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(OperationList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(OperationList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListZoneOperationsHttpRequest, OperationList, ListZoneOperationsPagedResponse> + LIST_ZONE_OPERATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListZoneOperationsHttpRequest, OperationList, ListZoneOperationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListZoneOperationsHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create( + callable, LIST_ZONE_OPERATIONS_PAGE_STR_DESC, request, context); + return ListZoneOperationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for ZoneOperationStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + deleteZoneOperationSettings; + private final UnaryCallSettings.Builder + getZoneOperationSettings; + private final PagedCallSettings.Builder< + ListZoneOperationsHttpRequest, OperationList, ListZoneOperationsPagedResponse> + listZoneOperationsSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + deleteZoneOperationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getZoneOperationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listZoneOperationsSettings = PagedCallSettings.newBuilder(LIST_ZONE_OPERATIONS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteZoneOperationSettings, getZoneOperationSettings, listZoneOperationsSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .deleteZoneOperationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getZoneOperationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listZoneOperationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(ZoneOperationStubSettings settings) { + super(settings); + + deleteZoneOperationSettings = settings.deleteZoneOperationSettings.toBuilder(); + getZoneOperationSettings = settings.getZoneOperationSettings.toBuilder(); + listZoneOperationsSettings = settings.listZoneOperationsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + deleteZoneOperationSettings, getZoneOperationSettings, listZoneOperationsSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to deleteZoneOperation. */ + public UnaryCallSettings.Builder + deleteZoneOperationSettings() { + return deleteZoneOperationSettings; + } + + /** Returns the builder for the settings used for calls to getZoneOperation. */ + public UnaryCallSettings.Builder + getZoneOperationSettings() { + return getZoneOperationSettings; + } + + /** Returns the builder for the settings used for calls to listZoneOperations. */ + public PagedCallSettings.Builder< + ListZoneOperationsHttpRequest, OperationList, ListZoneOperationsPagedResponse> + listZoneOperationsSettings() { + return listZoneOperationsSettings; + } + + @Override + public ZoneOperationStubSettings build() throws IOException { + return new ZoneOperationStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneStub.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneStub.java new file mode 100644 index 000000000000..75f8b4c3032d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneStub.java @@ -0,0 +1,56 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ZoneClient.ListZonesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.GetZoneHttpRequest; +import com.google.cloud.compute.v1.ListZonesHttpRequest; +import com.google.cloud.compute.v1.Zone; +import com.google.cloud.compute.v1.ZoneList; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for compute. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class ZoneStub implements BackgroundResource { + + @BetaApi + public UnaryCallable getZoneCallable() { + throw new UnsupportedOperationException("Not implemented: getZoneCallable()"); + } + + @BetaApi + public UnaryCallable listZonesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listZonesPagedCallable()"); + } + + @BetaApi + public UnaryCallable listZonesCallable() { + throw new UnsupportedOperationException("Not implemented: listZonesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneStubSettings.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneStubSettings.java new file mode 100644 index 000000000000..cf5ac03aa4e0 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/ZoneStubSettings.java @@ -0,0 +1,364 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1.stub; + +import static com.google.cloud.compute.v1.ZoneClient.ListZonesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.GetZoneHttpRequest; +import com.google.cloud.compute.v1.ListZonesHttpRequest; +import com.google.cloud.compute.v1.Zone; +import com.google.cloud.compute.v1.ZoneList; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link ZoneStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default + * port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getZone to 30 seconds: + * + *

+ * 
+ * ZoneStubSettings.Builder zoneSettingsBuilder =
+ *     ZoneStubSettings.newBuilder();
+ * zoneSettingsBuilder.getZoneSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * ZoneStubSettings zoneSettings = zoneSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class ZoneStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/compute") + .add("https://www.googleapis.com/auth/compute.readonly") + .add("https://www.googleapis.com/auth/devstorage.full_control") + .add("https://www.googleapis.com/auth/devstorage.read_only") + .add("https://www.googleapis.com/auth/devstorage.read_write") + .build(); + + private final UnaryCallSettings getZoneSettings; + private final PagedCallSettings + listZonesSettings; + + /** Returns the object with the settings used for calls to getZone. */ + public UnaryCallSettings getZoneSettings() { + return getZoneSettings; + } + + /** Returns the object with the settings used for calls to listZones. */ + public PagedCallSettings + listZonesSettings() { + return listZonesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ZoneStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonZoneStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "https://www.googleapis.com/compute/v1/projects/"; + } + + /** Returns the default service port. */ + public static int getDefaultServicePort() { + return 443; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultHttpJsonTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(ZoneStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ZoneStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getZoneSettings = settingsBuilder.getZoneSettings().build(); + listZonesSettings = settingsBuilder.listZonesSettings().build(); + } + + private static final PagedListDescriptor + LIST_ZONES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListZonesHttpRequest injectToken(ListZonesHttpRequest payload, String token) { + return ListZonesHttpRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListZonesHttpRequest injectPageSize(ListZonesHttpRequest payload, int pageSize) { + return ListZonesHttpRequest.newBuilder(payload).setMaxResults(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListZonesHttpRequest payload) { + return payload.getMaxResults(); + } + + @Override + public String extractNextToken(ZoneList payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ZoneList payload) { + return payload.getItemsList(); + } + }; + + private static final PagedListResponseFactory< + ListZonesHttpRequest, ZoneList, ListZonesPagedResponse> + LIST_ZONES_PAGE_STR_FACT = + new PagedListResponseFactory() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListZonesHttpRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_ZONES_PAGE_STR_DESC, request, context); + return ListZonesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for ZoneStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder getZoneSettings; + private final PagedCallSettings.Builder + listZonesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getZoneSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listZonesSettings = PagedCallSettings.newBuilder(LIST_ZONES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of(getZoneSettings, listZonesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .getZoneSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listZonesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(ZoneStubSettings settings) { + super(settings); + + getZoneSettings = settings.getZoneSettings.toBuilder(); + listZonesSettings = settings.listZonesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(getZoneSettings, listZonesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to getZone. */ + public UnaryCallSettings.Builder getZoneSettings() { + return getZoneSettings; + } + + /** Returns the builder for the settings used for calls to listZones. */ + public PagedCallSettings.Builder + listZonesSettings() { + return listZonesSettings; + } + + @Override + public ZoneStubSettings build() throws IOException { + return new ZoneStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AcceleratorTypeClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AcceleratorTypeClientTest.java new file mode 100644 index 000000000000..9dd592c3f42b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AcceleratorTypeClientTest.java @@ -0,0 +1,272 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.AcceleratorTypeClient.AggregatedListAcceleratorTypesPagedResponse; +import static com.google.cloud.compute.v1.AcceleratorTypeClient.ListAcceleratorTypesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonAcceleratorTypeStub.aggregatedListAcceleratorTypesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAcceleratorTypeStub.getAcceleratorTypeMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAcceleratorTypeStub.listAcceleratorTypesMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.AcceleratorTypeStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class AcceleratorTypeClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListAcceleratorTypesMethodDescriptor, + getAcceleratorTypeMethodDescriptor, + listAcceleratorTypesMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, AcceleratorTypeStubSettings.getDefaultEndpoint()); + + private static AcceleratorTypeClient client; + private static AcceleratorTypeSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + AcceleratorTypeSettings.newBuilder() + .setTransportChannelProvider( + AcceleratorTypeSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = AcceleratorTypeClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListAcceleratorTypesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + AcceleratorTypesScopedList itemsItem = AcceleratorTypesScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + AcceleratorTypeAggregatedList expectedResponse = + AcceleratorTypeAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListAcceleratorTypesPagedResponse pagedListResponse = + client.aggregatedListAcceleratorTypes(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListAcceleratorTypesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListAcceleratorTypes(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getAcceleratorTypeTest() { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + Integer maximumCardsPerInstance = 1883669166; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + AcceleratorType expectedResponse = + AcceleratorType.newBuilder() + .setZone(zone.toString()) + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setMaximumCardsPerInstance(maximumCardsPerInstance) + .setId(id) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneAcceleratorTypeName acceleratorType = + ProjectZoneAcceleratorTypeName.of("[PROJECT]", "[ZONE]", "[ACCELERATOR_TYPE]"); + + AcceleratorType actualResponse = client.getAcceleratorType(acceleratorType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getAcceleratorTypeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneAcceleratorTypeName acceleratorType = + ProjectZoneAcceleratorTypeName.of("[PROJECT]", "[ZONE]", "[ACCELERATOR_TYPE]"); + + client.getAcceleratorType(acceleratorType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listAcceleratorTypesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + AcceleratorType itemsElement = AcceleratorType.newBuilder().build(); + List items = Arrays.asList(itemsElement); + AcceleratorTypeList expectedResponse = + AcceleratorTypeList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + ListAcceleratorTypesPagedResponse pagedListResponse = client.listAcceleratorTypes(zone); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listAcceleratorTypesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + client.listAcceleratorTypes(zone); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AddressClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AddressClientTest.java new file mode 100644 index 000000000000..14bade32a966 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AddressClientTest.java @@ -0,0 +1,465 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.AddressClient.AggregatedListAddressesPagedResponse; +import static com.google.cloud.compute.v1.AddressClient.ListAddressesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonAddressStub.aggregatedListAddressesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAddressStub.deleteAddressMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAddressStub.getAddressMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAddressStub.insertAddressMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAddressStub.listAddressesMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.AddressStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class AddressClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListAddressesMethodDescriptor, + deleteAddressMethodDescriptor, + getAddressMethodDescriptor, + insertAddressMethodDescriptor, + listAddressesMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, AddressStubSettings.getDefaultEndpoint()); + + private static AddressClient client; + private static AddressSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + AddressSettings.newBuilder() + .setTransportChannelProvider( + AddressSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = AddressClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListAddressesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + AddressesScopedList itemsItem = AddressesScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + AddressAggregatedList expectedResponse = + AddressAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListAddressesPagedResponse pagedListResponse = + client.aggregatedListAddresses(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListAddressesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListAddresses(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteAddressTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionAddressName address = + ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]"); + + Operation actualResponse = client.deleteAddress(address); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteAddressExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionAddressName address = + ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]"); + + client.deleteAddress(address); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getAddressTest() { + ProjectGlobalAddressName address2 = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]"); + String addressType = "addressType264307877"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String selfLink = "selfLink-1691268851"; + String ipVersion = "ipVersion-1315653184"; + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String status = "status-892481550"; + Address expectedResponse = + Address.newBuilder() + .setAddress(address2.toString()) + .setAddressType(addressType) + .setKind(kind) + .setDescription(description) + .setSelfLink(selfLink) + .setIpVersion(ipVersion) + .setSubnetwork(subnetwork.toString()) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .setRegion(region.toString()) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionAddressName address = + ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]"); + + Address actualResponse = client.getAddress(address); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getAddressExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionAddressName address = + ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]"); + + client.getAddress(address); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertAddressTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Address addressResource = Address.newBuilder().build(); + + Operation actualResponse = client.insertAddress(region, addressResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertAddressExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Address addressResource = Address.newBuilder().build(); + + client.insertAddress(region, addressResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listAddressesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Address itemsElement = Address.newBuilder().build(); + List

items = Arrays.asList(itemsElement); + AddressList expectedResponse = + AddressList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListAddressesPagedResponse pagedListResponse = client.listAddresses(region); + + List
resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listAddressesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listAddresses(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AutoscalerClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AutoscalerClientTest.java new file mode 100644 index 000000000000..f1d69cadbd2a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AutoscalerClientTest.java @@ -0,0 +1,648 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.AutoscalerClient.AggregatedListAutoscalersPagedResponse; +import static com.google.cloud.compute.v1.AutoscalerClient.ListAutoscalersPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonAutoscalerStub.aggregatedListAutoscalersMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAutoscalerStub.deleteAutoscalerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAutoscalerStub.getAutoscalerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAutoscalerStub.insertAutoscalerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAutoscalerStub.listAutoscalersMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAutoscalerStub.patchAutoscalerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonAutoscalerStub.updateAutoscalerMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.AutoscalerStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class AutoscalerClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListAutoscalersMethodDescriptor, + deleteAutoscalerMethodDescriptor, + getAutoscalerMethodDescriptor, + insertAutoscalerMethodDescriptor, + listAutoscalersMethodDescriptor, + patchAutoscalerMethodDescriptor, + updateAutoscalerMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, AutoscalerStubSettings.getDefaultEndpoint()); + + private static AutoscalerClient client; + private static AutoscalerSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + AutoscalerSettings.newBuilder() + .setTransportChannelProvider( + AutoscalerSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = AutoscalerClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListAutoscalersTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + AutoscalersScopedList itemsItem = AutoscalersScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + AutoscalerAggregatedList expectedResponse = + AutoscalerAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListAutoscalersPagedResponse pagedListResponse = + client.aggregatedListAutoscalers(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListAutoscalersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListAutoscalers(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteAutoscalerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneAutoscalerName autoscaler = + ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]"); + + Operation actualResponse = client.deleteAutoscaler(autoscaler); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteAutoscalerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneAutoscalerName autoscaler = + ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]"); + + client.deleteAutoscaler(autoscaler); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getAutoscalerTest() { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String selfLink = "selfLink-1691268851"; + String status = "status-892481550"; + String target = "target-880905839"; + Autoscaler expectedResponse = + Autoscaler.newBuilder() + .setZone(zone.toString()) + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setRegion(region.toString()) + .setSelfLink(selfLink) + .setStatus(status) + .setTarget(target) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneAutoscalerName autoscaler = + ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]"); + + Autoscaler actualResponse = client.getAutoscaler(autoscaler); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getAutoscalerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneAutoscalerName autoscaler = + ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]"); + + client.getAutoscaler(autoscaler); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertAutoscalerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone2 = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone2.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + Operation actualResponse = client.insertAutoscaler(zone, autoscalerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertAutoscalerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + client.insertAutoscaler(zone, autoscalerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listAutoscalersTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Autoscaler itemsElement = Autoscaler.newBuilder().build(); + List items = Arrays.asList(itemsElement); + AutoscalerList expectedResponse = + AutoscalerList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + ListAutoscalersPagedResponse pagedListResponse = client.listAutoscalers(zone); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listAutoscalersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + client.listAutoscalers(zone); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchAutoscalerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone2 = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone2.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + String autoscaler = "autoscaler517258967"; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + Operation actualResponse = client.patchAutoscaler(autoscaler, zone, autoscalerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchAutoscalerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String autoscaler = "autoscaler517258967"; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + client.patchAutoscaler(autoscaler, zone, autoscalerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateAutoscalerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone2 = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone2.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + String autoscaler = "autoscaler517258967"; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + Operation actualResponse = client.updateAutoscaler(autoscaler, zone, autoscalerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateAutoscalerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String autoscaler = "autoscaler517258967"; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + client.updateAutoscaler(autoscaler, zone, autoscalerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/BackendBucketClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/BackendBucketClientTest.java new file mode 100644 index 000000000000..38917bc24fab --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/BackendBucketClientTest.java @@ -0,0 +1,576 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.BackendBucketClient.ListBackendBucketsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendBucketStub.deleteBackendBucketMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendBucketStub.getBackendBucketMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendBucketStub.insertBackendBucketMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendBucketStub.listBackendBucketsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendBucketStub.patchBackendBucketMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendBucketStub.updateBackendBucketMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.BackendBucketStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class BackendBucketClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteBackendBucketMethodDescriptor, + getBackendBucketMethodDescriptor, + insertBackendBucketMethodDescriptor, + listBackendBucketsMethodDescriptor, + patchBackendBucketMethodDescriptor, + updateBackendBucketMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, BackendBucketStubSettings.getDefaultEndpoint()); + + private static BackendBucketClient client; + private static BackendBucketSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + BackendBucketSettings.newBuilder() + .setTransportChannelProvider( + BackendBucketSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = BackendBucketClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteBackendBucketTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalBackendBucketName backendBucket = + ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]"); + + Operation actualResponse = client.deleteBackendBucket(backendBucket); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteBackendBucketExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalBackendBucketName backendBucket = + ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]"); + + client.deleteBackendBucket(backendBucket); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getBackendBucketTest() { + String bucketName = "bucketName283610048"; + Boolean enableCdn = false; + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + BackendBucket expectedResponse = + BackendBucket.newBuilder() + .setBucketName(bucketName) + .setEnableCdn(enableCdn) + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalBackendBucketName backendBucket = + ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]"); + + BackendBucket actualResponse = client.getBackendBucket(backendBucket); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getBackendBucketExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalBackendBucketName backendBucket = + ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]"); + + client.getBackendBucket(backendBucket); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertBackendBucketTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + BackendBucket backendBucketResource = BackendBucket.newBuilder().build(); + + Operation actualResponse = client.insertBackendBucket(project, backendBucketResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertBackendBucketExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + BackendBucket backendBucketResource = BackendBucket.newBuilder().build(); + + client.insertBackendBucket(project, backendBucketResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listBackendBucketsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + BackendBucket itemsElement = BackendBucket.newBuilder().build(); + List items = Arrays.asList(itemsElement); + BackendBucketList expectedResponse = + BackendBucketList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListBackendBucketsPagedResponse pagedListResponse = client.listBackendBuckets(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listBackendBucketsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listBackendBuckets(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchBackendBucketTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalBackendBucketName backendBucket = + ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]"); + BackendBucket backendBucketResource = BackendBucket.newBuilder().build(); + + Operation actualResponse = client.patchBackendBucket(backendBucket, backendBucketResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchBackendBucketExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalBackendBucketName backendBucket = + ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]"); + BackendBucket backendBucketResource = BackendBucket.newBuilder().build(); + + client.patchBackendBucket(backendBucket, backendBucketResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateBackendBucketTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalBackendBucketName backendBucket = + ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]"); + BackendBucket backendBucketResource = BackendBucket.newBuilder().build(); + + Operation actualResponse = client.updateBackendBucket(backendBucket, backendBucketResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateBackendBucketExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalBackendBucketName backendBucket = + ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]"); + BackendBucket backendBucketResource = BackendBucket.newBuilder().build(); + + client.updateBackendBucket(backendBucket, backendBucketResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/BackendServiceClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/BackendServiceClientTest.java new file mode 100644 index 000000000000..1913b10f6f89 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/BackendServiceClientTest.java @@ -0,0 +1,715 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.BackendServiceClient.AggregatedListBackendServicesPagedResponse; +import static com.google.cloud.compute.v1.BackendServiceClient.ListBackendServicesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendServiceStub.aggregatedListBackendServicesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendServiceStub.deleteBackendServiceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendServiceStub.getBackendServiceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendServiceStub.getHealthBackendServiceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendServiceStub.insertBackendServiceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendServiceStub.listBackendServicesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendServiceStub.patchBackendServiceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonBackendServiceStub.updateBackendServiceMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.BackendServiceStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class BackendServiceClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListBackendServicesMethodDescriptor, + deleteBackendServiceMethodDescriptor, + getBackendServiceMethodDescriptor, + getHealthBackendServiceMethodDescriptor, + insertBackendServiceMethodDescriptor, + listBackendServicesMethodDescriptor, + patchBackendServiceMethodDescriptor, + updateBackendServiceMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, BackendServiceStubSettings.getDefaultEndpoint()); + + private static BackendServiceClient client; + private static BackendServiceSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + BackendServiceSettings.newBuilder() + .setTransportChannelProvider( + BackendServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = BackendServiceClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListBackendServicesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + BackendServicesScopedList itemsItem = BackendServicesScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + BackendServiceAggregatedList expectedResponse = + BackendServiceAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListBackendServicesPagedResponse pagedListResponse = + client.aggregatedListBackendServices(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListBackendServicesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListBackendServices(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteBackendServiceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + + Operation actualResponse = client.deleteBackendService(backendService); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + + client.deleteBackendService(backendService); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getBackendServiceTest() { + Integer affinityCookieTtlSec = 1777486694; + String kind = "kind3292052"; + String sessionAffinity = "sessionAffinity1000759473"; + String description = "description-1724546052"; + String loadBalancingScheme = "loadBalancingScheme1974502980"; + String portName = "portName1115276169"; + Integer timeoutSec = 2067488653; + String selfLink = "selfLink-1691268851"; + String protocol = "protocol-989163880"; + Boolean enableCDN = false; + Integer port = 3446913; + String creationTimestamp = "creationTimestamp567396278"; + String fingerprint = "fingerprint-1375934236"; + String name = "name3373707"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + BackendService expectedResponse = + BackendService.newBuilder() + .setAffinityCookieTtlSec(affinityCookieTtlSec) + .setKind(kind) + .setSessionAffinity(sessionAffinity) + .setDescription(description) + .setLoadBalancingScheme(loadBalancingScheme) + .setPortName(portName) + .setTimeoutSec(timeoutSec) + .setSelfLink(selfLink) + .setProtocol(protocol) + .setEnableCDN(enableCDN) + .setPort(port) + .setCreationTimestamp(creationTimestamp) + .setFingerprint(fingerprint) + .setName(name) + .setId(id) + .setRegion(region.toString()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + + BackendService actualResponse = client.getBackendService(backendService); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + + client.getBackendService(backendService); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getHealthBackendServiceTest() { + String kind = "kind3292052"; + BackendServiceGroupHealth expectedResponse = + BackendServiceGroupHealth.newBuilder().setKind(kind).build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + ResourceGroupReference resourceGroupReferenceResource = + ResourceGroupReference.newBuilder().build(); + + BackendServiceGroupHealth actualResponse = + client.getHealthBackendService(backendService, resourceGroupReferenceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getHealthBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + ResourceGroupReference resourceGroupReferenceResource = + ResourceGroupReference.newBuilder().build(); + + client.getHealthBackendService(backendService, resourceGroupReferenceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertBackendServiceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + Operation actualResponse = client.insertBackendService(project, backendServiceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + client.insertBackendService(project, backendServiceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listBackendServicesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + BackendService itemsElement = BackendService.newBuilder().build(); + List items = Arrays.asList(itemsElement); + BackendServiceList expectedResponse = + BackendServiceList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListBackendServicesPagedResponse pagedListResponse = client.listBackendServices(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listBackendServicesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listBackendServices(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchBackendServiceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + Operation actualResponse = client.patchBackendService(backendService, backendServiceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + client.patchBackendService(backendService, backendServiceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateBackendServiceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + Operation actualResponse = client.updateBackendService(backendService, backendServiceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + client.updateBackendService(backendService, backendServiceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/DiskClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/DiskClientTest.java new file mode 100644 index 000000000000..94683e69e0cd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/DiskClientTest.java @@ -0,0 +1,753 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.DiskClient.AggregatedListDisksPagedResponse; +import static com.google.cloud.compute.v1.DiskClient.ListDisksPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonDiskStub.aggregatedListDisksMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonDiskStub.createSnapshotDiskMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonDiskStub.deleteDiskMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonDiskStub.getDiskMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonDiskStub.insertDiskMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonDiskStub.listDisksMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonDiskStub.resizeDiskMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonDiskStub.setLabelsDiskMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.DiskStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class DiskClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListDisksMethodDescriptor, + createSnapshotDiskMethodDescriptor, + deleteDiskMethodDescriptor, + getDiskMethodDescriptor, + insertDiskMethodDescriptor, + listDisksMethodDescriptor, + resizeDiskMethodDescriptor, + setLabelsDiskMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, DiskStubSettings.getDefaultEndpoint()); + + private static DiskClient client; + private static DiskSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + DiskSettings.newBuilder() + .setTransportChannelProvider( + DiskSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DiskClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListDisksTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + DisksScopedList itemsItem = DisksScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + DiskAggregatedList expectedResponse = + DiskAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListDisksPagedResponse pagedListResponse = client.aggregatedListDisks(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListDisksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListDisks(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createSnapshotDiskTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]"); + Boolean guestFlush = false; + Snapshot snapshotResource = Snapshot.newBuilder().build(); + + Operation actualResponse = client.createSnapshotDisk(disk, guestFlush, snapshotResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void createSnapshotDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]"); + Boolean guestFlush = false; + Snapshot snapshotResource = Snapshot.newBuilder().build(); + + client.createSnapshotDisk(disk, guestFlush, snapshotResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteDiskTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]"); + + Operation actualResponse = client.deleteDisk(disk); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]"); + + client.deleteDisk(disk); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getDiskTest() { + String sizeGb = "sizeGb2105542105"; + String sourceSnapshotId = "sourceSnapshotId-1511650478"; + String lastDetachTimestamp = "lastDetachTimestamp-480399885"; + String description = "description-1724546052"; + String sourceSnapshot = "sourceSnapshot-947679896"; + String type = "type3575610"; + String labelFingerprint = "labelFingerprint714995737"; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String creationTimestamp = "creationTimestamp567396278"; + String options = "options-1249474914"; + String id = "id3355"; + String sourceImageId = "sourceImageId-2092155357"; + String kind = "kind3292052"; + String lastAttachTimestamp = "lastAttachTimestamp-2105323995"; + String selfLink = "selfLink-1691268851"; + String name = "name3373707"; + String sourceImage = "sourceImage1661056055"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String status = "status-892481550"; + Disk expectedResponse = + Disk.newBuilder() + .setSizeGb(sizeGb) + .setSourceSnapshotId(sourceSnapshotId) + .setLastDetachTimestamp(lastDetachTimestamp) + .setDescription(description) + .setSourceSnapshot(sourceSnapshot) + .setType(type) + .setLabelFingerprint(labelFingerprint) + .setZone(zone.toString()) + .setCreationTimestamp(creationTimestamp) + .setOptions(options) + .setId(id) + .setSourceImageId(sourceImageId) + .setKind(kind) + .setLastAttachTimestamp(lastAttachTimestamp) + .setSelfLink(selfLink) + .setName(name) + .setSourceImage(sourceImage) + .setRegion(region.toString()) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]"); + + Disk actualResponse = client.getDisk(disk); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]"); + + client.getDisk(disk); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertDiskTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone2 = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone2.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + Disk diskResource = Disk.newBuilder().build(); + + Operation actualResponse = client.insertDisk(zone, diskResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + Disk diskResource = Disk.newBuilder().build(); + + client.insertDisk(zone, diskResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listDisksTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Disk itemsElement = Disk.newBuilder().build(); + List items = Arrays.asList(itemsElement); + DiskList expectedResponse = + DiskList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + ListDisksPagedResponse pagedListResponse = client.listDisks(zone); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listDisksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + client.listDisks(zone); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void resizeDiskTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]"); + DisksResizeRequest disksResizeRequestResource = DisksResizeRequest.newBuilder().build(); + + Operation actualResponse = client.resizeDisk(disk, disksResizeRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void resizeDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]"); + DisksResizeRequest disksResizeRequestResource = DisksResizeRequest.newBuilder().build(); + + client.resizeDisk(disk, disksResizeRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setLabelsDiskTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneDiskResourceName resource = + ProjectZoneDiskResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]"); + ZoneSetLabelsRequest zoneSetLabelsRequestResource = ZoneSetLabelsRequest.newBuilder().build(); + + Operation actualResponse = client.setLabelsDisk(resource, zoneSetLabelsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setLabelsDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneDiskResourceName resource = + ProjectZoneDiskResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]"); + ZoneSetLabelsRequest zoneSetLabelsRequestResource = ZoneSetLabelsRequest.newBuilder().build(); + + client.setLabelsDisk(resource, zoneSetLabelsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/DiskTypeClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/DiskTypeClientTest.java new file mode 100644 index 000000000000..be7b400f3a31 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/DiskTypeClientTest.java @@ -0,0 +1,276 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.DiskTypeClient.AggregatedListDiskTypesPagedResponse; +import static com.google.cloud.compute.v1.DiskTypeClient.ListDiskTypesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonDiskTypeStub.aggregatedListDiskTypesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonDiskTypeStub.getDiskTypeMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonDiskTypeStub.listDiskTypesMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.DiskTypeStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class DiskTypeClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListDiskTypesMethodDescriptor, + getDiskTypeMethodDescriptor, + listDiskTypesMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, DiskTypeStubSettings.getDefaultEndpoint()); + + private static DiskTypeClient client; + private static DiskTypeSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + DiskTypeSettings.newBuilder() + .setTransportChannelProvider( + DiskTypeSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DiskTypeClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListDiskTypesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + DiskTypesScopedList itemsItem = DiskTypesScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + DiskTypeAggregatedList expectedResponse = + DiskTypeAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListDiskTypesPagedResponse pagedListResponse = + client.aggregatedListDiskTypes(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListDiskTypesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListDiskTypes(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getDiskTypeTest() { + String defaultDiskSizeGb = "defaultDiskSizeGb807490165"; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String validDiskSize = "validDiskSize-1653521184"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String selfLink = "selfLink-1691268851"; + DiskType expectedResponse = + DiskType.newBuilder() + .setDefaultDiskSizeGb(defaultDiskSizeGb) + .setZone(zone.toString()) + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setValidDiskSize(validDiskSize) + .setRegion(region.toString()) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneDiskTypeName diskType = + ProjectZoneDiskTypeName.of("[PROJECT]", "[ZONE]", "[DISK_TYPE]"); + + DiskType actualResponse = client.getDiskType(diskType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getDiskTypeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneDiskTypeName diskType = + ProjectZoneDiskTypeName.of("[PROJECT]", "[ZONE]", "[DISK_TYPE]"); + + client.getDiskType(diskType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listDiskTypesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + DiskType itemsElement = DiskType.newBuilder().build(); + List items = Arrays.asList(itemsElement); + DiskTypeList expectedResponse = + DiskTypeList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + ListDiskTypesPagedResponse pagedListResponse = client.listDiskTypes(zone); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listDiskTypesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + client.listDiskTypes(zone); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/FirewallClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/FirewallClientTest.java new file mode 100644 index 000000000000..c36d014f97fc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/FirewallClientTest.java @@ -0,0 +1,570 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.FirewallClient.ListFirewallsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonFirewallStub.deleteFirewallMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonFirewallStub.getFirewallMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonFirewallStub.insertFirewallMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonFirewallStub.listFirewallsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonFirewallStub.patchFirewallMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonFirewallStub.updateFirewallMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.FirewallStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class FirewallClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteFirewallMethodDescriptor, + getFirewallMethodDescriptor, + insertFirewallMethodDescriptor, + listFirewallsMethodDescriptor, + patchFirewallMethodDescriptor, + updateFirewallMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, FirewallStubSettings.getDefaultEndpoint()); + + private static FirewallClient client; + private static FirewallSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + FirewallSettings.newBuilder() + .setTransportChannelProvider( + FirewallSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = FirewallClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteFirewallTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]"); + + Operation actualResponse = client.deleteFirewall(firewall); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteFirewallExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]"); + + client.deleteFirewall(firewall); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getFirewallTest() { + String kind = "kind3292052"; + String description = "description-1724546052"; + Integer priority = 1165461084; + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + String selfLink = "selfLink-1691268851"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + String direction = "direction-962590849"; + Firewall expectedResponse = + Firewall.newBuilder() + .setKind(kind) + .setDescription(description) + .setPriority(priority) + .setNetwork(network.toString()) + .setSelfLink(selfLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .setDirection(direction) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]"); + + Firewall actualResponse = client.getFirewall(firewall); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getFirewallExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]"); + + client.getFirewall(firewall); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertFirewallTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + Firewall firewallResource = Firewall.newBuilder().build(); + + Operation actualResponse = client.insertFirewall(project, firewallResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertFirewallExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + Firewall firewallResource = Firewall.newBuilder().build(); + + client.insertFirewall(project, firewallResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listFirewallsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Firewall itemsElement = Firewall.newBuilder().build(); + List items = Arrays.asList(itemsElement); + FirewallList expectedResponse = + FirewallList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListFirewallsPagedResponse pagedListResponse = client.listFirewalls(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listFirewallsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listFirewalls(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchFirewallTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]"); + Firewall firewallResource = Firewall.newBuilder().build(); + + Operation actualResponse = client.patchFirewall(firewall, firewallResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchFirewallExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]"); + Firewall firewallResource = Firewall.newBuilder().build(); + + client.patchFirewall(firewall, firewallResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateFirewallTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]"); + Firewall firewallResource = Firewall.newBuilder().build(); + + Operation actualResponse = client.updateFirewall(firewall, firewallResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateFirewallExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]"); + Firewall firewallResource = Firewall.newBuilder().build(); + + client.updateFirewall(firewall, firewallResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ForwardingRuleClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ForwardingRuleClientTest.java new file mode 100644 index 000000000000..d6c94aead3a6 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ForwardingRuleClientTest.java @@ -0,0 +1,569 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.ForwardingRuleClient.AggregatedListForwardingRulesPagedResponse; +import static com.google.cloud.compute.v1.ForwardingRuleClient.ListForwardingRulesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonForwardingRuleStub.aggregatedListForwardingRulesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonForwardingRuleStub.deleteForwardingRuleMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonForwardingRuleStub.getForwardingRuleMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonForwardingRuleStub.insertForwardingRuleMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonForwardingRuleStub.listForwardingRulesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonForwardingRuleStub.setTargetForwardingRuleMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.ForwardingRuleStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class ForwardingRuleClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListForwardingRulesMethodDescriptor, + deleteForwardingRuleMethodDescriptor, + getForwardingRuleMethodDescriptor, + insertForwardingRuleMethodDescriptor, + listForwardingRulesMethodDescriptor, + setTargetForwardingRuleMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, ForwardingRuleStubSettings.getDefaultEndpoint()); + + private static ForwardingRuleClient client; + private static ForwardingRuleSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + ForwardingRuleSettings.newBuilder() + .setTransportChannelProvider( + ForwardingRuleSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ForwardingRuleClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListForwardingRulesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + ForwardingRulesScopedList itemsItem = ForwardingRulesScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + ForwardingRuleAggregatedList expectedResponse = + ForwardingRuleAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListForwardingRulesPagedResponse pagedListResponse = + client.aggregatedListForwardingRules(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListForwardingRulesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListForwardingRules(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteForwardingRuleTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionForwardingRuleName forwardingRule = + ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]"); + + Operation actualResponse = client.deleteForwardingRule(forwardingRule); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteForwardingRuleExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionForwardingRuleName forwardingRule = + ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]"); + + client.deleteForwardingRule(forwardingRule); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getForwardingRuleTest() { + String portRange = "portRange217518079"; + String kind = "kind3292052"; + String iPProtocol = "iPProtocol323774237"; + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + String description = "description-1724546052"; + String loadBalancingScheme = "loadBalancingScheme1974502980"; + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + String selfLink = "selfLink-1691268851"; + String target = "target-880905839"; + String ipVersion = "ipVersion-1315653184"; + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + String iPAddress = "iPAddress-551149873"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + ForwardingRule expectedResponse = + ForwardingRule.newBuilder() + .setPortRange(portRange) + .setKind(kind) + .setIPProtocol(iPProtocol) + .setBackendService(backendService.toString()) + .setDescription(description) + .setLoadBalancingScheme(loadBalancingScheme) + .setNetwork(network.toString()) + .setSelfLink(selfLink) + .setTarget(target) + .setIpVersion(ipVersion) + .setSubnetwork(subnetwork.toString()) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .setIPAddress(iPAddress) + .setRegion(region.toString()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionForwardingRuleName forwardingRule = + ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]"); + + ForwardingRule actualResponse = client.getForwardingRule(forwardingRule); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getForwardingRuleExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionForwardingRuleName forwardingRule = + ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]"); + + client.getForwardingRule(forwardingRule); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertForwardingRuleTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build(); + + Operation actualResponse = client.insertForwardingRule(region, forwardingRuleResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertForwardingRuleExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build(); + + client.insertForwardingRule(region, forwardingRuleResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listForwardingRulesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + ForwardingRule itemsElement = ForwardingRule.newBuilder().build(); + List items = Arrays.asList(itemsElement); + ForwardingRuleList expectedResponse = + ForwardingRuleList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListForwardingRulesPagedResponse pagedListResponse = client.listForwardingRules(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listForwardingRulesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listForwardingRules(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setTargetForwardingRuleTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionForwardingRuleName forwardingRule = + ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]"); + TargetReference targetReferenceResource = TargetReference.newBuilder().build(); + + Operation actualResponse = + client.setTargetForwardingRule(forwardingRule, targetReferenceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setTargetForwardingRuleExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionForwardingRuleName forwardingRule = + ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]"); + TargetReference targetReferenceResource = TargetReference.newBuilder().build(); + + client.setTargetForwardingRule(forwardingRule, targetReferenceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/GlobalAddressClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/GlobalAddressClientTest.java new file mode 100644 index 000000000000..d73efe4dd9e7 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/GlobalAddressClientTest.java @@ -0,0 +1,393 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.GlobalAddressClient.ListGlobalAddressesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalAddressStub.deleteGlobalAddressMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalAddressStub.getGlobalAddressMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalAddressStub.insertGlobalAddressMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalAddressStub.listGlobalAddressesMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.GlobalAddressStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class GlobalAddressClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteGlobalAddressMethodDescriptor, + getGlobalAddressMethodDescriptor, + insertGlobalAddressMethodDescriptor, + listGlobalAddressesMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, GlobalAddressStubSettings.getDefaultEndpoint()); + + private static GlobalAddressClient client; + private static GlobalAddressSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + GlobalAddressSettings.newBuilder() + .setTransportChannelProvider( + GlobalAddressSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = GlobalAddressClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteGlobalAddressTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]"); + + Operation actualResponse = client.deleteGlobalAddress(address); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteGlobalAddressExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]"); + + client.deleteGlobalAddress(address); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getGlobalAddressTest() { + ProjectGlobalAddressName address2 = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]"); + String addressType = "addressType264307877"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String selfLink = "selfLink-1691268851"; + String ipVersion = "ipVersion-1315653184"; + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String status = "status-892481550"; + Address expectedResponse = + Address.newBuilder() + .setAddress(address2.toString()) + .setAddressType(addressType) + .setKind(kind) + .setDescription(description) + .setSelfLink(selfLink) + .setIpVersion(ipVersion) + .setSubnetwork(subnetwork.toString()) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .setRegion(region.toString()) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]"); + + Address actualResponse = client.getGlobalAddress(address); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getGlobalAddressExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]"); + + client.getGlobalAddress(address); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertGlobalAddressTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + Address addressResource = Address.newBuilder().build(); + + Operation actualResponse = client.insertGlobalAddress(project, addressResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertGlobalAddressExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + Address addressResource = Address.newBuilder().build(); + + client.insertGlobalAddress(project, addressResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listGlobalAddressesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Address itemsElement = Address.newBuilder().build(); + List
items = Arrays.asList(itemsElement); + AddressList expectedResponse = + AddressList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListGlobalAddressesPagedResponse pagedListResponse = client.listGlobalAddresses(project); + + List
resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listGlobalAddressesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listGlobalAddresses(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/GlobalForwardingRuleClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/GlobalForwardingRuleClientTest.java new file mode 100644 index 000000000000..671bffee4e82 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/GlobalForwardingRuleClientTest.java @@ -0,0 +1,503 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.GlobalForwardingRuleClient.ListGlobalForwardingRulesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalForwardingRuleStub.deleteGlobalForwardingRuleMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalForwardingRuleStub.getGlobalForwardingRuleMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalForwardingRuleStub.insertGlobalForwardingRuleMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalForwardingRuleStub.listGlobalForwardingRulesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalForwardingRuleStub.setTargetGlobalForwardingRuleMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.GlobalForwardingRuleStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class GlobalForwardingRuleClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteGlobalForwardingRuleMethodDescriptor, + getGlobalForwardingRuleMethodDescriptor, + insertGlobalForwardingRuleMethodDescriptor, + listGlobalForwardingRulesMethodDescriptor, + setTargetGlobalForwardingRuleMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService( + METHOD_DESCRIPTORS, GlobalForwardingRuleStubSettings.getDefaultEndpoint()); + + private static GlobalForwardingRuleClient client; + private static GlobalForwardingRuleSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + GlobalForwardingRuleSettings.newBuilder() + .setTransportChannelProvider( + GlobalForwardingRuleSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = GlobalForwardingRuleClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteGlobalForwardingRuleTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalForwardingRuleName forwardingRule = + ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]"); + + Operation actualResponse = client.deleteGlobalForwardingRule(forwardingRule); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteGlobalForwardingRuleExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalForwardingRuleName forwardingRule = + ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]"); + + client.deleteGlobalForwardingRule(forwardingRule); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getGlobalForwardingRuleTest() { + String portRange = "portRange217518079"; + String kind = "kind3292052"; + String iPProtocol = "iPProtocol323774237"; + ProjectGlobalBackendServiceName backendService = + ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); + String description = "description-1724546052"; + String loadBalancingScheme = "loadBalancingScheme1974502980"; + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + String selfLink = "selfLink-1691268851"; + String target = "target-880905839"; + String ipVersion = "ipVersion-1315653184"; + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + String iPAddress = "iPAddress-551149873"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + ForwardingRule expectedResponse = + ForwardingRule.newBuilder() + .setPortRange(portRange) + .setKind(kind) + .setIPProtocol(iPProtocol) + .setBackendService(backendService.toString()) + .setDescription(description) + .setLoadBalancingScheme(loadBalancingScheme) + .setNetwork(network.toString()) + .setSelfLink(selfLink) + .setTarget(target) + .setIpVersion(ipVersion) + .setSubnetwork(subnetwork.toString()) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .setIPAddress(iPAddress) + .setRegion(region.toString()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalForwardingRuleName forwardingRule = + ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]"); + + ForwardingRule actualResponse = client.getGlobalForwardingRule(forwardingRule); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getGlobalForwardingRuleExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalForwardingRuleName forwardingRule = + ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]"); + + client.getGlobalForwardingRule(forwardingRule); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertGlobalForwardingRuleTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build(); + + Operation actualResponse = client.insertGlobalForwardingRule(project, forwardingRuleResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertGlobalForwardingRuleExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build(); + + client.insertGlobalForwardingRule(project, forwardingRuleResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listGlobalForwardingRulesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + ForwardingRule itemsElement = ForwardingRule.newBuilder().build(); + List items = Arrays.asList(itemsElement); + ForwardingRuleList expectedResponse = + ForwardingRuleList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListGlobalForwardingRulesPagedResponse pagedListResponse = + client.listGlobalForwardingRules(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listGlobalForwardingRulesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listGlobalForwardingRules(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setTargetGlobalForwardingRuleTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalForwardingRuleName forwardingRule = + ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]"); + TargetReference targetReferenceResource = TargetReference.newBuilder().build(); + + Operation actualResponse = + client.setTargetGlobalForwardingRule(forwardingRule, targetReferenceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setTargetGlobalForwardingRuleExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalForwardingRuleName forwardingRule = + ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]"); + TargetReference targetReferenceResource = TargetReference.newBuilder().build(); + + client.setTargetGlobalForwardingRule(forwardingRule, targetReferenceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/GlobalOperationClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/GlobalOperationClientTest.java new file mode 100644 index 000000000000..fa158abe61d9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/GlobalOperationClientTest.java @@ -0,0 +1,344 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.GlobalOperationClient.AggregatedListGlobalOperationsPagedResponse; +import static com.google.cloud.compute.v1.GlobalOperationClient.ListGlobalOperationsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalOperationStub.aggregatedListGlobalOperationsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalOperationStub.deleteGlobalOperationMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalOperationStub.getGlobalOperationMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonGlobalOperationStub.listGlobalOperationsMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.GlobalOperationStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class GlobalOperationClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListGlobalOperationsMethodDescriptor, + deleteGlobalOperationMethodDescriptor, + getGlobalOperationMethodDescriptor, + listGlobalOperationsMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, GlobalOperationStubSettings.getDefaultEndpoint()); + + private static GlobalOperationClient client; + private static GlobalOperationSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + GlobalOperationSettings.newBuilder() + .setTransportChannelProvider( + GlobalOperationSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = GlobalOperationClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListGlobalOperationsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + OperationsScopedList itemsItem = OperationsScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + OperationAggregatedList expectedResponse = + OperationAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListGlobalOperationsPagedResponse pagedListResponse = + client.aggregatedListGlobalOperations(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListGlobalOperationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListGlobalOperations(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteGlobalOperationTest() { + mockService.addNullResponse(); + + ProjectGlobalOperationName operation = + ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]"); + + client.deleteGlobalOperation(operation); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteGlobalOperationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalOperationName operation = + ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]"); + + client.deleteGlobalOperation(operation); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getGlobalOperationTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalOperationName operation = + ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]"); + + Operation actualResponse = client.getGlobalOperation(operation); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getGlobalOperationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalOperationName operation = + ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]"); + + client.getGlobalOperation(operation); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listGlobalOperationsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Operation itemsElement = Operation.newBuilder().build(); + List items = Arrays.asList(itemsElement); + OperationList expectedResponse = + OperationList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListGlobalOperationsPagedResponse pagedListResponse = client.listGlobalOperations(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listGlobalOperationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listGlobalOperations(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/HealthCheckClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/HealthCheckClientTest.java new file mode 100644 index 000000000000..0a3e9896fa2c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/HealthCheckClientTest.java @@ -0,0 +1,582 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.HealthCheckClient.ListHealthChecksPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonHealthCheckStub.deleteHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHealthCheckStub.getHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHealthCheckStub.insertHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHealthCheckStub.listHealthChecksMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHealthCheckStub.patchHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHealthCheckStub.updateHealthCheckMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.HealthCheckStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class HealthCheckClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteHealthCheckMethodDescriptor, + getHealthCheckMethodDescriptor, + insertHealthCheckMethodDescriptor, + listHealthChecksMethodDescriptor, + patchHealthCheckMethodDescriptor, + updateHealthCheckMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, HealthCheckStubSettings.getDefaultEndpoint()); + + private static HealthCheckClient client; + private static HealthCheckSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + HealthCheckSettings.newBuilder() + .setTransportChannelProvider( + HealthCheckSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = HealthCheckClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHealthCheckName healthCheck = + ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]"); + + Operation actualResponse = client.deleteHealthCheck(healthCheck); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHealthCheckName healthCheck = + ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]"); + + client.deleteHealthCheck(healthCheck); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getHealthCheckTest() { + Integer checkIntervalSec = 345561006; + String kind = "kind3292052"; + String description = "description-1724546052"; + String type = "type3575610"; + Integer timeoutSec = 2067488653; + String selfLink = "selfLink-1691268851"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer unhealthyThreshold = 1838571216; + Integer healthyThreshold = 133658551; + String id = "id3355"; + HealthCheck expectedResponse = + HealthCheck.newBuilder() + .setCheckIntervalSec(checkIntervalSec) + .setKind(kind) + .setDescription(description) + .setType(type) + .setTimeoutSec(timeoutSec) + .setSelfLink(selfLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setUnhealthyThreshold(unhealthyThreshold) + .setHealthyThreshold(healthyThreshold) + .setId(id) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHealthCheckName healthCheck = + ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]"); + + HealthCheck actualResponse = client.getHealthCheck(healthCheck); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHealthCheckName healthCheck = + ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]"); + + client.getHealthCheck(healthCheck); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + HealthCheck healthCheckResource = HealthCheck.newBuilder().build(); + + Operation actualResponse = client.insertHealthCheck(project, healthCheckResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + HealthCheck healthCheckResource = HealthCheck.newBuilder().build(); + + client.insertHealthCheck(project, healthCheckResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listHealthChecksTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + HealthCheck itemsElement = HealthCheck.newBuilder().build(); + List items = Arrays.asList(itemsElement); + HealthCheckList expectedResponse = + HealthCheckList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListHealthChecksPagedResponse pagedListResponse = client.listHealthChecks(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listHealthChecksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listHealthChecks(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHealthCheckName healthCheck = + ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]"); + HealthCheck healthCheckResource = HealthCheck.newBuilder().build(); + + Operation actualResponse = client.patchHealthCheck(healthCheck, healthCheckResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHealthCheckName healthCheck = + ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]"); + HealthCheck healthCheckResource = HealthCheck.newBuilder().build(); + + client.patchHealthCheck(healthCheck, healthCheckResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHealthCheckName healthCheck = + ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]"); + HealthCheck healthCheckResource = HealthCheck.newBuilder().build(); + + Operation actualResponse = client.updateHealthCheck(healthCheck, healthCheckResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHealthCheckName healthCheck = + ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]"); + HealthCheck healthCheckResource = HealthCheck.newBuilder().build(); + + client.updateHealthCheck(healthCheck, healthCheckResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/HttpHealthCheckClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/HttpHealthCheckClientTest.java new file mode 100644 index 000000000000..b84c34a573d4 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/HttpHealthCheckClientTest.java @@ -0,0 +1,588 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.HttpHealthCheckClient.ListHttpHealthChecksPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpHealthCheckStub.deleteHttpHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpHealthCheckStub.getHttpHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpHealthCheckStub.insertHttpHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpHealthCheckStub.listHttpHealthChecksMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpHealthCheckStub.patchHttpHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpHealthCheckStub.updateHttpHealthCheckMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.HttpHealthCheckStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class HttpHealthCheckClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteHttpHealthCheckMethodDescriptor, + getHttpHealthCheckMethodDescriptor, + insertHttpHealthCheckMethodDescriptor, + listHttpHealthChecksMethodDescriptor, + patchHttpHealthCheckMethodDescriptor, + updateHttpHealthCheckMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, HttpHealthCheckStubSettings.getDefaultEndpoint()); + + private static HttpHealthCheckClient client; + private static HttpHealthCheckSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + HttpHealthCheckSettings.newBuilder() + .setTransportChannelProvider( + HttpHealthCheckSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = HttpHealthCheckClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteHttpHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHttpHealthCheckName httpHealthCheck = + ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]"); + + Operation actualResponse = client.deleteHttpHealthCheck(httpHealthCheck); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteHttpHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHttpHealthCheckName httpHealthCheck = + ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]"); + + client.deleteHttpHealthCheck(httpHealthCheck); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getHttpHealthCheckTest() { + Integer checkIntervalSec = 345561006; + String kind = "kind3292052"; + String description = "description-1724546052"; + Integer timeoutSec = 2067488653; + String selfLink = "selfLink-1691268851"; + Integer port = 3446913; + String creationTimestamp = "creationTimestamp567396278"; + String host = "host3208616"; + String name = "name3373707"; + Integer unhealthyThreshold = 1838571216; + Integer healthyThreshold = 133658551; + String id = "id3355"; + String requestPath = "requestPath1303145429"; + HttpHealthCheck2 expectedResponse = + HttpHealthCheck2.newBuilder() + .setCheckIntervalSec(checkIntervalSec) + .setKind(kind) + .setDescription(description) + .setTimeoutSec(timeoutSec) + .setSelfLink(selfLink) + .setPort(port) + .setCreationTimestamp(creationTimestamp) + .setHost(host) + .setName(name) + .setUnhealthyThreshold(unhealthyThreshold) + .setHealthyThreshold(healthyThreshold) + .setId(id) + .setRequestPath(requestPath) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHttpHealthCheckName httpHealthCheck = + ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]"); + + HttpHealthCheck2 actualResponse = client.getHttpHealthCheck(httpHealthCheck); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getHttpHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHttpHealthCheckName httpHealthCheck = + ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]"); + + client.getHttpHealthCheck(httpHealthCheck); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertHttpHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build(); + + Operation actualResponse = client.insertHttpHealthCheck(project, httpHealthCheckResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertHttpHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build(); + + client.insertHttpHealthCheck(project, httpHealthCheckResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listHttpHealthChecksTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + HttpHealthCheck2 itemsElement = HttpHealthCheck2.newBuilder().build(); + List items = Arrays.asList(itemsElement); + HttpHealthCheckList expectedResponse = + HttpHealthCheckList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListHttpHealthChecksPagedResponse pagedListResponse = client.listHttpHealthChecks(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listHttpHealthChecksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listHttpHealthChecks(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchHttpHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHttpHealthCheckName httpHealthCheck = + ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]"); + HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build(); + + Operation actualResponse = + client.patchHttpHealthCheck(httpHealthCheck, httpHealthCheckResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchHttpHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHttpHealthCheckName httpHealthCheck = + ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]"); + HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build(); + + client.patchHttpHealthCheck(httpHealthCheck, httpHealthCheckResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateHttpHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHttpHealthCheckName httpHealthCheck = + ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]"); + HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build(); + + Operation actualResponse = + client.updateHttpHealthCheck(httpHealthCheck, httpHealthCheckResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateHttpHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHttpHealthCheckName httpHealthCheck = + ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]"); + HttpHealthCheck2 httpHealthCheckResource = HttpHealthCheck2.newBuilder().build(); + + client.updateHttpHealthCheck(httpHealthCheck, httpHealthCheckResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/HttpsHealthCheckClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/HttpsHealthCheckClientTest.java new file mode 100644 index 000000000000..96074104aa2a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/HttpsHealthCheckClientTest.java @@ -0,0 +1,588 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.HttpsHealthCheckClient.ListHttpsHealthChecksPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpsHealthCheckStub.deleteHttpsHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpsHealthCheckStub.getHttpsHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpsHealthCheckStub.insertHttpsHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpsHealthCheckStub.listHttpsHealthChecksMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpsHealthCheckStub.patchHttpsHealthCheckMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonHttpsHealthCheckStub.updateHttpsHealthCheckMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.HttpsHealthCheckStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class HttpsHealthCheckClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteHttpsHealthCheckMethodDescriptor, + getHttpsHealthCheckMethodDescriptor, + insertHttpsHealthCheckMethodDescriptor, + listHttpsHealthChecksMethodDescriptor, + patchHttpsHealthCheckMethodDescriptor, + updateHttpsHealthCheckMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, HttpsHealthCheckStubSettings.getDefaultEndpoint()); + + private static HttpsHealthCheckClient client; + private static HttpsHealthCheckSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + HttpsHealthCheckSettings.newBuilder() + .setTransportChannelProvider( + HttpsHealthCheckSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = HttpsHealthCheckClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteHttpsHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHttpsHealthCheckName httpsHealthCheck = + ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]"); + + Operation actualResponse = client.deleteHttpsHealthCheck(httpsHealthCheck); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteHttpsHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHttpsHealthCheckName httpsHealthCheck = + ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]"); + + client.deleteHttpsHealthCheck(httpsHealthCheck); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getHttpsHealthCheckTest() { + Integer checkIntervalSec = 345561006; + String kind = "kind3292052"; + String description = "description-1724546052"; + Integer timeoutSec = 2067488653; + String selfLink = "selfLink-1691268851"; + Integer port = 3446913; + String creationTimestamp = "creationTimestamp567396278"; + String host = "host3208616"; + String name = "name3373707"; + Integer unhealthyThreshold = 1838571216; + Integer healthyThreshold = 133658551; + String id = "id3355"; + String requestPath = "requestPath1303145429"; + HttpsHealthCheck2 expectedResponse = + HttpsHealthCheck2.newBuilder() + .setCheckIntervalSec(checkIntervalSec) + .setKind(kind) + .setDescription(description) + .setTimeoutSec(timeoutSec) + .setSelfLink(selfLink) + .setPort(port) + .setCreationTimestamp(creationTimestamp) + .setHost(host) + .setName(name) + .setUnhealthyThreshold(unhealthyThreshold) + .setHealthyThreshold(healthyThreshold) + .setId(id) + .setRequestPath(requestPath) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHttpsHealthCheckName httpsHealthCheck = + ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]"); + + HttpsHealthCheck2 actualResponse = client.getHttpsHealthCheck(httpsHealthCheck); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getHttpsHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHttpsHealthCheckName httpsHealthCheck = + ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]"); + + client.getHttpsHealthCheck(httpsHealthCheck); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertHttpsHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build(); + + Operation actualResponse = client.insertHttpsHealthCheck(project, httpsHealthCheckResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertHttpsHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build(); + + client.insertHttpsHealthCheck(project, httpsHealthCheckResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listHttpsHealthChecksTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + HttpsHealthCheck2 itemsElement = HttpsHealthCheck2.newBuilder().build(); + List items = Arrays.asList(itemsElement); + HttpsHealthCheckList expectedResponse = + HttpsHealthCheckList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListHttpsHealthChecksPagedResponse pagedListResponse = client.listHttpsHealthChecks(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listHttpsHealthChecksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listHttpsHealthChecks(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchHttpsHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHttpsHealthCheckName httpsHealthCheck = + ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]"); + HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build(); + + Operation actualResponse = + client.patchHttpsHealthCheck(httpsHealthCheck, httpsHealthCheckResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchHttpsHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHttpsHealthCheckName httpsHealthCheck = + ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]"); + HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build(); + + client.patchHttpsHealthCheck(httpsHealthCheck, httpsHealthCheckResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateHttpsHealthCheckTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalHttpsHealthCheckName httpsHealthCheck = + ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]"); + HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build(); + + Operation actualResponse = + client.updateHttpsHealthCheck(httpsHealthCheck, httpsHealthCheckResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateHttpsHealthCheckExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalHttpsHealthCheckName httpsHealthCheck = + ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]"); + HttpsHealthCheck2 httpsHealthCheckResource = HttpsHealthCheck2.newBuilder().build(); + + client.updateHttpsHealthCheck(httpsHealthCheck, httpsHealthCheckResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ImageClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ImageClientTest.java new file mode 100644 index 000000000000..63dab8cb15df --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ImageClientTest.java @@ -0,0 +1,679 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.ImageClient.ListImagesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonImageStub.deleteImageMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonImageStub.deprecateImageMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonImageStub.getFromFamilyImageMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonImageStub.getImageMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonImageStub.insertImageMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonImageStub.listImagesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonImageStub.setLabelsImageMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.ImageStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class ImageClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteImageMethodDescriptor, + deprecateImageMethodDescriptor, + getImageMethodDescriptor, + getFromFamilyImageMethodDescriptor, + insertImageMethodDescriptor, + listImagesMethodDescriptor, + setLabelsImageMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, ImageStubSettings.getDefaultEndpoint()); + + private static ImageClient client; + private static ImageSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + ImageSettings.newBuilder() + .setTransportChannelProvider( + ImageSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ImageClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteImageTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]"); + + Operation actualResponse = client.deleteImage(image); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteImageExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]"); + + client.deleteImage(image); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deprecateImageTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]"); + DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build(); + + Operation actualResponse = client.deprecateImage(image, deprecationStatusResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deprecateImageExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]"); + DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build(); + + client.deprecateImage(image, deprecationStatusResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getImageTest() { + String sourceSnapshotId = "sourceSnapshotId-1511650478"; + String description = "description-1724546052"; + String sourceSnapshot = "sourceSnapshot-947679896"; + String labelFingerprint = "labelFingerprint714995737"; + String creationTimestamp = "creationTimestamp567396278"; + String id = "id3355"; + String sourceDisk = "sourceDisk-85117119"; + String sourceDiskId = "sourceDiskId-1693292839"; + String sourceImageId = "sourceImageId-2092155357"; + String kind = "kind3292052"; + String selfLink = "selfLink-1691268851"; + String sourceType = "sourceType-84625186"; + String name = "name3373707"; + String archiveSizeBytes = "archiveSizeBytes-1766390198"; + String sourceImage = "sourceImage1661056055"; + ProjectGlobalImageFamilyName family = ProjectGlobalImageFamilyName.of("[PROJECT]", "[FAMILY]"); + String diskSizeGb = "diskSizeGb-757478089"; + String status = "status-892481550"; + Image expectedResponse = + Image.newBuilder() + .setSourceSnapshotId(sourceSnapshotId) + .setDescription(description) + .setSourceSnapshot(sourceSnapshot) + .setLabelFingerprint(labelFingerprint) + .setCreationTimestamp(creationTimestamp) + .setId(id) + .setSourceDisk(sourceDisk) + .setSourceDiskId(sourceDiskId) + .setSourceImageId(sourceImageId) + .setKind(kind) + .setSelfLink(selfLink) + .setSourceType(sourceType) + .setName(name) + .setArchiveSizeBytes(archiveSizeBytes) + .setSourceImage(sourceImage) + .setFamily(family.toString()) + .setDiskSizeGb(diskSizeGb) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]"); + + Image actualResponse = client.getImage(image); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getImageExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]"); + + client.getImage(image); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getFromFamilyImageTest() { + String sourceSnapshotId = "sourceSnapshotId-1511650478"; + String description = "description-1724546052"; + String sourceSnapshot = "sourceSnapshot-947679896"; + String labelFingerprint = "labelFingerprint714995737"; + String creationTimestamp = "creationTimestamp567396278"; + String id = "id3355"; + String sourceDisk = "sourceDisk-85117119"; + String sourceDiskId = "sourceDiskId-1693292839"; + String sourceImageId = "sourceImageId-2092155357"; + String kind = "kind3292052"; + String selfLink = "selfLink-1691268851"; + String sourceType = "sourceType-84625186"; + String name = "name3373707"; + String archiveSizeBytes = "archiveSizeBytes-1766390198"; + String sourceImage = "sourceImage1661056055"; + ProjectGlobalImageFamilyName family2 = ProjectGlobalImageFamilyName.of("[PROJECT]", "[FAMILY]"); + String diskSizeGb = "diskSizeGb-757478089"; + String status = "status-892481550"; + Image expectedResponse = + Image.newBuilder() + .setSourceSnapshotId(sourceSnapshotId) + .setDescription(description) + .setSourceSnapshot(sourceSnapshot) + .setLabelFingerprint(labelFingerprint) + .setCreationTimestamp(creationTimestamp) + .setId(id) + .setSourceDisk(sourceDisk) + .setSourceDiskId(sourceDiskId) + .setSourceImageId(sourceImageId) + .setKind(kind) + .setSelfLink(selfLink) + .setSourceType(sourceType) + .setName(name) + .setArchiveSizeBytes(archiveSizeBytes) + .setSourceImage(sourceImage) + .setFamily(family2.toString()) + .setDiskSizeGb(diskSizeGb) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalImageFamilyName family = ProjectGlobalImageFamilyName.of("[PROJECT]", "[FAMILY]"); + + Image actualResponse = client.getFromFamilyImage(family); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getFromFamilyImageExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalImageFamilyName family = + ProjectGlobalImageFamilyName.of("[PROJECT]", "[FAMILY]"); + + client.getFromFamilyImage(family); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertImageTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + Boolean forceCreate = true; + ProjectName project = ProjectName.of("[PROJECT]"); + Image imageResource = Image.newBuilder().build(); + + Operation actualResponse = client.insertImage(forceCreate, project, imageResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertImageExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Boolean forceCreate = true; + ProjectName project = ProjectName.of("[PROJECT]"); + Image imageResource = Image.newBuilder().build(); + + client.insertImage(forceCreate, project, imageResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listImagesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Image itemsElement = Image.newBuilder().build(); + List items = Arrays.asList(itemsElement); + ImageList expectedResponse = + ImageList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListImagesPagedResponse pagedListResponse = client.listImages(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listImagesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listImages(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setLabelsImageTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalImageResourceName resource = + ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]"); + GlobalSetLabelsRequest globalSetLabelsRequestResource = + GlobalSetLabelsRequest.newBuilder().build(); + + Operation actualResponse = client.setLabelsImage(resource, globalSetLabelsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setLabelsImageExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalImageResourceName resource = + ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]"); + GlobalSetLabelsRequest globalSetLabelsRequestResource = + GlobalSetLabelsRequest.newBuilder().build(); + + client.setLabelsImage(resource, globalSetLabelsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceClientTest.java new file mode 100644 index 000000000000..e576cbe14404 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceClientTest.java @@ -0,0 +1,2513 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InstanceClient.AggregatedListInstancesPagedResponse; +import static com.google.cloud.compute.v1.InstanceClient.ListInstancesPagedResponse; +import static com.google.cloud.compute.v1.InstanceClient.ListReferrersInstancesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.addAccessConfigInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.aggregatedListInstancesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.attachDiskInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.deleteAccessConfigInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.deleteInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.detachDiskInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.getInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.getSerialPortOutputInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.insertInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.listInstancesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.listReferrersInstancesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.resetInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.setDeletionProtectionInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.setDiskAutoDeleteInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.setLabelsInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.setMachineResourcesInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.setMachineTypeInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.setMetadataInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.setMinCpuPlatformInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.setSchedulingInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.setServiceAccountInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.setTagsInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.startInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.startWithEncryptionKeyInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.stopInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.updateAccessConfigInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceStub.updateNetworkInterfaceInstanceMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.InstanceStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class InstanceClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + addAccessConfigInstanceMethodDescriptor, + aggregatedListInstancesMethodDescriptor, + attachDiskInstanceMethodDescriptor, + deleteInstanceMethodDescriptor, + deleteAccessConfigInstanceMethodDescriptor, + detachDiskInstanceMethodDescriptor, + getInstanceMethodDescriptor, + getSerialPortOutputInstanceMethodDescriptor, + insertInstanceMethodDescriptor, + listInstancesMethodDescriptor, + listReferrersInstancesMethodDescriptor, + resetInstanceMethodDescriptor, + setDeletionProtectionInstanceMethodDescriptor, + setDiskAutoDeleteInstanceMethodDescriptor, + setLabelsInstanceMethodDescriptor, + setMachineResourcesInstanceMethodDescriptor, + setMachineTypeInstanceMethodDescriptor, + setMetadataInstanceMethodDescriptor, + setMinCpuPlatformInstanceMethodDescriptor, + setSchedulingInstanceMethodDescriptor, + setServiceAccountInstanceMethodDescriptor, + setTagsInstanceMethodDescriptor, + startInstanceMethodDescriptor, + startWithEncryptionKeyInstanceMethodDescriptor, + stopInstanceMethodDescriptor, + updateAccessConfigInstanceMethodDescriptor, + updateNetworkInterfaceInstanceMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, InstanceStubSettings.getDefaultEndpoint()); + + private static InstanceClient client; + private static InstanceSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + InstanceSettings.newBuilder() + .setTransportChannelProvider( + InstanceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = InstanceClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void addAccessConfigInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + String networkInterface = "networkInterface902258792"; + AccessConfig accessConfigResource = AccessConfig.newBuilder().build(); + + Operation actualResponse = + client.addAccessConfigInstance(instance, networkInterface, accessConfigResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void addAccessConfigInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + String networkInterface = "networkInterface902258792"; + AccessConfig accessConfigResource = AccessConfig.newBuilder().build(); + + client.addAccessConfigInstance(instance, networkInterface, accessConfigResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void aggregatedListInstancesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InstancesScopedList itemsItem = InstancesScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + InstanceAggregatedList expectedResponse = + InstanceAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListInstancesPagedResponse pagedListResponse = + client.aggregatedListInstances(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListInstancesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListInstances(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void attachDiskInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Boolean forceAttach = false; + AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build(); + + Operation actualResponse = + client.attachDiskInstance(instance, forceAttach, attachedDiskResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void attachDiskInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Boolean forceAttach = false; + AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build(); + + client.attachDiskInstance(instance, forceAttach, attachedDiskResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + Operation actualResponse = client.deleteInstance(instance); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + client.deleteInstance(instance); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteAccessConfigInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + String networkInterface = "networkInterface902258792"; + String accessConfig = "accessConfig-464014723"; + + Operation actualResponse = + client.deleteAccessConfigInstance(instance, networkInterface, accessConfig); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteAccessConfigInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + String networkInterface = "networkInterface902258792"; + String accessConfig = "accessConfig-464014723"; + + client.deleteAccessConfigInstance(instance, networkInterface, accessConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void detachDiskInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + String deviceName = "deviceName-1543071020"; + + Operation actualResponse = client.detachDiskInstance(instance, deviceName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void detachDiskInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + String deviceName = "deviceName-1543071020"; + + client.detachDiskInstance(instance, deviceName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getInstanceTest() { + Boolean canIpForward = true; + String kind = "kind3292052"; + String description = "description-1724546052"; + String cpuPlatform = "cpuPlatform947156266"; + Boolean startRestricted = true; + String labelFingerprint = "labelFingerprint714995737"; + String statusMessage = "statusMessage-239442758"; + Boolean deletionProtection = true; + String selfLink = "selfLink-1691268851"; + String minCpuPlatform = "minCpuPlatform-1367699977"; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + ProjectZoneMachineTypeName machineType = + ProjectZoneMachineTypeName.of("[PROJECT]", "[ZONE]", "[MACHINE_TYPE]"); + String status = "status-892481550"; + Instance expectedResponse = + Instance.newBuilder() + .setCanIpForward(canIpForward) + .setKind(kind) + .setDescription(description) + .setCpuPlatform(cpuPlatform) + .setStartRestricted(startRestricted) + .setLabelFingerprint(labelFingerprint) + .setStatusMessage(statusMessage) + .setDeletionProtection(deletionProtection) + .setSelfLink(selfLink) + .setMinCpuPlatform(minCpuPlatform) + .setZone(zone.toString()) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .setMachineType(machineType.toString()) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + Instance actualResponse = client.getInstance(instance); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + client.getInstance(instance); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getSerialPortOutputInstanceTest() { + String next = "next3377907"; + String contents = "contents-567321830"; + String kind = "kind3292052"; + String start2 = "start2-1897185387"; + String selfLink = "selfLink-1691268851"; + SerialPortOutput expectedResponse = + SerialPortOutput.newBuilder() + .setNext(next) + .setContents(contents) + .setKind(kind) + .setStart(start2) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Integer port = 3446913; + String start = "start109757538"; + + SerialPortOutput actualResponse = client.getSerialPortOutputInstance(instance, port, start); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getSerialPortOutputInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Integer port = 3446913; + String start = "start109757538"; + + client.getSerialPortOutputInstance(instance, port, start); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone2 = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone2.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + Instance instanceResource = Instance.newBuilder().build(); + + Operation actualResponse = client.insertInstance(zone, instanceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + Instance instanceResource = Instance.newBuilder().build(); + + client.insertInstance(zone, instanceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listInstancesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Instance itemsElement = Instance.newBuilder().build(); + List items = Arrays.asList(itemsElement); + InstanceList expectedResponse = + InstanceList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + ListInstancesPagedResponse pagedListResponse = client.listInstances(zone); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listInstancesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + client.listInstances(zone); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listReferrersInstancesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Reference itemsElement = Reference.newBuilder().build(); + List items = Arrays.asList(itemsElement); + InstanceListReferrers expectedResponse = + InstanceListReferrers.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + ListReferrersInstancesPagedResponse pagedListResponse = client.listReferrersInstances(instance); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listReferrersInstancesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + client.listReferrersInstances(instance); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void resetInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + Operation actualResponse = client.resetInstance(instance); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void resetInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + client.resetInstance(instance); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setDeletionProtectionInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceResourceName resource = + ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]"); + Boolean deletionProtection = true; + + Operation actualResponse = client.setDeletionProtectionInstance(resource, deletionProtection); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setDeletionProtectionInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceResourceName resource = + ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]"); + Boolean deletionProtection = true; + + client.setDeletionProtectionInstance(resource, deletionProtection); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setDiskAutoDeleteInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Boolean autoDelete = false; + String deviceName = "deviceName-1543071020"; + + Operation actualResponse = client.setDiskAutoDeleteInstance(instance, autoDelete, deviceName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setDiskAutoDeleteInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Boolean autoDelete = false; + String deviceName = "deviceName-1543071020"; + + client.setDiskAutoDeleteInstance(instance, autoDelete, deviceName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setLabelsInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesSetLabelsRequest instancesSetLabelsRequestResource = + InstancesSetLabelsRequest.newBuilder().build(); + + Operation actualResponse = + client.setLabelsInstance(instance, instancesSetLabelsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setLabelsInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesSetLabelsRequest instancesSetLabelsRequestResource = + InstancesSetLabelsRequest.newBuilder().build(); + + client.setLabelsInstance(instance, instancesSetLabelsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setMachineResourcesInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource = + InstancesSetMachineResourcesRequest.newBuilder().build(); + + Operation actualResponse = + client.setMachineResourcesInstance(instance, instancesSetMachineResourcesRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setMachineResourcesInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource = + InstancesSetMachineResourcesRequest.newBuilder().build(); + + client.setMachineResourcesInstance(instance, instancesSetMachineResourcesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setMachineTypeInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource = + InstancesSetMachineTypeRequest.newBuilder().build(); + + Operation actualResponse = + client.setMachineTypeInstance(instance, instancesSetMachineTypeRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setMachineTypeInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource = + InstancesSetMachineTypeRequest.newBuilder().build(); + + client.setMachineTypeInstance(instance, instancesSetMachineTypeRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setMetadataInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Metadata metadataResource = Metadata.newBuilder().build(); + + Operation actualResponse = client.setMetadataInstance(instance, metadataResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setMetadataInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Metadata metadataResource = Metadata.newBuilder().build(); + + client.setMetadataInstance(instance, metadataResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setMinCpuPlatformInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource = + InstancesSetMinCpuPlatformRequest.newBuilder().build(); + + Operation actualResponse = + client.setMinCpuPlatformInstance(instance, instancesSetMinCpuPlatformRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setMinCpuPlatformInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource = + InstancesSetMinCpuPlatformRequest.newBuilder().build(); + + client.setMinCpuPlatformInstance(instance, instancesSetMinCpuPlatformRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setSchedulingInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Scheduling schedulingResource = Scheduling.newBuilder().build(); + + Operation actualResponse = client.setSchedulingInstance(instance, schedulingResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setSchedulingInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Scheduling schedulingResource = Scheduling.newBuilder().build(); + + client.setSchedulingInstance(instance, schedulingResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setServiceAccountInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = + InstancesSetServiceAccountRequest.newBuilder().build(); + + Operation actualResponse = + client.setServiceAccountInstance(instance, instancesSetServiceAccountRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setServiceAccountInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = + InstancesSetServiceAccountRequest.newBuilder().build(); + + client.setServiceAccountInstance(instance, instancesSetServiceAccountRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setTagsInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Tags tagsResource = Tags.newBuilder().build(); + + Operation actualResponse = client.setTagsInstance(instance, tagsResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setTagsInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + Tags tagsResource = Tags.newBuilder().build(); + + client.setTagsInstance(instance, tagsResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void startInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + Operation actualResponse = client.startInstance(instance); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void startInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + client.startInstance(instance); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void startWithEncryptionKeyInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource = + InstancesStartWithEncryptionKeyRequest.newBuilder().build(); + + Operation actualResponse = + client.startWithEncryptionKeyInstance( + instance, instancesStartWithEncryptionKeyRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void startWithEncryptionKeyInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource = + InstancesStartWithEncryptionKeyRequest.newBuilder().build(); + + client.startWithEncryptionKeyInstance( + instance, instancesStartWithEncryptionKeyRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void stopInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + Operation actualResponse = client.stopInstance(instance); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void stopInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + + client.stopInstance(instance); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateAccessConfigInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + String networkInterface = "networkInterface902258792"; + AccessConfig accessConfigResource = AccessConfig.newBuilder().build(); + + Operation actualResponse = + client.updateAccessConfigInstance(instance, networkInterface, accessConfigResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateAccessConfigInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + String networkInterface = "networkInterface902258792"; + AccessConfig accessConfigResource = AccessConfig.newBuilder().build(); + + client.updateAccessConfigInstance(instance, networkInterface, accessConfigResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateNetworkInterfaceInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + String networkInterface = "networkInterface902258792"; + NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build(); + + Operation actualResponse = + client.updateNetworkInterfaceInstance(instance, networkInterface, networkInterfaceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateNetworkInterfaceInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + String networkInterface = "networkInterface902258792"; + NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build(); + + client.updateNetworkInterfaceInstance(instance, networkInterface, networkInterfaceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceGroupClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceGroupClientTest.java new file mode 100644 index 000000000000..9bb04f730750 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceGroupClientTest.java @@ -0,0 +1,830 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InstanceGroupClient.AggregatedListInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupClient.ListInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupClient.ListInstancesInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupStub.addInstancesInstanceGroupMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupStub.aggregatedListInstanceGroupsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupStub.deleteInstanceGroupMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupStub.getInstanceGroupMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupStub.insertInstanceGroupMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupStub.listInstanceGroupsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupStub.listInstancesInstanceGroupsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupStub.removeInstancesInstanceGroupMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupStub.setNamedPortsInstanceGroupMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.InstanceGroupStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class InstanceGroupClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + addInstancesInstanceGroupMethodDescriptor, + aggregatedListInstanceGroupsMethodDescriptor, + deleteInstanceGroupMethodDescriptor, + getInstanceGroupMethodDescriptor, + insertInstanceGroupMethodDescriptor, + listInstanceGroupsMethodDescriptor, + listInstancesInstanceGroupsMethodDescriptor, + removeInstancesInstanceGroupMethodDescriptor, + setNamedPortsInstanceGroupMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, InstanceGroupStubSettings.getDefaultEndpoint()); + + private static InstanceGroupClient client; + private static InstanceGroupSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + InstanceGroupSettings.newBuilder() + .setTransportChannelProvider( + InstanceGroupSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = InstanceGroupClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void addInstancesInstanceGroupTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource = + InstanceGroupsAddInstancesRequest.newBuilder().build(); + + Operation actualResponse = + client.addInstancesInstanceGroup(instanceGroup, instanceGroupsAddInstancesRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void addInstancesInstanceGroupExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource = + InstanceGroupsAddInstancesRequest.newBuilder().build(); + + client.addInstancesInstanceGroup(instanceGroup, instanceGroupsAddInstancesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void aggregatedListInstanceGroupsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InstanceGroupsScopedList itemsItem = InstanceGroupsScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + InstanceGroupAggregatedList expectedResponse = + InstanceGroupAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListInstanceGroupsPagedResponse pagedListResponse = + client.aggregatedListInstanceGroups(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListInstanceGroupsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListInstanceGroups(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteInstanceGroupTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + + Operation actualResponse = client.deleteInstanceGroup(instanceGroup); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteInstanceGroupExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + + client.deleteInstanceGroup(instanceGroup); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getInstanceGroupTest() { + String kind = "kind3292052"; + String description = "description-1724546052"; + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + String selfLink = "selfLink-1691268851"; + Integer size = 3530753; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + String creationTimestamp = "creationTimestamp567396278"; + String fingerprint = "fingerprint-1375934236"; + String name = "name3373707"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + InstanceGroup expectedResponse = + InstanceGroup.newBuilder() + .setKind(kind) + .setDescription(description) + .setNetwork(network.toString()) + .setSelfLink(selfLink) + .setSize(size) + .setZone(zone.toString()) + .setSubnetwork(subnetwork.toString()) + .setCreationTimestamp(creationTimestamp) + .setFingerprint(fingerprint) + .setName(name) + .setId(id) + .setRegion(region.toString()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + + InstanceGroup actualResponse = client.getInstanceGroup(instanceGroup); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getInstanceGroupExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + + client.getInstanceGroup(instanceGroup); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertInstanceGroupTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone2 = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone2.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build(); + + Operation actualResponse = client.insertInstanceGroup(zone, instanceGroupResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertInstanceGroupExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build(); + + client.insertInstanceGroup(zone, instanceGroupResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listInstanceGroupsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InstanceGroup itemsElement = InstanceGroup.newBuilder().build(); + List items = Arrays.asList(itemsElement); + InstanceGroupList expectedResponse = + InstanceGroupList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + ListInstanceGroupsPagedResponse pagedListResponse = client.listInstanceGroups(zone); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listInstanceGroupsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + client.listInstanceGroups(zone); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listInstancesInstanceGroupsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InstanceWithNamedPorts itemsElement = InstanceWithNamedPorts.newBuilder().build(); + List items = Arrays.asList(itemsElement); + InstanceGroupsListInstances expectedResponse = + InstanceGroupsListInstances.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource = + InstanceGroupsListInstancesRequest.newBuilder().build(); + + ListInstancesInstanceGroupsPagedResponse pagedListResponse = + client.listInstancesInstanceGroups( + instanceGroup, instanceGroupsListInstancesRequestResource); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listInstancesInstanceGroupsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource = + InstanceGroupsListInstancesRequest.newBuilder().build(); + + client.listInstancesInstanceGroups(instanceGroup, instanceGroupsListInstancesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void removeInstancesInstanceGroupTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource = + InstanceGroupsRemoveInstancesRequest.newBuilder().build(); + + Operation actualResponse = + client.removeInstancesInstanceGroup( + instanceGroup, instanceGroupsRemoveInstancesRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void removeInstancesInstanceGroupExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource = + InstanceGroupsRemoveInstancesRequest.newBuilder().build(); + + client.removeInstancesInstanceGroup( + instanceGroup, instanceGroupsRemoveInstancesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setNamedPortsInstanceGroupTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource = + InstanceGroupsSetNamedPortsRequest.newBuilder().build(); + + Operation actualResponse = + client.setNamedPortsInstanceGroup( + instanceGroup, instanceGroupsSetNamedPortsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setNamedPortsInstanceGroupExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource = + InstanceGroupsSetNamedPortsRequest.newBuilder().build(); + + client.setNamedPortsInstanceGroup(instanceGroup, instanceGroupsSetNamedPortsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceGroupManagerClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceGroupManagerClientTest.java new file mode 100644 index 000000000000..617333dead3e --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceGroupManagerClientTest.java @@ -0,0 +1,1121 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse; +import static com.google.cloud.compute.v1.InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.abandonInstancesInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.aggregatedListInstanceGroupManagersMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.deleteInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.deleteInstancesInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.getInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.insertInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.listInstanceGroupManagersMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.listManagedInstancesInstanceGroupManagersMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.recreateInstancesInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.resizeInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.setInstanceTemplateInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceGroupManagerStub.setTargetPoolsInstanceGroupManagerMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.InstanceGroupManagerStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class InstanceGroupManagerClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + abandonInstancesInstanceGroupManagerMethodDescriptor, + aggregatedListInstanceGroupManagersMethodDescriptor, + deleteInstanceGroupManagerMethodDescriptor, + deleteInstancesInstanceGroupManagerMethodDescriptor, + getInstanceGroupManagerMethodDescriptor, + insertInstanceGroupManagerMethodDescriptor, + listInstanceGroupManagersMethodDescriptor, + listManagedInstancesInstanceGroupManagersMethodDescriptor, + recreateInstancesInstanceGroupManagerMethodDescriptor, + resizeInstanceGroupManagerMethodDescriptor, + setInstanceTemplateInstanceGroupManagerMethodDescriptor, + setTargetPoolsInstanceGroupManagerMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService( + METHOD_DESCRIPTORS, InstanceGroupManagerStubSettings.getDefaultEndpoint()); + + private static InstanceGroupManagerClient client; + private static InstanceGroupManagerSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + InstanceGroupManagerSettings.newBuilder() + .setTransportChannelProvider( + InstanceGroupManagerSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = InstanceGroupManagerClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void abandonInstancesInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + InstanceGroupManagersAbandonInstancesRequest + instanceGroupManagersAbandonInstancesRequestResource = + InstanceGroupManagersAbandonInstancesRequest.newBuilder().build(); + + Operation actualResponse = + client.abandonInstancesInstanceGroupManager( + instanceGroupManager, instanceGroupManagersAbandonInstancesRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void abandonInstancesInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + InstanceGroupManagersAbandonInstancesRequest + instanceGroupManagersAbandonInstancesRequestResource = + InstanceGroupManagersAbandonInstancesRequest.newBuilder().build(); + + client.abandonInstancesInstanceGroupManager( + instanceGroupManager, instanceGroupManagersAbandonInstancesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void aggregatedListInstanceGroupManagersTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InstanceGroupManagersScopedList itemsItem = + InstanceGroupManagersScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + InstanceGroupManagerAggregatedList expectedResponse = + InstanceGroupManagerAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListInstanceGroupManagersPagedResponse pagedListResponse = + client.aggregatedListInstanceGroupManagers(project); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListInstanceGroupManagersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListInstanceGroupManagers(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + + Operation actualResponse = client.deleteInstanceGroupManager(instanceGroupManager); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + + client.deleteInstanceGroupManager(instanceGroupManager); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteInstancesInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + InstanceGroupManagersDeleteInstancesRequest + instanceGroupManagersDeleteInstancesRequestResource = + InstanceGroupManagersDeleteInstancesRequest.newBuilder().build(); + + Operation actualResponse = + client.deleteInstancesInstanceGroupManager( + instanceGroupManager, instanceGroupManagersDeleteInstancesRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteInstancesInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + InstanceGroupManagersDeleteInstancesRequest + instanceGroupManagersDeleteInstancesRequestResource = + InstanceGroupManagersDeleteInstancesRequest.newBuilder().build(); + + client.deleteInstancesInstanceGroupManager( + instanceGroupManager, instanceGroupManagersDeleteInstancesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getInstanceGroupManagerTest() { + ProjectGlobalInstanceTemplateName instanceTemplate = + ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]"); + String kind = "kind3292052"; + String description = "description-1724546052"; + String baseInstanceName = "baseInstanceName389106439"; + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + String selfLink = "selfLink-1691268851"; + Integer targetSize = 2084603409; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String creationTimestamp = "creationTimestamp567396278"; + String fingerprint = "fingerprint-1375934236"; + String name = "name3373707"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + InstanceGroupManager expectedResponse = + InstanceGroupManager.newBuilder() + .setInstanceTemplate(instanceTemplate.toString()) + .setKind(kind) + .setDescription(description) + .setBaseInstanceName(baseInstanceName) + .setInstanceGroup(instanceGroup.toString()) + .setSelfLink(selfLink) + .setTargetSize(targetSize) + .setZone(zone.toString()) + .setCreationTimestamp(creationTimestamp) + .setFingerprint(fingerprint) + .setName(name) + .setId(id) + .setRegion(region.toString()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + + InstanceGroupManager actualResponse = client.getInstanceGroupManager(instanceGroupManager); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + + client.getInstanceGroupManager(instanceGroupManager); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone2 = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone2.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build(); + + Operation actualResponse = + client.insertInstanceGroupManager(zone, instanceGroupManagerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build(); + + client.insertInstanceGroupManager(zone, instanceGroupManagerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listInstanceGroupManagersTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InstanceGroupManager itemsElement = InstanceGroupManager.newBuilder().build(); + List items = Arrays.asList(itemsElement); + InstanceGroupManagerList expectedResponse = + InstanceGroupManagerList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + ListInstanceGroupManagersPagedResponse pagedListResponse = + client.listInstanceGroupManagers(zone); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listInstanceGroupManagersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + client.listInstanceGroupManagers(zone); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listManagedInstancesInstanceGroupManagersTest() { + InstanceGroupManagersListManagedInstancesResponse expectedResponse = + InstanceGroupManagersListManagedInstancesResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + + InstanceGroupManagersListManagedInstancesResponse actualResponse = + client.listManagedInstancesInstanceGroupManagers(instanceGroupManager); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listManagedInstancesInstanceGroupManagersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + + client.listManagedInstancesInstanceGroupManagers(instanceGroupManager); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void recreateInstancesInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + InstanceGroupManagersRecreateInstancesRequest + instanceGroupManagersRecreateInstancesRequestResource = + InstanceGroupManagersRecreateInstancesRequest.newBuilder().build(); + + Operation actualResponse = + client.recreateInstancesInstanceGroupManager( + instanceGroupManager, instanceGroupManagersRecreateInstancesRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void recreateInstancesInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + InstanceGroupManagersRecreateInstancesRequest + instanceGroupManagersRecreateInstancesRequestResource = + InstanceGroupManagersRecreateInstancesRequest.newBuilder().build(); + + client.recreateInstancesInstanceGroupManager( + instanceGroupManager, instanceGroupManagersRecreateInstancesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void resizeInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + Integer size = 3530753; + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + + Operation actualResponse = client.resizeInstanceGroupManager(size, instanceGroupManager); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void resizeInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Integer size = 3530753; + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + + client.resizeInstanceGroupManager(size, instanceGroupManager); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setInstanceTemplateInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + InstanceGroupManagersSetInstanceTemplateRequest + instanceGroupManagersSetInstanceTemplateRequestResource = + InstanceGroupManagersSetInstanceTemplateRequest.newBuilder().build(); + + Operation actualResponse = + client.setInstanceTemplateInstanceGroupManager( + instanceGroupManager, instanceGroupManagersSetInstanceTemplateRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setInstanceTemplateInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + InstanceGroupManagersSetInstanceTemplateRequest + instanceGroupManagersSetInstanceTemplateRequestResource = + InstanceGroupManagersSetInstanceTemplateRequest.newBuilder().build(); + + client.setInstanceTemplateInstanceGroupManager( + instanceGroupManager, instanceGroupManagersSetInstanceTemplateRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setTargetPoolsInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource = + InstanceGroupManagersSetTargetPoolsRequest.newBuilder().build(); + + Operation actualResponse = + client.setTargetPoolsInstanceGroupManager( + instanceGroupManager, instanceGroupManagersSetTargetPoolsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setTargetPoolsInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneInstanceGroupManagerName instanceGroupManager = + ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); + InstanceGroupManagersSetTargetPoolsRequest + instanceGroupManagersSetTargetPoolsRequestResource = + InstanceGroupManagersSetTargetPoolsRequest.newBuilder().build(); + + client.setTargetPoolsInstanceGroupManager( + instanceGroupManager, instanceGroupManagersSetTargetPoolsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceTemplateClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceTemplateClientTest.java new file mode 100644 index 000000000000..527b6564efea --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceTemplateClientTest.java @@ -0,0 +1,384 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InstanceTemplateClient.ListInstanceTemplatesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceTemplateStub.deleteInstanceTemplateMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceTemplateStub.getInstanceTemplateMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceTemplateStub.insertInstanceTemplateMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInstanceTemplateStub.listInstanceTemplatesMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.InstanceTemplateStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class InstanceTemplateClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteInstanceTemplateMethodDescriptor, + getInstanceTemplateMethodDescriptor, + insertInstanceTemplateMethodDescriptor, + listInstanceTemplatesMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, InstanceTemplateStubSettings.getDefaultEndpoint()); + + private static InstanceTemplateClient client; + private static InstanceTemplateSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + InstanceTemplateSettings.newBuilder() + .setTransportChannelProvider( + InstanceTemplateSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = InstanceTemplateClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteInstanceTemplateTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalInstanceTemplateName instanceTemplate = + ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]"); + + Operation actualResponse = client.deleteInstanceTemplate(instanceTemplate); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteInstanceTemplateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalInstanceTemplateName instanceTemplate = + ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]"); + + client.deleteInstanceTemplate(instanceTemplate); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getInstanceTemplateTest() { + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InstanceTemplate expectedResponse = + InstanceTemplate.newBuilder() + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalInstanceTemplateName instanceTemplate = + ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]"); + + InstanceTemplate actualResponse = client.getInstanceTemplate(instanceTemplate); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getInstanceTemplateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalInstanceTemplateName instanceTemplate = + ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]"); + + client.getInstanceTemplate(instanceTemplate); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertInstanceTemplateTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + InstanceTemplate instanceTemplateResource = InstanceTemplate.newBuilder().build(); + + Operation actualResponse = client.insertInstanceTemplate(project, instanceTemplateResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertInstanceTemplateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + InstanceTemplate instanceTemplateResource = InstanceTemplate.newBuilder().build(); + + client.insertInstanceTemplate(project, instanceTemplateResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listInstanceTemplatesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InstanceTemplate itemsElement = InstanceTemplate.newBuilder().build(); + List items = Arrays.asList(itemsElement); + InstanceTemplateList expectedResponse = + InstanceTemplateList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListInstanceTemplatesPagedResponse pagedListResponse = client.listInstanceTemplates(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listInstanceTemplatesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listInstanceTemplates(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectAttachmentClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectAttachmentClientTest.java new file mode 100644 index 000000000000..7bcea70c5530 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectAttachmentClientTest.java @@ -0,0 +1,480 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InterconnectAttachmentClient.AggregatedListInterconnectAttachmentsPagedResponse; +import static com.google.cloud.compute.v1.InterconnectAttachmentClient.ListInterconnectAttachmentsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectAttachmentStub.aggregatedListInterconnectAttachmentsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectAttachmentStub.deleteInterconnectAttachmentMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectAttachmentStub.getInterconnectAttachmentMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectAttachmentStub.insertInterconnectAttachmentMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectAttachmentStub.listInterconnectAttachmentsMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.InterconnectAttachmentStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class InterconnectAttachmentClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListInterconnectAttachmentsMethodDescriptor, + deleteInterconnectAttachmentMethodDescriptor, + getInterconnectAttachmentMethodDescriptor, + insertInterconnectAttachmentMethodDescriptor, + listInterconnectAttachmentsMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService( + METHOD_DESCRIPTORS, InterconnectAttachmentStubSettings.getDefaultEndpoint()); + + private static InterconnectAttachmentClient client; + private static InterconnectAttachmentSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + InterconnectAttachmentSettings.newBuilder() + .setTransportChannelProvider( + InterconnectAttachmentSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = InterconnectAttachmentClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListInterconnectAttachmentsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InterconnectAttachmentsScopedList itemsItem = + InterconnectAttachmentsScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + InterconnectAttachmentAggregatedList expectedResponse = + InterconnectAttachmentAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListInterconnectAttachmentsPagedResponse pagedListResponse = + client.aggregatedListInterconnectAttachments(project); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListInterconnectAttachmentsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListInterconnectAttachments(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteInterconnectAttachmentTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInterconnectAttachmentName interconnectAttachment = + ProjectRegionInterconnectAttachmentName.of( + "[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]"); + + Operation actualResponse = client.deleteInterconnectAttachment(interconnectAttachment); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteInterconnectAttachmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInterconnectAttachmentName interconnectAttachment = + ProjectRegionInterconnectAttachmentName.of( + "[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]"); + + client.deleteInterconnectAttachment(interconnectAttachment); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getInterconnectAttachmentTest() { + String cloudRouterIpAddress = "cloudRouterIpAddress1361134600"; + String operationalStatus = "operationalStatus1274812671"; + String kind = "kind3292052"; + String googleReferenceId = "googleReferenceId534944469"; + String description = "description-1724546052"; + ProjectGlobalInterconnectName interconnect = + ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]"); + String customerRouterIpAddress = "customerRouterIpAddress-741266063"; + String selfLink = "selfLink-1691268851"; + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + InterconnectAttachment expectedResponse = + InterconnectAttachment.newBuilder() + .setCloudRouterIpAddress(cloudRouterIpAddress) + .setOperationalStatus(operationalStatus) + .setKind(kind) + .setGoogleReferenceId(googleReferenceId) + .setDescription(description) + .setInterconnect(interconnect.toString()) + .setCustomerRouterIpAddress(customerRouterIpAddress) + .setSelfLink(selfLink) + .setRouter(router.toString()) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .setRegion(region.toString()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInterconnectAttachmentName interconnectAttachment = + ProjectRegionInterconnectAttachmentName.of( + "[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]"); + + InterconnectAttachment actualResponse = + client.getInterconnectAttachment(interconnectAttachment); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getInterconnectAttachmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInterconnectAttachmentName interconnectAttachment = + ProjectRegionInterconnectAttachmentName.of( + "[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]"); + + client.getInterconnectAttachment(interconnectAttachment); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertInterconnectAttachmentTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + InterconnectAttachment interconnectAttachmentResource = + InterconnectAttachment.newBuilder().build(); + + Operation actualResponse = + client.insertInterconnectAttachment(region, interconnectAttachmentResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertInterconnectAttachmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + InterconnectAttachment interconnectAttachmentResource = + InterconnectAttachment.newBuilder().build(); + + client.insertInterconnectAttachment(region, interconnectAttachmentResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listInterconnectAttachmentsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InterconnectAttachment itemsElement = InterconnectAttachment.newBuilder().build(); + List items = Arrays.asList(itemsElement); + InterconnectAttachmentList expectedResponse = + InterconnectAttachmentList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListInterconnectAttachmentsPagedResponse pagedListResponse = + client.listInterconnectAttachments(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listInterconnectAttachmentsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listInterconnectAttachments(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectClientTest.java new file mode 100644 index 000000000000..d674a8ca33f8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectClientTest.java @@ -0,0 +1,502 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InterconnectClient.ListInterconnectsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectStub.deleteInterconnectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectStub.getInterconnectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectStub.insertInterconnectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectStub.listInterconnectsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectStub.patchInterconnectMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.InterconnectStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class InterconnectClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteInterconnectMethodDescriptor, + getInterconnectMethodDescriptor, + insertInterconnectMethodDescriptor, + listInterconnectsMethodDescriptor, + patchInterconnectMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, InterconnectStubSettings.getDefaultEndpoint()); + + private static InterconnectClient client; + private static InterconnectSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + InterconnectSettings.newBuilder() + .setTransportChannelProvider( + InterconnectSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = InterconnectClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteInterconnectTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalInterconnectName interconnect = + ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]"); + + Operation actualResponse = client.deleteInterconnect(interconnect); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteInterconnectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalInterconnectName interconnect = + ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]"); + + client.deleteInterconnect(interconnect); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getInterconnectTest() { + String operationalStatus = "operationalStatus1274812671"; + String interconnectType = "interconnectType2125777995"; + String peerIpAddress = "peerIpAddress-1939747879"; + String kind = "kind3292052"; + Integer requestedLinkCount = 1118793211; + String googleReferenceId = "googleReferenceId534944469"; + String description = "description-1724546052"; + String customerName = "customerName-2143818164"; + String selfLink = "selfLink-1691268851"; + Boolean adminEnabled = false; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String linkType = "linkType-1624275873"; + String location = "location1901043637"; + Integer provisionedLinkCount = 1199724171; + String id = "id3355"; + String googleIpAddress = "googleIpAddress1516847778"; + String nocContactEmail = "nocContactEmail1087814656"; + Interconnect expectedResponse = + Interconnect.newBuilder() + .setOperationalStatus(operationalStatus) + .setInterconnectType(interconnectType) + .setPeerIpAddress(peerIpAddress) + .setKind(kind) + .setRequestedLinkCount(requestedLinkCount) + .setGoogleReferenceId(googleReferenceId) + .setDescription(description) + .setCustomerName(customerName) + .setSelfLink(selfLink) + .setAdminEnabled(adminEnabled) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setLinkType(linkType) + .setLocation(location) + .setProvisionedLinkCount(provisionedLinkCount) + .setId(id) + .setGoogleIpAddress(googleIpAddress) + .setNocContactEmail(nocContactEmail) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalInterconnectName interconnect = + ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]"); + + Interconnect actualResponse = client.getInterconnect(interconnect); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getInterconnectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalInterconnectName interconnect = + ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]"); + + client.getInterconnect(interconnect); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertInterconnectTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + Interconnect interconnectResource = Interconnect.newBuilder().build(); + + Operation actualResponse = client.insertInterconnect(project, interconnectResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertInterconnectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + Interconnect interconnectResource = Interconnect.newBuilder().build(); + + client.insertInterconnect(project, interconnectResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listInterconnectsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Interconnect itemsElement = Interconnect.newBuilder().build(); + List items = Arrays.asList(itemsElement); + InterconnectList expectedResponse = + InterconnectList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListInterconnectsPagedResponse pagedListResponse = client.listInterconnects(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listInterconnectsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listInterconnects(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchInterconnectTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalInterconnectName interconnect = + ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]"); + Interconnect interconnectResource = Interconnect.newBuilder().build(); + + Operation actualResponse = client.patchInterconnect(interconnect, interconnectResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchInterconnectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalInterconnectName interconnect = + ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]"); + Interconnect interconnectResource = Interconnect.newBuilder().build(); + + client.patchInterconnect(interconnect, interconnectResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectLocationClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectLocationClientTest.java new file mode 100644 index 000000000000..47440e971a95 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectLocationClientTest.java @@ -0,0 +1,215 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.InterconnectLocationClient.ListInterconnectLocationsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectLocationStub.getInterconnectLocationMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonInterconnectLocationStub.listInterconnectLocationsMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.InterconnectLocationStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class InterconnectLocationClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + getInterconnectLocationMethodDescriptor, listInterconnectLocationsMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService( + METHOD_DESCRIPTORS, InterconnectLocationStubSettings.getDefaultEndpoint()); + + private static InterconnectLocationClient client; + private static InterconnectLocationSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + InterconnectLocationSettings.newBuilder() + .setTransportChannelProvider( + InterconnectLocationSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = InterconnectLocationClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void getInterconnectLocationTest() { + String continent = "continent-403427916"; + ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]"); + String city = "city3053931"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String peeringdbFacilityId = "peeringdbFacilityId-303818"; + String availabilityZone = "availabilityZone-378410992"; + String facilityProviderFacilityId = "facilityProviderFacilityId-1523343611"; + String selfLink = "selfLink-1691268851"; + String facilityProvider = "facilityProvider2143916045"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + InterconnectLocation expectedResponse = + InterconnectLocation.newBuilder() + .setContinent(continent) + .setAddress(address.toString()) + .setCity(city) + .setKind(kind) + .setDescription(description) + .setPeeringdbFacilityId(peeringdbFacilityId) + .setAvailabilityZone(availabilityZone) + .setFacilityProviderFacilityId(facilityProviderFacilityId) + .setSelfLink(selfLink) + .setFacilityProvider(facilityProvider) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalInterconnectLocationName interconnectLocation = + ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]"); + + InterconnectLocation actualResponse = client.getInterconnectLocation(interconnectLocation); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getInterconnectLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalInterconnectLocationName interconnectLocation = + ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]"); + + client.getInterconnectLocation(interconnectLocation); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listInterconnectLocationsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InterconnectLocation itemsElement = InterconnectLocation.newBuilder().build(); + List items = Arrays.asList(itemsElement); + InterconnectLocationList expectedResponse = + InterconnectLocationList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListInterconnectLocationsPagedResponse pagedListResponse = + client.listInterconnectLocations(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listInterconnectLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listInterconnectLocations(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/LicenseClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/LicenseClientTest.java new file mode 100644 index 000000000000..e33da4e3c227 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/LicenseClientTest.java @@ -0,0 +1,438 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.LicenseClient.ListLicensesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonLicenseStub.deleteLicenseMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonLicenseStub.getLicenseMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonLicenseStub.insertLicenseMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonLicenseStub.listLicensesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonLicenseStub.testIamPermissionsLicenseMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.LicenseStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class LicenseClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteLicenseMethodDescriptor, + getLicenseMethodDescriptor, + insertLicenseMethodDescriptor, + listLicensesMethodDescriptor, + testIamPermissionsLicenseMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, LicenseStubSettings.getDefaultEndpoint()); + + private static LicenseClient client; + private static LicenseSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + LicenseSettings.newBuilder() + .setTransportChannelProvider( + LicenseSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = LicenseClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteLicenseTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]"); + + Operation actualResponse = client.deleteLicense(license); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteLicenseExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]"); + + client.deleteLicense(license); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getLicenseTest() { + Boolean chargesUseFee = true; + String kind = "kind3292052"; + Boolean transferable = false; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + ProjectGlobalLicenseCodeName licenseCode = + ProjectGlobalLicenseCodeName.of("[PROJECT]", "[LICENSE_CODE]"); + String selfLink = "selfLink-1691268851"; + License expectedResponse = + License.newBuilder() + .setChargesUseFee(chargesUseFee) + .setKind(kind) + .setTransferable(transferable) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setLicenseCode(licenseCode.toString()) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]"); + + License actualResponse = client.getLicense(license); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getLicenseExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]"); + + client.getLicense(license); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertLicenseTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + License licenseResource = License.newBuilder().build(); + + Operation actualResponse = client.insertLicense(project, licenseResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertLicenseExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + License licenseResource = License.newBuilder().build(); + + client.insertLicense(project, licenseResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listLicensesTest() { + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + License itemsElement = License.newBuilder().build(); + List items = Arrays.asList(itemsElement); + LicensesListResponse expectedResponse = + LicensesListResponse.newBuilder() + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListLicensesPagedResponse pagedListResponse = client.listLicenses(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listLicensesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listLicenses(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void testIamPermissionsLicenseTest() { + TestPermissionsResponse expectedResponse = TestPermissionsResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalLicenseResourceName resource = + ProjectGlobalLicenseResourceName.of("[PROJECT]", "[RESOURCE]"); + TestPermissionsRequest testPermissionsRequestResource = + TestPermissionsRequest.newBuilder().build(); + + TestPermissionsResponse actualResponse = + client.testIamPermissionsLicense(resource, testPermissionsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void testIamPermissionsLicenseExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalLicenseResourceName resource = + ProjectGlobalLicenseResourceName.of("[PROJECT]", "[RESOURCE]"); + TestPermissionsRequest testPermissionsRequestResource = + TestPermissionsRequest.newBuilder().build(); + + client.testIamPermissionsLicense(resource, testPermissionsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/LicenseCodeClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/LicenseCodeClientTest.java new file mode 100644 index 000000000000..a6faec2c6fa8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/LicenseCodeClientTest.java @@ -0,0 +1,192 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.stub.HttpJsonLicenseCodeStub.getLicenseCodeMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonLicenseCodeStub.testIamPermissionsLicenseCodeMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.LicenseCodeStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class LicenseCodeClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + getLicenseCodeMethodDescriptor, testIamPermissionsLicenseCodeMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, LicenseCodeStubSettings.getDefaultEndpoint()); + + private static LicenseCodeClient client; + private static LicenseCodeSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + LicenseCodeSettings.newBuilder() + .setTransportChannelProvider( + LicenseCodeSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = LicenseCodeClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void getLicenseCodeTest() { + String kind = "kind3292052"; + Boolean transferable = false; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String state = "state109757585"; + String selfLink = "selfLink-1691268851"; + LicenseCode expectedResponse = + LicenseCode.newBuilder() + .setKind(kind) + .setTransferable(transferable) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setState(state) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalLicenseCodeName licenseCode = + ProjectGlobalLicenseCodeName.of("[PROJECT]", "[LICENSE_CODE]"); + + LicenseCode actualResponse = client.getLicenseCode(licenseCode); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getLicenseCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalLicenseCodeName licenseCode = + ProjectGlobalLicenseCodeName.of("[PROJECT]", "[LICENSE_CODE]"); + + client.getLicenseCode(licenseCode); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void testIamPermissionsLicenseCodeTest() { + TestPermissionsResponse expectedResponse = TestPermissionsResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalLicenseCodeResourceName resource = + ProjectGlobalLicenseCodeResourceName.of("[PROJECT]", "[RESOURCE]"); + TestPermissionsRequest testPermissionsRequestResource = + TestPermissionsRequest.newBuilder().build(); + + TestPermissionsResponse actualResponse = + client.testIamPermissionsLicenseCode(resource, testPermissionsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void testIamPermissionsLicenseCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalLicenseCodeResourceName resource = + ProjectGlobalLicenseCodeResourceName.of("[PROJECT]", "[RESOURCE]"); + TestPermissionsRequest testPermissionsRequestResource = + TestPermissionsRequest.newBuilder().build(); + + client.testIamPermissionsLicenseCode(resource, testPermissionsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/MachineTypeClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/MachineTypeClientTest.java new file mode 100644 index 000000000000..22d06700e10c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/MachineTypeClientTest.java @@ -0,0 +1,282 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.MachineTypeClient.AggregatedListMachineTypesPagedResponse; +import static com.google.cloud.compute.v1.MachineTypeClient.ListMachineTypesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonMachineTypeStub.aggregatedListMachineTypesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonMachineTypeStub.getMachineTypeMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonMachineTypeStub.listMachineTypesMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.MachineTypeStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class MachineTypeClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListMachineTypesMethodDescriptor, + getMachineTypeMethodDescriptor, + listMachineTypesMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, MachineTypeStubSettings.getDefaultEndpoint()); + + private static MachineTypeClient client; + private static MachineTypeSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + MachineTypeSettings.newBuilder() + .setTransportChannelProvider( + MachineTypeSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = MachineTypeClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListMachineTypesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + MachineTypesScopedList itemsItem = MachineTypesScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + MachineTypeAggregatedList expectedResponse = + MachineTypeAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListMachineTypesPagedResponse pagedListResponse = + client.aggregatedListMachineTypes(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListMachineTypesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListMachineTypes(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getMachineTypeTest() { + Boolean isSharedCpu = false; + Integer guestCpus = 1754126894; + String kind = "kind3292052"; + String description = "description-1724546052"; + String selfLink = "selfLink-1691268851"; + Integer memoryMb = 1726613907; + Integer maximumPersistentDisks = 1033091853; + String maximumPersistentDisksSizeGb = "maximumPersistentDisksSizeGb-1993209177"; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + Integer imageSpaceGb = 461539048; + MachineType expectedResponse = + MachineType.newBuilder() + .setIsSharedCpu(isSharedCpu) + .setGuestCpus(guestCpus) + .setKind(kind) + .setDescription(description) + .setSelfLink(selfLink) + .setMemoryMb(memoryMb) + .setMaximumPersistentDisks(maximumPersistentDisks) + .setMaximumPersistentDisksSizeGb(maximumPersistentDisksSizeGb) + .setZone(zone.toString()) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .setImageSpaceGb(imageSpaceGb) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneMachineTypeName machineType = + ProjectZoneMachineTypeName.of("[PROJECT]", "[ZONE]", "[MACHINE_TYPE]"); + + MachineType actualResponse = client.getMachineType(machineType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getMachineTypeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneMachineTypeName machineType = + ProjectZoneMachineTypeName.of("[PROJECT]", "[ZONE]", "[MACHINE_TYPE]"); + + client.getMachineType(machineType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listMachineTypesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + MachineType itemsElement = MachineType.newBuilder().build(); + List items = Arrays.asList(itemsElement); + MachineTypeList expectedResponse = + MachineTypeList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + ListMachineTypesPagedResponse pagedListResponse = client.listMachineTypes(zone); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listMachineTypesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + client.listMachineTypes(zone); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/NetworkClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/NetworkClientTest.java new file mode 100644 index 000000000000..494be4ca7ab1 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/NetworkClientTest.java @@ -0,0 +1,757 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.NetworkClient.ListNetworksPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonNetworkStub.addPeeringNetworkMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonNetworkStub.deleteNetworkMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonNetworkStub.getNetworkMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonNetworkStub.insertNetworkMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonNetworkStub.listNetworksMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonNetworkStub.patchNetworkMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonNetworkStub.removePeeringNetworkMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonNetworkStub.switchToCustomModeNetworkMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.NetworkStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class NetworkClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + addPeeringNetworkMethodDescriptor, + deleteNetworkMethodDescriptor, + getNetworkMethodDescriptor, + insertNetworkMethodDescriptor, + listNetworksMethodDescriptor, + patchNetworkMethodDescriptor, + removePeeringNetworkMethodDescriptor, + switchToCustomModeNetworkMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, NetworkStubSettings.getDefaultEndpoint()); + + private static NetworkClient client; + private static NetworkSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + NetworkSettings.newBuilder() + .setTransportChannelProvider( + NetworkSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = NetworkClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void addPeeringNetworkTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + NetworksAddPeeringRequest networksAddPeeringRequestResource = + NetworksAddPeeringRequest.newBuilder().build(); + + Operation actualResponse = client.addPeeringNetwork(network, networksAddPeeringRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void addPeeringNetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + NetworksAddPeeringRequest networksAddPeeringRequestResource = + NetworksAddPeeringRequest.newBuilder().build(); + + client.addPeeringNetwork(network, networksAddPeeringRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteNetworkTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + + Operation actualResponse = client.deleteNetwork(network); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteNetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + + client.deleteNetwork(network); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getNetworkTest() { + String iPv4Range = "iPv4Range-534892458"; + String kind = "kind3292052"; + Boolean autoCreateSubnetworks = true; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String gatewayIPv4 = "gatewayIPv4-1431933859"; + String selfLink = "selfLink-1691268851"; + Network expectedResponse = + Network.newBuilder() + .setIPv4Range(iPv4Range) + .setKind(kind) + .setAutoCreateSubnetworks(autoCreateSubnetworks) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setGatewayIPv4(gatewayIPv4) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + + Network actualResponse = client.getNetwork(network); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getNetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + + client.getNetwork(network); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertNetworkTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + Network networkResource = Network.newBuilder().build(); + + Operation actualResponse = client.insertNetwork(project, networkResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertNetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + Network networkResource = Network.newBuilder().build(); + + client.insertNetwork(project, networkResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listNetworksTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Network itemsElement = Network.newBuilder().build(); + List items = Arrays.asList(itemsElement); + NetworkList expectedResponse = + NetworkList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListNetworksPagedResponse pagedListResponse = client.listNetworks(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listNetworksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listNetworks(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchNetworkTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + Network networkResource = Network.newBuilder().build(); + + Operation actualResponse = client.patchNetwork(network, networkResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchNetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + Network networkResource = Network.newBuilder().build(); + + client.patchNetwork(network, networkResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void removePeeringNetworkTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + NetworksRemovePeeringRequest networksRemovePeeringRequestResource = + NetworksRemovePeeringRequest.newBuilder().build(); + + Operation actualResponse = + client.removePeeringNetwork(network, networksRemovePeeringRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void removePeeringNetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + NetworksRemovePeeringRequest networksRemovePeeringRequestResource = + NetworksRemovePeeringRequest.newBuilder().build(); + + client.removePeeringNetwork(network, networksRemovePeeringRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void switchToCustomModeNetworkTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + + Operation actualResponse = client.switchToCustomModeNetwork(network); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void switchToCustomModeNetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + + client.switchToCustomModeNetwork(network); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ProjectClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ProjectClientTest.java new file mode 100644 index 000000000000..61824ef3222b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ProjectClientTest.java @@ -0,0 +1,1070 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.ProjectClient.GetXpnResourcesProjectsPagedResponse; +import static com.google.cloud.compute.v1.ProjectClient.ListXpnHostsProjectsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.disableXpnHostProjectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.disableXpnResourceProjectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.enableXpnHostProjectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.enableXpnResourceProjectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.getProjectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.getXpnHostProjectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.getXpnResourcesProjectsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.listXpnHostsProjectsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.moveDiskProjectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.moveInstanceProjectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.setCommonInstanceMetadataProjectMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonProjectStub.setUsageExportBucketProjectMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.ProjectStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class ProjectClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + disableXpnHostProjectMethodDescriptor, + disableXpnResourceProjectMethodDescriptor, + enableXpnHostProjectMethodDescriptor, + enableXpnResourceProjectMethodDescriptor, + getProjectMethodDescriptor, + getXpnHostProjectMethodDescriptor, + getXpnResourcesProjectsMethodDescriptor, + listXpnHostsProjectsMethodDescriptor, + moveDiskProjectMethodDescriptor, + moveInstanceProjectMethodDescriptor, + setCommonInstanceMetadataProjectMethodDescriptor, + setUsageExportBucketProjectMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, ProjectStubSettings.getDefaultEndpoint()); + + private static ProjectClient client; + private static ProjectSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + ProjectSettings.newBuilder() + .setTransportChannelProvider( + ProjectSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ProjectClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void disableXpnHostProjectTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + Operation actualResponse = client.disableXpnHostProject(project); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void disableXpnHostProjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.disableXpnHostProject(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void disableXpnResourceProjectTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource = + ProjectsDisableXpnResourceRequest.newBuilder().build(); + + Operation actualResponse = + client.disableXpnResourceProject(project, projectsDisableXpnResourceRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void disableXpnResourceProjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource = + ProjectsDisableXpnResourceRequest.newBuilder().build(); + + client.disableXpnResourceProject(project, projectsDisableXpnResourceRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void enableXpnHostProjectTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + Operation actualResponse = client.enableXpnHostProject(project); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void enableXpnHostProjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.enableXpnHostProject(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void enableXpnResourceProjectTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = + ProjectsEnableXpnResourceRequest.newBuilder().build(); + + Operation actualResponse = + client.enableXpnResourceProject(project, projectsEnableXpnResourceRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void enableXpnResourceProjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = + ProjectsEnableXpnResourceRequest.newBuilder().build(); + + client.enableXpnResourceProject(project, projectsEnableXpnResourceRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getProjectTest() { + String xpnProjectStatus = "xpnProjectStatus-308451647"; + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String defaultServiceAccount = "defaultServiceAccount-1848771419"; + String selfLink = "selfLink-1691268851"; + Project expectedResponse = + Project.newBuilder() + .setXpnProjectStatus(xpnProjectStatus) + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setDefaultServiceAccount(defaultServiceAccount) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + Project actualResponse = client.getProject(project); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getProjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.getProject(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getXpnHostProjectTest() { + String xpnProjectStatus = "xpnProjectStatus-308451647"; + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String defaultServiceAccount = "defaultServiceAccount-1848771419"; + String selfLink = "selfLink-1691268851"; + Project expectedResponse = + Project.newBuilder() + .setXpnProjectStatus(xpnProjectStatus) + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setDefaultServiceAccount(defaultServiceAccount) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + Project actualResponse = client.getXpnHostProject(project); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getXpnHostProjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.getXpnHostProject(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getXpnResourcesProjectsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + XpnResourceId resourcesElement = XpnResourceId.newBuilder().build(); + List resources2 = Arrays.asList(resourcesElement); + ProjectsGetXpnResources expectedResponse = + ProjectsGetXpnResources.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .addAllResources(resources2) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + GetXpnResourcesProjectsPagedResponse pagedListResponse = + client.getXpnResourcesProjects(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getResourcesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getXpnResourcesProjectsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.getXpnResourcesProjects(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listXpnHostsProjectsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Project itemsElement = Project.newBuilder().build(); + List items = Arrays.asList(itemsElement); + XpnHostList expectedResponse = + XpnHostList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = + ProjectsListXpnHostsRequest.newBuilder().build(); + + ListXpnHostsProjectsPagedResponse pagedListResponse = + client.listXpnHostsProjects(project, projectsListXpnHostsRequestResource); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listXpnHostsProjectsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = + ProjectsListXpnHostsRequest.newBuilder().build(); + + client.listXpnHostsProjects(project, projectsListXpnHostsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void moveDiskProjectTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build(); + + Operation actualResponse = client.moveDiskProject(project, diskMoveRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void moveDiskProjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build(); + + client.moveDiskProject(project, diskMoveRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void moveInstanceProjectTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + InstanceMoveRequest instanceMoveRequestResource = InstanceMoveRequest.newBuilder().build(); + + Operation actualResponse = client.moveInstanceProject(project, instanceMoveRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void moveInstanceProjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + InstanceMoveRequest instanceMoveRequestResource = InstanceMoveRequest.newBuilder().build(); + + client.moveInstanceProject(project, instanceMoveRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setCommonInstanceMetadataProjectTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + Metadata metadataResource = Metadata.newBuilder().build(); + + Operation actualResponse = client.setCommonInstanceMetadataProject(project, metadataResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setCommonInstanceMetadataProjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + Metadata metadataResource = Metadata.newBuilder().build(); + + client.setCommonInstanceMetadataProject(project, metadataResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setUsageExportBucketProjectTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + UsageExportLocation usageExportLocationResource = UsageExportLocation.newBuilder().build(); + + Operation actualResponse = + client.setUsageExportBucketProject(project, usageExportLocationResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setUsageExportBucketProjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + UsageExportLocation usageExportLocationResource = UsageExportLocation.newBuilder().build(); + + client.setUsageExportBucketProject(project, usageExportLocationResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionAutoscalerClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionAutoscalerClientTest.java new file mode 100644 index 000000000000..cabdd58aaddc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionAutoscalerClientTest.java @@ -0,0 +1,581 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionAutoscalerClient.ListRegionAutoscalersPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionAutoscalerStub.deleteRegionAutoscalerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionAutoscalerStub.getRegionAutoscalerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionAutoscalerStub.insertRegionAutoscalerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionAutoscalerStub.listRegionAutoscalersMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionAutoscalerStub.patchRegionAutoscalerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionAutoscalerStub.updateRegionAutoscalerMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.RegionAutoscalerStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class RegionAutoscalerClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteRegionAutoscalerMethodDescriptor, + getRegionAutoscalerMethodDescriptor, + insertRegionAutoscalerMethodDescriptor, + listRegionAutoscalersMethodDescriptor, + patchRegionAutoscalerMethodDescriptor, + updateRegionAutoscalerMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, RegionAutoscalerStubSettings.getDefaultEndpoint()); + + private static RegionAutoscalerClient client; + private static RegionAutoscalerSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + RegionAutoscalerSettings.newBuilder() + .setTransportChannelProvider( + RegionAutoscalerSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = RegionAutoscalerClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteRegionAutoscalerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionAutoscalerName autoscaler = + ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]"); + + Operation actualResponse = client.deleteRegionAutoscaler(autoscaler); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteRegionAutoscalerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionAutoscalerName autoscaler = + ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]"); + + client.deleteRegionAutoscaler(autoscaler); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getRegionAutoscalerTest() { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String selfLink = "selfLink-1691268851"; + String status = "status-892481550"; + String target = "target-880905839"; + Autoscaler expectedResponse = + Autoscaler.newBuilder() + .setZone(zone.toString()) + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setRegion(region.toString()) + .setSelfLink(selfLink) + .setStatus(status) + .setTarget(target) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionAutoscalerName autoscaler = + ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]"); + + Autoscaler actualResponse = client.getRegionAutoscaler(autoscaler); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRegionAutoscalerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionAutoscalerName autoscaler = + ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]"); + + client.getRegionAutoscaler(autoscaler); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertRegionAutoscalerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + Operation actualResponse = client.insertRegionAutoscaler(region, autoscalerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertRegionAutoscalerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + client.insertRegionAutoscaler(region, autoscalerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listRegionAutoscalersTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Autoscaler itemsElement = Autoscaler.newBuilder().build(); + List items = Arrays.asList(itemsElement); + RegionAutoscalerList expectedResponse = + RegionAutoscalerList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListRegionAutoscalersPagedResponse pagedListResponse = client.listRegionAutoscalers(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listRegionAutoscalersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listRegionAutoscalers(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchRegionAutoscalerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + String autoscaler = "autoscaler517258967"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + Operation actualResponse = client.patchRegionAutoscaler(autoscaler, region, autoscalerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchRegionAutoscalerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String autoscaler = "autoscaler517258967"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + client.patchRegionAutoscaler(autoscaler, region, autoscalerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateRegionAutoscalerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + String autoscaler = "autoscaler517258967"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + Operation actualResponse = + client.updateRegionAutoscaler(autoscaler, region, autoscalerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateRegionAutoscalerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String autoscaler = "autoscaler517258967"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + + client.updateRegionAutoscaler(autoscaler, region, autoscalerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionBackendServiceClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionBackendServiceClientTest.java new file mode 100644 index 000000000000..6effc2e07529 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionBackendServiceClientTest.java @@ -0,0 +1,651 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionBackendServiceClient.ListRegionBackendServicesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionBackendServiceStub.deleteRegionBackendServiceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionBackendServiceStub.getHealthRegionBackendServiceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionBackendServiceStub.getRegionBackendServiceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionBackendServiceStub.insertRegionBackendServiceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionBackendServiceStub.listRegionBackendServicesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionBackendServiceStub.patchRegionBackendServiceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionBackendServiceStub.updateRegionBackendServiceMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.RegionBackendServiceStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class RegionBackendServiceClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteRegionBackendServiceMethodDescriptor, + getRegionBackendServiceMethodDescriptor, + getHealthRegionBackendServiceMethodDescriptor, + insertRegionBackendServiceMethodDescriptor, + listRegionBackendServicesMethodDescriptor, + patchRegionBackendServiceMethodDescriptor, + updateRegionBackendServiceMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService( + METHOD_DESCRIPTORS, RegionBackendServiceStubSettings.getDefaultEndpoint()); + + private static RegionBackendServiceClient client; + private static RegionBackendServiceSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + RegionBackendServiceSettings.newBuilder() + .setTransportChannelProvider( + RegionBackendServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = RegionBackendServiceClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteRegionBackendServiceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionBackendServiceName backendService = + ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]"); + + Operation actualResponse = client.deleteRegionBackendService(backendService); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteRegionBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionBackendServiceName backendService = + ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]"); + + client.deleteRegionBackendService(backendService); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getRegionBackendServiceTest() { + Integer affinityCookieTtlSec = 1777486694; + String kind = "kind3292052"; + String sessionAffinity = "sessionAffinity1000759473"; + String description = "description-1724546052"; + String loadBalancingScheme = "loadBalancingScheme1974502980"; + String portName = "portName1115276169"; + Integer timeoutSec = 2067488653; + String selfLink = "selfLink-1691268851"; + String protocol = "protocol-989163880"; + Boolean enableCDN = false; + Integer port = 3446913; + String creationTimestamp = "creationTimestamp567396278"; + String fingerprint = "fingerprint-1375934236"; + String name = "name3373707"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + BackendService expectedResponse = + BackendService.newBuilder() + .setAffinityCookieTtlSec(affinityCookieTtlSec) + .setKind(kind) + .setSessionAffinity(sessionAffinity) + .setDescription(description) + .setLoadBalancingScheme(loadBalancingScheme) + .setPortName(portName) + .setTimeoutSec(timeoutSec) + .setSelfLink(selfLink) + .setProtocol(protocol) + .setEnableCDN(enableCDN) + .setPort(port) + .setCreationTimestamp(creationTimestamp) + .setFingerprint(fingerprint) + .setName(name) + .setId(id) + .setRegion(region.toString()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionBackendServiceName backendService = + ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]"); + + BackendService actualResponse = client.getRegionBackendService(backendService); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRegionBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionBackendServiceName backendService = + ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]"); + + client.getRegionBackendService(backendService); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getHealthRegionBackendServiceTest() { + String kind = "kind3292052"; + BackendServiceGroupHealth expectedResponse = + BackendServiceGroupHealth.newBuilder().setKind(kind).build(); + mockService.addResponse(expectedResponse); + + ProjectRegionBackendServiceName backendService = + ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]"); + ResourceGroupReference resourceGroupReferenceResource = + ResourceGroupReference.newBuilder().build(); + + BackendServiceGroupHealth actualResponse = + client.getHealthRegionBackendService(backendService, resourceGroupReferenceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getHealthRegionBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionBackendServiceName backendService = + ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]"); + ResourceGroupReference resourceGroupReferenceResource = + ResourceGroupReference.newBuilder().build(); + + client.getHealthRegionBackendService(backendService, resourceGroupReferenceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertRegionBackendServiceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + Operation actualResponse = client.insertRegionBackendService(region, backendServiceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertRegionBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + client.insertRegionBackendService(region, backendServiceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listRegionBackendServicesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + BackendService itemsElement = BackendService.newBuilder().build(); + List items = Arrays.asList(itemsElement); + BackendServiceList expectedResponse = + BackendServiceList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListRegionBackendServicesPagedResponse pagedListResponse = + client.listRegionBackendServices(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listRegionBackendServicesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listRegionBackendServices(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchRegionBackendServiceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionBackendServiceName backendService = + ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + Operation actualResponse = + client.patchRegionBackendService(backendService, backendServiceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchRegionBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionBackendServiceName backendService = + ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + client.patchRegionBackendService(backendService, backendServiceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateRegionBackendServiceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionBackendServiceName backendService = + ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + Operation actualResponse = + client.updateRegionBackendService(backendService, backendServiceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateRegionBackendServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionBackendServiceName backendService = + ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]"); + BackendService backendServiceResource = BackendService.newBuilder().build(); + + client.updateRegionBackendService(backendService, backendServiceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionClientTest.java new file mode 100644 index 000000000000..d5c49d2e43d9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionClientTest.java @@ -0,0 +1,199 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionClient.ListRegionsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionStub.getRegionMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionStub.listRegionsMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.RegionStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class RegionClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + getRegionMethodDescriptor, listRegionsMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, RegionStubSettings.getDefaultEndpoint()); + + private static RegionClient client; + private static RegionSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + RegionSettings.newBuilder() + .setTransportChannelProvider( + RegionSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = RegionClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void getRegionTest() { + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + String status = "status-892481550"; + Region expectedResponse = + Region.newBuilder() + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setSelfLink(selfLink) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + Region actualResponse = client.getRegion(region); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRegionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.getRegion(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listRegionsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Region itemsElement = Region.newBuilder().build(); + List items = Arrays.asList(itemsElement); + RegionList expectedResponse = + RegionList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListRegionsPagedResponse pagedListResponse = client.listRegions(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listRegionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listRegions(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionCommitmentClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionCommitmentClientTest.java new file mode 100644 index 000000000000..74bd522cd516 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionCommitmentClientTest.java @@ -0,0 +1,372 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionCommitmentClient.AggregatedListRegionCommitmentsPagedResponse; +import static com.google.cloud.compute.v1.RegionCommitmentClient.ListRegionCommitmentsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionCommitmentStub.aggregatedListRegionCommitmentsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionCommitmentStub.getRegionCommitmentMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionCommitmentStub.insertRegionCommitmentMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionCommitmentStub.listRegionCommitmentsMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.RegionCommitmentStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class RegionCommitmentClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListRegionCommitmentsMethodDescriptor, + getRegionCommitmentMethodDescriptor, + insertRegionCommitmentMethodDescriptor, + listRegionCommitmentsMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, RegionCommitmentStubSettings.getDefaultEndpoint()); + + private static RegionCommitmentClient client; + private static RegionCommitmentSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + RegionCommitmentSettings.newBuilder() + .setTransportChannelProvider( + RegionCommitmentSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = RegionCommitmentClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListRegionCommitmentsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + CommitmentsScopedList itemsItem = CommitmentsScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + CommitmentAggregatedList expectedResponse = + CommitmentAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListRegionCommitmentsPagedResponse pagedListResponse = + client.aggregatedListRegionCommitments(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListRegionCommitmentsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListRegionCommitments(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getRegionCommitmentTest() { + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String endTimestamp = "endTimestamp1004967602"; + String plan = "plan3443497"; + String startTimestamp = "startTimestamp-1526966919"; + String status = "status-892481550"; + Commitment expectedResponse = + Commitment.newBuilder() + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .setRegion(region.toString()) + .setEndTimestamp(endTimestamp) + .setPlan(plan) + .setStartTimestamp(startTimestamp) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionCommitmentName commitment = + ProjectRegionCommitmentName.of("[PROJECT]", "[REGION]", "[COMMITMENT]"); + + Commitment actualResponse = client.getRegionCommitment(commitment); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRegionCommitmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionCommitmentName commitment = + ProjectRegionCommitmentName.of("[PROJECT]", "[REGION]", "[COMMITMENT]"); + + client.getRegionCommitment(commitment); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertRegionCommitmentTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Commitment commitmentResource = Commitment.newBuilder().build(); + + Operation actualResponse = client.insertRegionCommitment(region, commitmentResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertRegionCommitmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Commitment commitmentResource = Commitment.newBuilder().build(); + + client.insertRegionCommitment(region, commitmentResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listRegionCommitmentsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Commitment itemsElement = Commitment.newBuilder().build(); + List items = Arrays.asList(itemsElement); + CommitmentList expectedResponse = + CommitmentList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListRegionCommitmentsPagedResponse pagedListResponse = client.listRegionCommitments(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listRegionCommitmentsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listRegionCommitments(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionDiskClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionDiskClientTest.java new file mode 100644 index 000000000000..4466235bf6b9 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionDiskClientTest.java @@ -0,0 +1,741 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionDiskClient.ListRegionDisksPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionDiskStub.createSnapshotRegionDiskMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionDiskStub.deleteRegionDiskMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionDiskStub.getRegionDiskMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionDiskStub.insertRegionDiskMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionDiskStub.listRegionDisksMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionDiskStub.resizeRegionDiskMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionDiskStub.setLabelsRegionDiskMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionDiskStub.testIamPermissionsRegionDiskMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.RegionDiskStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class RegionDiskClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + createSnapshotRegionDiskMethodDescriptor, + deleteRegionDiskMethodDescriptor, + getRegionDiskMethodDescriptor, + insertRegionDiskMethodDescriptor, + listRegionDisksMethodDescriptor, + resizeRegionDiskMethodDescriptor, + setLabelsRegionDiskMethodDescriptor, + testIamPermissionsRegionDiskMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, RegionDiskStubSettings.getDefaultEndpoint()); + + private static RegionDiskClient client; + private static RegionDiskSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + RegionDiskSettings.newBuilder() + .setTransportChannelProvider( + RegionDiskSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = RegionDiskClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void createSnapshotRegionDiskTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]"); + Snapshot snapshotResource = Snapshot.newBuilder().build(); + + Operation actualResponse = client.createSnapshotRegionDisk(disk, snapshotResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void createSnapshotRegionDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]"); + Snapshot snapshotResource = Snapshot.newBuilder().build(); + + client.createSnapshotRegionDisk(disk, snapshotResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteRegionDiskTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]"); + + Operation actualResponse = client.deleteRegionDisk(disk); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteRegionDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]"); + + client.deleteRegionDisk(disk); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getRegionDiskTest() { + String sizeGb = "sizeGb2105542105"; + String sourceSnapshotId = "sourceSnapshotId-1511650478"; + String lastDetachTimestamp = "lastDetachTimestamp-480399885"; + String description = "description-1724546052"; + String sourceSnapshot = "sourceSnapshot-947679896"; + String type = "type3575610"; + String labelFingerprint = "labelFingerprint714995737"; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String creationTimestamp = "creationTimestamp567396278"; + String options = "options-1249474914"; + String id = "id3355"; + String sourceImageId = "sourceImageId-2092155357"; + String kind = "kind3292052"; + String lastAttachTimestamp = "lastAttachTimestamp-2105323995"; + String selfLink = "selfLink-1691268851"; + String name = "name3373707"; + String sourceImage = "sourceImage1661056055"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String status = "status-892481550"; + Disk expectedResponse = + Disk.newBuilder() + .setSizeGb(sizeGb) + .setSourceSnapshotId(sourceSnapshotId) + .setLastDetachTimestamp(lastDetachTimestamp) + .setDescription(description) + .setSourceSnapshot(sourceSnapshot) + .setType(type) + .setLabelFingerprint(labelFingerprint) + .setZone(zone.toString()) + .setCreationTimestamp(creationTimestamp) + .setOptions(options) + .setId(id) + .setSourceImageId(sourceImageId) + .setKind(kind) + .setLastAttachTimestamp(lastAttachTimestamp) + .setSelfLink(selfLink) + .setName(name) + .setSourceImage(sourceImage) + .setRegion(region.toString()) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]"); + + Disk actualResponse = client.getRegionDisk(disk); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRegionDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]"); + + client.getRegionDisk(disk); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertRegionDiskTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Disk diskResource = Disk.newBuilder().build(); + + Operation actualResponse = client.insertRegionDisk(region, diskResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertRegionDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Disk diskResource = Disk.newBuilder().build(); + + client.insertRegionDisk(region, diskResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listRegionDisksTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Disk itemsElement = Disk.newBuilder().build(); + List items = Arrays.asList(itemsElement); + DiskList expectedResponse = + DiskList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListRegionDisksPagedResponse pagedListResponse = client.listRegionDisks(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listRegionDisksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listRegionDisks(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void resizeRegionDiskTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]"); + RegionDisksResizeRequest regionDisksResizeRequestResource = + RegionDisksResizeRequest.newBuilder().build(); + + Operation actualResponse = client.resizeRegionDisk(disk, regionDisksResizeRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void resizeRegionDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]"); + RegionDisksResizeRequest regionDisksResizeRequestResource = + RegionDisksResizeRequest.newBuilder().build(); + + client.resizeRegionDisk(disk, regionDisksResizeRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setLabelsRegionDiskTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionDiskResourceName resource = + ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]"); + RegionSetLabelsRequest regionSetLabelsRequestResource = + RegionSetLabelsRequest.newBuilder().build(); + + Operation actualResponse = client.setLabelsRegionDisk(resource, regionSetLabelsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setLabelsRegionDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionDiskResourceName resource = + ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]"); + RegionSetLabelsRequest regionSetLabelsRequestResource = + RegionSetLabelsRequest.newBuilder().build(); + + client.setLabelsRegionDisk(resource, regionSetLabelsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void testIamPermissionsRegionDiskTest() { + TestPermissionsResponse expectedResponse = TestPermissionsResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ProjectRegionDiskResourceName resource = + ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]"); + TestPermissionsRequest testPermissionsRequestResource = + TestPermissionsRequest.newBuilder().build(); + + TestPermissionsResponse actualResponse = + client.testIamPermissionsRegionDisk(resource, testPermissionsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void testIamPermissionsRegionDiskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionDiskResourceName resource = + ProjectRegionDiskResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]"); + TestPermissionsRequest testPermissionsRequestResource = + TestPermissionsRequest.newBuilder().build(); + + client.testIamPermissionsRegionDisk(resource, testPermissionsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionDiskTypeClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionDiskTypeClientTest.java new file mode 100644 index 000000000000..6ee2373e6d25 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionDiskTypeClientTest.java @@ -0,0 +1,207 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionDiskTypeClient.ListRegionDiskTypesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionDiskTypeStub.getRegionDiskTypeMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionDiskTypeStub.listRegionDiskTypesMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.RegionDiskTypeStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class RegionDiskTypeClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + getRegionDiskTypeMethodDescriptor, listRegionDiskTypesMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, RegionDiskTypeStubSettings.getDefaultEndpoint()); + + private static RegionDiskTypeClient client; + private static RegionDiskTypeSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + RegionDiskTypeSettings.newBuilder() + .setTransportChannelProvider( + RegionDiskTypeSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = RegionDiskTypeClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void getRegionDiskTypeTest() { + String defaultDiskSizeGb = "defaultDiskSizeGb807490165"; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String validDiskSize = "validDiskSize-1653521184"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String selfLink = "selfLink-1691268851"; + DiskType expectedResponse = + DiskType.newBuilder() + .setDefaultDiskSizeGb(defaultDiskSizeGb) + .setZone(zone.toString()) + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setValidDiskSize(validDiskSize) + .setRegion(region.toString()) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionDiskTypeName diskType = + ProjectRegionDiskTypeName.of("[PROJECT]", "[REGION]", "[DISK_TYPE]"); + + DiskType actualResponse = client.getRegionDiskType(diskType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRegionDiskTypeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionDiskTypeName diskType = + ProjectRegionDiskTypeName.of("[PROJECT]", "[REGION]", "[DISK_TYPE]"); + + client.getRegionDiskType(diskType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listRegionDiskTypesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + DiskType itemsElement = DiskType.newBuilder().build(); + List items = Arrays.asList(itemsElement); + RegionDiskTypeList expectedResponse = + RegionDiskTypeList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListRegionDiskTypesPagedResponse pagedListResponse = client.listRegionDiskTypes(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listRegionDiskTypesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listRegionDiskTypes(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionInstanceGroupClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionInstanceGroupClientTest.java new file mode 100644 index 000000000000..10fd1add9a37 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionInstanceGroupClientTest.java @@ -0,0 +1,385 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionInstanceGroupClient.ListInstancesRegionInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.RegionInstanceGroupClient.ListRegionInstanceGroupsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupStub.getRegionInstanceGroupMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupStub.listInstancesRegionInstanceGroupsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupStub.listRegionInstanceGroupsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupStub.setNamedPortsRegionInstanceGroupMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.RegionInstanceGroupStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class RegionInstanceGroupClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + getRegionInstanceGroupMethodDescriptor, + listRegionInstanceGroupsMethodDescriptor, + listInstancesRegionInstanceGroupsMethodDescriptor, + setNamedPortsRegionInstanceGroupMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, RegionInstanceGroupStubSettings.getDefaultEndpoint()); + + private static RegionInstanceGroupClient client; + private static RegionInstanceGroupSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + RegionInstanceGroupSettings.newBuilder() + .setTransportChannelProvider( + RegionInstanceGroupSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = RegionInstanceGroupClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void getRegionInstanceGroupTest() { + String kind = "kind3292052"; + String description = "description-1724546052"; + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + String selfLink = "selfLink-1691268851"; + Integer size = 3530753; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + String creationTimestamp = "creationTimestamp567396278"; + String fingerprint = "fingerprint-1375934236"; + String name = "name3373707"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + InstanceGroup expectedResponse = + InstanceGroup.newBuilder() + .setKind(kind) + .setDescription(description) + .setNetwork(network.toString()) + .setSelfLink(selfLink) + .setSize(size) + .setZone(zone.toString()) + .setSubnetwork(subnetwork.toString()) + .setCreationTimestamp(creationTimestamp) + .setFingerprint(fingerprint) + .setName(name) + .setId(id) + .setRegion(region.toString()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInstanceGroupName instanceGroup = + ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]"); + + InstanceGroup actualResponse = client.getRegionInstanceGroup(instanceGroup); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRegionInstanceGroupExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInstanceGroupName instanceGroup = + ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]"); + + client.getRegionInstanceGroup(instanceGroup); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listRegionInstanceGroupsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InstanceGroup itemsElement = InstanceGroup.newBuilder().build(); + List items = Arrays.asList(itemsElement); + RegionInstanceGroupList expectedResponse = + RegionInstanceGroupList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListRegionInstanceGroupsPagedResponse pagedListResponse = + client.listRegionInstanceGroups(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listRegionInstanceGroupsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listRegionInstanceGroups(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listInstancesRegionInstanceGroupsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InstanceWithNamedPorts itemsElement = InstanceWithNamedPorts.newBuilder().build(); + List items = Arrays.asList(itemsElement); + RegionInstanceGroupsListInstances expectedResponse = + RegionInstanceGroupsListInstances.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInstanceGroupName instanceGroup = + ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]"); + RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource = + RegionInstanceGroupsListInstancesRequest.newBuilder().build(); + + ListInstancesRegionInstanceGroupsPagedResponse pagedListResponse = + client.listInstancesRegionInstanceGroups( + instanceGroup, regionInstanceGroupsListInstancesRequestResource); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listInstancesRegionInstanceGroupsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInstanceGroupName instanceGroup = + ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]"); + RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource = + RegionInstanceGroupsListInstancesRequest.newBuilder().build(); + + client.listInstancesRegionInstanceGroups( + instanceGroup, regionInstanceGroupsListInstancesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setNamedPortsRegionInstanceGroupTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInstanceGroupName instanceGroup = + ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]"); + RegionInstanceGroupsSetNamedPortsRequest regionInstanceGroupsSetNamedPortsRequestResource = + RegionInstanceGroupsSetNamedPortsRequest.newBuilder().build(); + + Operation actualResponse = + client.setNamedPortsRegionInstanceGroup( + instanceGroup, regionInstanceGroupsSetNamedPortsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setNamedPortsRegionInstanceGroupExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInstanceGroupName instanceGroup = + ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]"); + RegionInstanceGroupsSetNamedPortsRequest regionInstanceGroupsSetNamedPortsRequestResource = + RegionInstanceGroupsSetNamedPortsRequest.newBuilder().build(); + + client.setNamedPortsRegionInstanceGroup( + instanceGroup, regionInstanceGroupsSetNamedPortsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerClientTest.java new file mode 100644 index 000000000000..bdc9a057b6dd --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerClientTest.java @@ -0,0 +1,1070 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionInstanceGroupManagerClient.ListRegionInstanceGroupManagersPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupManagerStub.abandonInstancesRegionInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupManagerStub.deleteInstancesRegionInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupManagerStub.deleteRegionInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupManagerStub.getRegionInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupManagerStub.insertRegionInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupManagerStub.listManagedInstancesRegionInstanceGroupManagersMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupManagerStub.listRegionInstanceGroupManagersMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupManagerStub.recreateInstancesRegionInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupManagerStub.resizeRegionInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupManagerStub.setInstanceTemplateRegionInstanceGroupManagerMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionInstanceGroupManagerStub.setTargetPoolsRegionInstanceGroupManagerMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.RegionInstanceGroupManagerStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class RegionInstanceGroupManagerClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + abandonInstancesRegionInstanceGroupManagerMethodDescriptor, + deleteRegionInstanceGroupManagerMethodDescriptor, + deleteInstancesRegionInstanceGroupManagerMethodDescriptor, + getRegionInstanceGroupManagerMethodDescriptor, + insertRegionInstanceGroupManagerMethodDescriptor, + listRegionInstanceGroupManagersMethodDescriptor, + listManagedInstancesRegionInstanceGroupManagersMethodDescriptor, + recreateInstancesRegionInstanceGroupManagerMethodDescriptor, + resizeRegionInstanceGroupManagerMethodDescriptor, + setInstanceTemplateRegionInstanceGroupManagerMethodDescriptor, + setTargetPoolsRegionInstanceGroupManagerMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService( + METHOD_DESCRIPTORS, RegionInstanceGroupManagerStubSettings.getDefaultEndpoint()); + + private static RegionInstanceGroupManagerClient client; + private static RegionInstanceGroupManagerSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + RegionInstanceGroupManagerSettings.newBuilder() + .setTransportChannelProvider( + RegionInstanceGroupManagerSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = RegionInstanceGroupManagerClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void abandonInstancesRegionInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + RegionInstanceGroupManagersAbandonInstancesRequest + regionInstanceGroupManagersAbandonInstancesRequestResource = + RegionInstanceGroupManagersAbandonInstancesRequest.newBuilder().build(); + + Operation actualResponse = + client.abandonInstancesRegionInstanceGroupManager( + instanceGroupManager, regionInstanceGroupManagersAbandonInstancesRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void abandonInstancesRegionInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + RegionInstanceGroupManagersAbandonInstancesRequest + regionInstanceGroupManagersAbandonInstancesRequestResource = + RegionInstanceGroupManagersAbandonInstancesRequest.newBuilder().build(); + + client.abandonInstancesRegionInstanceGroupManager( + instanceGroupManager, regionInstanceGroupManagersAbandonInstancesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteRegionInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + + Operation actualResponse = client.deleteRegionInstanceGroupManager(instanceGroupManager); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteRegionInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + + client.deleteRegionInstanceGroupManager(instanceGroupManager); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteInstancesRegionInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + RegionInstanceGroupManagersDeleteInstancesRequest + regionInstanceGroupManagersDeleteInstancesRequestResource = + RegionInstanceGroupManagersDeleteInstancesRequest.newBuilder().build(); + + Operation actualResponse = + client.deleteInstancesRegionInstanceGroupManager( + instanceGroupManager, regionInstanceGroupManagersDeleteInstancesRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteInstancesRegionInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + RegionInstanceGroupManagersDeleteInstancesRequest + regionInstanceGroupManagersDeleteInstancesRequestResource = + RegionInstanceGroupManagersDeleteInstancesRequest.newBuilder().build(); + + client.deleteInstancesRegionInstanceGroupManager( + instanceGroupManager, regionInstanceGroupManagersDeleteInstancesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getRegionInstanceGroupManagerTest() { + ProjectGlobalInstanceTemplateName instanceTemplate = + ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]"); + String kind = "kind3292052"; + String description = "description-1724546052"; + String baseInstanceName = "baseInstanceName389106439"; + ProjectZoneInstanceGroupName instanceGroup = + ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]"); + String selfLink = "selfLink-1691268851"; + Integer targetSize = 2084603409; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String creationTimestamp = "creationTimestamp567396278"; + String fingerprint = "fingerprint-1375934236"; + String name = "name3373707"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + InstanceGroupManager expectedResponse = + InstanceGroupManager.newBuilder() + .setInstanceTemplate(instanceTemplate.toString()) + .setKind(kind) + .setDescription(description) + .setBaseInstanceName(baseInstanceName) + .setInstanceGroup(instanceGroup.toString()) + .setSelfLink(selfLink) + .setTargetSize(targetSize) + .setZone(zone.toString()) + .setCreationTimestamp(creationTimestamp) + .setFingerprint(fingerprint) + .setName(name) + .setId(id) + .setRegion(region.toString()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + + InstanceGroupManager actualResponse = + client.getRegionInstanceGroupManager(instanceGroupManager); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRegionInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + + client.getRegionInstanceGroupManager(instanceGroupManager); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertRegionInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build(); + + Operation actualResponse = + client.insertRegionInstanceGroupManager(region, instanceGroupManagerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertRegionInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build(); + + client.insertRegionInstanceGroupManager(region, instanceGroupManagerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listRegionInstanceGroupManagersTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + InstanceGroupManager itemsElement = InstanceGroupManager.newBuilder().build(); + List items = Arrays.asList(itemsElement); + RegionInstanceGroupManagerList expectedResponse = + RegionInstanceGroupManagerList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListRegionInstanceGroupManagersPagedResponse pagedListResponse = + client.listRegionInstanceGroupManagers(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listRegionInstanceGroupManagersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listRegionInstanceGroupManagers(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listManagedInstancesRegionInstanceGroupManagersTest() { + RegionInstanceGroupManagersListInstancesResponse expectedResponse = + RegionInstanceGroupManagersListInstancesResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + + RegionInstanceGroupManagersListInstancesResponse actualResponse = + client.listManagedInstancesRegionInstanceGroupManagers(instanceGroupManager); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listManagedInstancesRegionInstanceGroupManagersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + + client.listManagedInstancesRegionInstanceGroupManagers(instanceGroupManager); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void recreateInstancesRegionInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + RegionInstanceGroupManagersRecreateRequest regionInstanceGroupManagersRecreateRequestResource = + RegionInstanceGroupManagersRecreateRequest.newBuilder().build(); + + Operation actualResponse = + client.recreateInstancesRegionInstanceGroupManager( + instanceGroupManager, regionInstanceGroupManagersRecreateRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void recreateInstancesRegionInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + RegionInstanceGroupManagersRecreateRequest + regionInstanceGroupManagersRecreateRequestResource = + RegionInstanceGroupManagersRecreateRequest.newBuilder().build(); + + client.recreateInstancesRegionInstanceGroupManager( + instanceGroupManager, regionInstanceGroupManagersRecreateRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void resizeRegionInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + Integer size = 3530753; + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + + Operation actualResponse = client.resizeRegionInstanceGroupManager(size, instanceGroupManager); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void resizeRegionInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Integer size = 3530753; + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + + client.resizeRegionInstanceGroupManager(size, instanceGroupManager); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setInstanceTemplateRegionInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + RegionInstanceGroupManagersSetTemplateRequest + regionInstanceGroupManagersSetTemplateRequestResource = + RegionInstanceGroupManagersSetTemplateRequest.newBuilder().build(); + + Operation actualResponse = + client.setInstanceTemplateRegionInstanceGroupManager( + instanceGroupManager, regionInstanceGroupManagersSetTemplateRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setInstanceTemplateRegionInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + RegionInstanceGroupManagersSetTemplateRequest + regionInstanceGroupManagersSetTemplateRequestResource = + RegionInstanceGroupManagersSetTemplateRequest.newBuilder().build(); + + client.setInstanceTemplateRegionInstanceGroupManager( + instanceGroupManager, regionInstanceGroupManagersSetTemplateRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setTargetPoolsRegionInstanceGroupManagerTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + RegionInstanceGroupManagersSetTargetPoolsRequest + regionInstanceGroupManagersSetTargetPoolsRequestResource = + RegionInstanceGroupManagersSetTargetPoolsRequest.newBuilder().build(); + + Operation actualResponse = + client.setTargetPoolsRegionInstanceGroupManager( + instanceGroupManager, regionInstanceGroupManagersSetTargetPoolsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setTargetPoolsRegionInstanceGroupManagerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionInstanceGroupManagerName instanceGroupManager = + ProjectRegionInstanceGroupManagerName.of( + "[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]"); + RegionInstanceGroupManagersSetTargetPoolsRequest + regionInstanceGroupManagersSetTargetPoolsRequestResource = + RegionInstanceGroupManagersSetTargetPoolsRequest.newBuilder().build(); + + client.setTargetPoolsRegionInstanceGroupManager( + instanceGroupManager, regionInstanceGroupManagersSetTargetPoolsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionOperationClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionOperationClientTest.java new file mode 100644 index 000000000000..bc4b8f497e72 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RegionOperationClientTest.java @@ -0,0 +1,276 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RegionOperationClient.ListRegionOperationsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionOperationStub.deleteRegionOperationMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionOperationStub.getRegionOperationMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRegionOperationStub.listRegionOperationsMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.RegionOperationStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class RegionOperationClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteRegionOperationMethodDescriptor, + getRegionOperationMethodDescriptor, + listRegionOperationsMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, RegionOperationStubSettings.getDefaultEndpoint()); + + private static RegionOperationClient client; + private static RegionOperationSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + RegionOperationSettings.newBuilder() + .setTransportChannelProvider( + RegionOperationSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = RegionOperationClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteRegionOperationTest() { + mockService.addNullResponse(); + + ProjectRegionOperationName operation = + ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]"); + + client.deleteRegionOperation(operation); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteRegionOperationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionOperationName operation = + ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]"); + + client.deleteRegionOperation(operation); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getRegionOperationTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionOperationName operation = + ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]"); + + Operation actualResponse = client.getRegionOperation(operation); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRegionOperationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionOperationName operation = + ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]"); + + client.getRegionOperation(operation); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listRegionOperationsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Operation itemsElement = Operation.newBuilder().build(); + List items = Arrays.asList(itemsElement); + OperationList expectedResponse = + OperationList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListRegionOperationsPagedResponse pagedListResponse = client.listRegionOperations(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listRegionOperationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listRegionOperations(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RouteClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RouteClientTest.java new file mode 100644 index 000000000000..2b5756eb7884 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RouteClientTest.java @@ -0,0 +1,398 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RouteClient.ListRoutesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonRouteStub.deleteRouteMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRouteStub.getRouteMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRouteStub.insertRouteMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRouteStub.listRoutesMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.RouteStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class RouteClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteRouteMethodDescriptor, + getRouteMethodDescriptor, + insertRouteMethodDescriptor, + listRoutesMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, RouteStubSettings.getDefaultEndpoint()); + + private static RouteClient client; + private static RouteSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + RouteSettings.newBuilder() + .setTransportChannelProvider( + RouteSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = RouteClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteRouteTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]"); + + Operation actualResponse = client.deleteRoute(route); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteRouteExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]"); + + client.deleteRoute(route); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getRouteTest() { + String nextHopGateway = "nextHopGateway-159695614"; + String kind = "kind3292052"; + String nextHopPeering = "nextHopPeering-661059074"; + String description = "description-1724546052"; + Integer priority = 1165461084; + String nextHopNetwork = "nextHopNetwork1872908524"; + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + String selfLink = "selfLink-1691268851"; + String nextHopInstance = "nextHopInstance1467250071"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String destRange = "destRange918198624"; + String nextHopVpnTunnel = "nextHopVpnTunnel-1627639147"; + String nextHopIp = "nextHopIp1184061353"; + String id = "id3355"; + Route expectedResponse = + Route.newBuilder() + .setNextHopGateway(nextHopGateway) + .setKind(kind) + .setNextHopPeering(nextHopPeering) + .setDescription(description) + .setPriority(priority) + .setNextHopNetwork(nextHopNetwork) + .setNetwork(network.toString()) + .setSelfLink(selfLink) + .setNextHopInstance(nextHopInstance) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDestRange(destRange) + .setNextHopVpnTunnel(nextHopVpnTunnel) + .setNextHopIp(nextHopIp) + .setId(id) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]"); + + Route actualResponse = client.getRoute(route); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRouteExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]"); + + client.getRoute(route); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertRouteTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + Route routeResource = Route.newBuilder().build(); + + Operation actualResponse = client.insertRoute(project, routeResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertRouteExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + Route routeResource = Route.newBuilder().build(); + + client.insertRoute(project, routeResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listRoutesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Route itemsElement = Route.newBuilder().build(); + List items = Arrays.asList(itemsElement); + RouteList expectedResponse = + RouteList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListRoutesPagedResponse pagedListResponse = client.listRoutes(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listRoutesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listRoutes(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RouterClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RouterClientTest.java new file mode 100644 index 000000000000..59530a691e8d --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/RouterClientTest.java @@ -0,0 +1,742 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.RouterClient.AggregatedListRoutersPagedResponse; +import static com.google.cloud.compute.v1.RouterClient.ListRoutersPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonRouterStub.aggregatedListRoutersMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRouterStub.deleteRouterMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRouterStub.getRouterMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRouterStub.getRouterStatusRouterMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRouterStub.insertRouterMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRouterStub.listRoutersMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRouterStub.patchRouterMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRouterStub.previewRouterMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonRouterStub.updateRouterMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.RouterStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class RouterClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListRoutersMethodDescriptor, + deleteRouterMethodDescriptor, + getRouterMethodDescriptor, + getRouterStatusRouterMethodDescriptor, + insertRouterMethodDescriptor, + listRoutersMethodDescriptor, + patchRouterMethodDescriptor, + previewRouterMethodDescriptor, + updateRouterMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, RouterStubSettings.getDefaultEndpoint()); + + private static RouterClient client; + private static RouterSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + RouterSettings.newBuilder() + .setTransportChannelProvider( + RouterSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = RouterClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListRoutersTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + RoutersScopedList itemsItem = RoutersScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + RouterAggregatedList expectedResponse = + RouterAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListRoutersPagedResponse pagedListResponse = client.aggregatedListRouters(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListRoutersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListRouters(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteRouterTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + + Operation actualResponse = client.deleteRouter(router); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteRouterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + + client.deleteRouter(router); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getRouterTest() { + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + String selfLink = "selfLink-1691268851"; + Router expectedResponse = + Router.newBuilder() + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setRegion(region.toString()) + .setNetwork(network.toString()) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + + Router actualResponse = client.getRouter(router); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRouterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + + client.getRouter(router); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getRouterStatusRouterTest() { + String kind = "kind3292052"; + RouterStatusResponse expectedResponse = RouterStatusResponse.newBuilder().setKind(kind).build(); + mockService.addResponse(expectedResponse); + + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + + RouterStatusResponse actualResponse = client.getRouterStatusRouter(router); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getRouterStatusRouterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + + client.getRouterStatusRouter(router); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertRouterTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Router routerResource = Router.newBuilder().build(); + + Operation actualResponse = client.insertRouter(region, routerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertRouterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Router routerResource = Router.newBuilder().build(); + + client.insertRouter(region, routerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listRoutersTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Router itemsElement = Router.newBuilder().build(); + List items = Arrays.asList(itemsElement); + RouterList expectedResponse = + RouterList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListRoutersPagedResponse pagedListResponse = client.listRouters(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listRoutersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listRouters(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchRouterTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + Router routerResource = Router.newBuilder().build(); + + Operation actualResponse = client.patchRouter(router, routerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchRouterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + Router routerResource = Router.newBuilder().build(); + + client.patchRouter(router, routerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void previewRouterTest() { + RoutersPreviewResponse expectedResponse = RoutersPreviewResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + Router routerResource = Router.newBuilder().build(); + + RoutersPreviewResponse actualResponse = client.previewRouter(router, routerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void previewRouterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + Router routerResource = Router.newBuilder().build(); + + client.previewRouter(router, routerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateRouterTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + Router routerResource = Router.newBuilder().build(); + + Operation actualResponse = client.updateRouter(router, routerResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateRouterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + Router routerResource = Router.newBuilder().build(); + + client.updateRouter(router, routerResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SnapshotClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SnapshotClientTest.java new file mode 100644 index 000000000000..f2e69ecc6a4c --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SnapshotClientTest.java @@ -0,0 +1,398 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.SnapshotClient.ListSnapshotsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonSnapshotStub.deleteSnapshotMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSnapshotStub.getSnapshotMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSnapshotStub.listSnapshotsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSnapshotStub.setLabelsSnapshotMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.SnapshotStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class SnapshotClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteSnapshotMethodDescriptor, + getSnapshotMethodDescriptor, + listSnapshotsMethodDescriptor, + setLabelsSnapshotMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, SnapshotStubSettings.getDefaultEndpoint()); + + private static SnapshotClient client; + private static SnapshotSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + SnapshotSettings.newBuilder() + .setTransportChannelProvider( + SnapshotSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SnapshotClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteSnapshotTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + + Operation actualResponse = client.deleteSnapshot(snapshot); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteSnapshotExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + + client.deleteSnapshot(snapshot); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getSnapshotTest() { + String sourceDisk = "sourceDisk-85117119"; + String sourceDiskId = "sourceDiskId-1693292839"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String labelFingerprint = "labelFingerprint714995737"; + String selfLink = "selfLink-1691268851"; + String storageBytesStatus = "storageBytesStatus1027609994"; + String storageBytes = "storageBytes2035244455"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + String diskSizeGb = "diskSizeGb-757478089"; + String status = "status-892481550"; + Snapshot expectedResponse = + Snapshot.newBuilder() + .setSourceDisk(sourceDisk) + .setSourceDiskId(sourceDiskId) + .setKind(kind) + .setDescription(description) + .setLabelFingerprint(labelFingerprint) + .setSelfLink(selfLink) + .setStorageBytesStatus(storageBytesStatus) + .setStorageBytes(storageBytes) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .setDiskSizeGb(diskSizeGb) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + + Snapshot actualResponse = client.getSnapshot(snapshot); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getSnapshotExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + + client.getSnapshot(snapshot); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listSnapshotsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Snapshot itemsElement = Snapshot.newBuilder().build(); + List items = Arrays.asList(itemsElement); + SnapshotList expectedResponse = + SnapshotList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListSnapshotsPagedResponse pagedListResponse = client.listSnapshots(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listSnapshotsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listSnapshots(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setLabelsSnapshotTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalSnapshotResourceName resource = + ProjectGlobalSnapshotResourceName.of("[PROJECT]", "[RESOURCE]"); + GlobalSetLabelsRequest globalSetLabelsRequestResource = + GlobalSetLabelsRequest.newBuilder().build(); + + Operation actualResponse = client.setLabelsSnapshot(resource, globalSetLabelsRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setLabelsSnapshotExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalSnapshotResourceName resource = + ProjectGlobalSnapshotResourceName.of("[PROJECT]", "[RESOURCE]"); + GlobalSetLabelsRequest globalSetLabelsRequestResource = + GlobalSetLabelsRequest.newBuilder().build(); + + client.setLabelsSnapshot(resource, globalSetLabelsRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SslCertificateClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SslCertificateClientTest.java new file mode 100644 index 000000000000..527eeda02526 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SslCertificateClientTest.java @@ -0,0 +1,388 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.SslCertificateClient.ListSslCertificatesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonSslCertificateStub.deleteSslCertificateMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSslCertificateStub.getSslCertificateMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSslCertificateStub.insertSslCertificateMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSslCertificateStub.listSslCertificatesMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.SslCertificateStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class SslCertificateClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteSslCertificateMethodDescriptor, + getSslCertificateMethodDescriptor, + insertSslCertificateMethodDescriptor, + listSslCertificatesMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, SslCertificateStubSettings.getDefaultEndpoint()); + + private static SslCertificateClient client; + private static SslCertificateSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + SslCertificateSettings.newBuilder() + .setTransportChannelProvider( + SslCertificateSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SslCertificateClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteSslCertificateTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalSslCertificateName sslCertificate = + ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]"); + + Operation actualResponse = client.deleteSslCertificate(sslCertificate); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteSslCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalSslCertificateName sslCertificate = + ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]"); + + client.deleteSslCertificate(sslCertificate); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getSslCertificateTest() { + String privateKey = "privateKey1971943843"; + String kind = "kind3292052"; + String certificate = "certificate1952399767"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + SslCertificate expectedResponse = + SslCertificate.newBuilder() + .setPrivateKey(privateKey) + .setKind(kind) + .setCertificate(certificate) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalSslCertificateName sslCertificate = + ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]"); + + SslCertificate actualResponse = client.getSslCertificate(sslCertificate); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getSslCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalSslCertificateName sslCertificate = + ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]"); + + client.getSslCertificate(sslCertificate); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertSslCertificateTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + SslCertificate sslCertificateResource = SslCertificate.newBuilder().build(); + + Operation actualResponse = client.insertSslCertificate(project, sslCertificateResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertSslCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + SslCertificate sslCertificateResource = SslCertificate.newBuilder().build(); + + client.insertSslCertificate(project, sslCertificateResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listSslCertificatesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + SslCertificate itemsElement = SslCertificate.newBuilder().build(); + List items = Arrays.asList(itemsElement); + SslCertificateList expectedResponse = + SslCertificateList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListSslCertificatesPagedResponse pagedListResponse = client.listSslCertificates(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listSslCertificatesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listSslCertificates(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SslPolicyClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SslPolicyClientTest.java new file mode 100644 index 000000000000..9b6b78b4bee8 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SslPolicyClientTest.java @@ -0,0 +1,532 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.SslPolicyClient.ListSslPoliciesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonSslPolicyStub.deleteSslPolicyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSslPolicyStub.getSslPolicyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSslPolicyStub.insertSslPolicyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSslPolicyStub.listAvailableFeaturesSslPoliciesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSslPolicyStub.listSslPoliciesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSslPolicyStub.patchSslPolicyMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.SslPolicyStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class SslPolicyClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteSslPolicyMethodDescriptor, + getSslPolicyMethodDescriptor, + insertSslPolicyMethodDescriptor, + listSslPoliciesMethodDescriptor, + listAvailableFeaturesSslPoliciesMethodDescriptor, + patchSslPolicyMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, SslPolicyStubSettings.getDefaultEndpoint()); + + private static SslPolicyClient client; + private static SslPolicySettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + SslPolicySettings.newBuilder() + .setTransportChannelProvider( + SslPolicySettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SslPolicyClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteSslPolicyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalSslPolicyName sslPolicy = + ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]"); + + Operation actualResponse = client.deleteSslPolicy(sslPolicy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteSslPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalSslPolicyName sslPolicy = + ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]"); + + client.deleteSslPolicy(sslPolicy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getSslPolicyTest() { + String kind = "kind3292052"; + String minTlsVersion = "minTlsVersion8155943"; + String profile = "profile-309425751"; + String creationTimestamp = "creationTimestamp567396278"; + String fingerprint = "fingerprint-1375934236"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + SslPolicy expectedResponse = + SslPolicy.newBuilder() + .setKind(kind) + .setMinTlsVersion(minTlsVersion) + .setProfile(profile) + .setCreationTimestamp(creationTimestamp) + .setFingerprint(fingerprint) + .setName(name) + .setDescription(description) + .setId(id) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalSslPolicyName sslPolicy = + ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]"); + + SslPolicy actualResponse = client.getSslPolicy(sslPolicy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getSslPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalSslPolicyName sslPolicy = + ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]"); + + client.getSslPolicy(sslPolicy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertSslPolicyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + SslPolicy sslPolicyResource = SslPolicy.newBuilder().build(); + + Operation actualResponse = client.insertSslPolicy(project, sslPolicyResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertSslPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + SslPolicy sslPolicyResource = SslPolicy.newBuilder().build(); + + client.insertSslPolicy(project, sslPolicyResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listSslPoliciesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + SslPolicy itemsElement = SslPolicy.newBuilder().build(); + List items = Arrays.asList(itemsElement); + SslPoliciesList expectedResponse = + SslPoliciesList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListSslPoliciesPagedResponse pagedListResponse = client.listSslPolicies(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listSslPoliciesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listSslPolicies(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listAvailableFeaturesSslPoliciesTest() { + SslPoliciesListAvailableFeaturesResponse expectedResponse = + SslPoliciesListAvailableFeaturesResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + SslPoliciesListAvailableFeaturesResponse actualResponse = + client.listAvailableFeaturesSslPolicies(project); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listAvailableFeaturesSslPoliciesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listAvailableFeaturesSslPolicies(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchSslPolicyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalSslPolicyName sslPolicy = + ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]"); + SslPolicy sslPolicyResource = SslPolicy.newBuilder().build(); + + Operation actualResponse = client.patchSslPolicy(sslPolicy, sslPolicyResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchSslPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalSslPolicyName sslPolicy = + ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]"); + SslPolicy sslPolicyResource = SslPolicy.newBuilder().build(); + + client.patchSslPolicy(sslPolicy, sslPolicyResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SubnetworkClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SubnetworkClientTest.java new file mode 100644 index 000000000000..7712342e3b5a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/SubnetworkClientTest.java @@ -0,0 +1,757 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.SubnetworkClient.AggregatedListSubnetworksPagedResponse; +import static com.google.cloud.compute.v1.SubnetworkClient.ListSubnetworksPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonSubnetworkStub.aggregatedListSubnetworksMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSubnetworkStub.deleteSubnetworkMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSubnetworkStub.expandIpCidrRangeSubnetworkMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSubnetworkStub.getSubnetworkMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSubnetworkStub.insertSubnetworkMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSubnetworkStub.listSubnetworksMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSubnetworkStub.patchSubnetworkMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonSubnetworkStub.setPrivateIpGoogleAccessSubnetworkMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.SubnetworkStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class SubnetworkClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListSubnetworksMethodDescriptor, + deleteSubnetworkMethodDescriptor, + expandIpCidrRangeSubnetworkMethodDescriptor, + getSubnetworkMethodDescriptor, + insertSubnetworkMethodDescriptor, + listSubnetworksMethodDescriptor, + patchSubnetworkMethodDescriptor, + setPrivateIpGoogleAccessSubnetworkMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, SubnetworkStubSettings.getDefaultEndpoint()); + + private static SubnetworkClient client; + private static SubnetworkSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + SubnetworkSettings.newBuilder() + .setTransportChannelProvider( + SubnetworkSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SubnetworkClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListSubnetworksTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + SubnetworksScopedList itemsItem = SubnetworksScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + SubnetworkAggregatedList expectedResponse = + SubnetworkAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListSubnetworksPagedResponse pagedListResponse = + client.aggregatedListSubnetworks(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListSubnetworksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListSubnetworks(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteSubnetworkTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + + Operation actualResponse = client.deleteSubnetwork(subnetwork); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteSubnetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + + client.deleteSubnetwork(subnetwork); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void expandIpCidrRangeSubnetworkTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource = + SubnetworksExpandIpCidrRangeRequest.newBuilder().build(); + + Operation actualResponse = + client.expandIpCidrRangeSubnetwork(subnetwork, subnetworksExpandIpCidrRangeRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void expandIpCidrRangeSubnetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource = + SubnetworksExpandIpCidrRangeRequest.newBuilder().build(); + + client.expandIpCidrRangeSubnetwork(subnetwork, subnetworksExpandIpCidrRangeRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getSubnetworkTest() { + Boolean privateIpGoogleAccess = true; + String kind = "kind3292052"; + String description = "description-1724546052"; + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + String selfLink = "selfLink-1691268851"; + Boolean enableFlowLogs = true; + String creationTimestamp = "creationTimestamp567396278"; + String fingerprint = "fingerprint-1375934236"; + String name = "name3373707"; + String gatewayAddress = "gatewayAddress-77003527"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String ipCidrRange = "ipCidrRange-2049366326"; + Subnetwork expectedResponse = + Subnetwork.newBuilder() + .setPrivateIpGoogleAccess(privateIpGoogleAccess) + .setKind(kind) + .setDescription(description) + .setNetwork(network.toString()) + .setSelfLink(selfLink) + .setEnableFlowLogs(enableFlowLogs) + .setCreationTimestamp(creationTimestamp) + .setFingerprint(fingerprint) + .setName(name) + .setGatewayAddress(gatewayAddress) + .setId(id) + .setRegion(region.toString()) + .setIpCidrRange(ipCidrRange) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + + Subnetwork actualResponse = client.getSubnetwork(subnetwork); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getSubnetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + + client.getSubnetwork(subnetwork); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertSubnetworkTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Subnetwork subnetworkResource = Subnetwork.newBuilder().build(); + + Operation actualResponse = client.insertSubnetwork(region, subnetworkResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertSubnetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + Subnetwork subnetworkResource = Subnetwork.newBuilder().build(); + + client.insertSubnetwork(region, subnetworkResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listSubnetworksTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Subnetwork itemsElement = Subnetwork.newBuilder().build(); + List items = Arrays.asList(itemsElement); + SubnetworkList expectedResponse = + SubnetworkList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListSubnetworksPagedResponse pagedListResponse = client.listSubnetworks(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listSubnetworksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listSubnetworks(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchSubnetworkTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + Subnetwork subnetworkResource = Subnetwork.newBuilder().build(); + + Operation actualResponse = client.patchSubnetwork(subnetwork, subnetworkResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchSubnetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + Subnetwork subnetworkResource = Subnetwork.newBuilder().build(); + + client.patchSubnetwork(subnetwork, subnetworkResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setPrivateIpGoogleAccessSubnetworkTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource = + SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build(); + + Operation actualResponse = + client.setPrivateIpGoogleAccessSubnetwork( + subnetwork, subnetworksSetPrivateIpGoogleAccessRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setPrivateIpGoogleAccessSubnetworkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionSubnetworkName subnetwork = + ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]"); + SubnetworksSetPrivateIpGoogleAccessRequest + subnetworksSetPrivateIpGoogleAccessRequestResource = + SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build(); + + client.setPrivateIpGoogleAccessSubnetwork( + subnetwork, subnetworksSetPrivateIpGoogleAccessRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetHttpProxyClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetHttpProxyClientTest.java new file mode 100644 index 000000000000..ffe11ea88660 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetHttpProxyClientTest.java @@ -0,0 +1,481 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetHttpProxyClient.ListTargetHttpProxiesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpProxyStub.deleteTargetHttpProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpProxyStub.getTargetHttpProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpProxyStub.insertTargetHttpProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpProxyStub.listTargetHttpProxiesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpProxyStub.setUrlMapTargetHttpProxyMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.TargetHttpProxyStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class TargetHttpProxyClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteTargetHttpProxyMethodDescriptor, + getTargetHttpProxyMethodDescriptor, + insertTargetHttpProxyMethodDescriptor, + listTargetHttpProxiesMethodDescriptor, + setUrlMapTargetHttpProxyMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, TargetHttpProxyStubSettings.getDefaultEndpoint()); + + private static TargetHttpProxyClient client; + private static TargetHttpProxySettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + TargetHttpProxySettings.newBuilder() + .setTransportChannelProvider( + TargetHttpProxySettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TargetHttpProxyClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteTargetHttpProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetHttpProxyName targetHttpProxy = + ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]"); + + Operation actualResponse = client.deleteTargetHttpProxy(targetHttpProxy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteTargetHttpProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetHttpProxyName targetHttpProxy = + ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]"); + + client.deleteTargetHttpProxy(targetHttpProxy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getTargetHttpProxyTest() { + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetHttpProxy expectedResponse = + TargetHttpProxy.newBuilder() + .setUrlMap(urlMap.toString()) + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetHttpProxyName targetHttpProxy = + ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]"); + + TargetHttpProxy actualResponse = client.getTargetHttpProxy(targetHttpProxy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getTargetHttpProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetHttpProxyName targetHttpProxy = + ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]"); + + client.getTargetHttpProxy(targetHttpProxy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertTargetHttpProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + TargetHttpProxy targetHttpProxyResource = TargetHttpProxy.newBuilder().build(); + + Operation actualResponse = client.insertTargetHttpProxy(project, targetHttpProxyResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertTargetHttpProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + TargetHttpProxy targetHttpProxyResource = TargetHttpProxy.newBuilder().build(); + + client.insertTargetHttpProxy(project, targetHttpProxyResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listTargetHttpProxiesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetHttpProxy itemsElement = TargetHttpProxy.newBuilder().build(); + List items = Arrays.asList(itemsElement); + TargetHttpProxyList expectedResponse = + TargetHttpProxyList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListTargetHttpProxiesPagedResponse pagedListResponse = client.listTargetHttpProxies(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listTargetHttpProxiesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listTargetHttpProxies(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setUrlMapTargetHttpProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectTargetHttpProxyName targetHttpProxy = + ProjectTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]"); + UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build(); + + Operation actualResponse = + client.setUrlMapTargetHttpProxy(targetHttpProxy, urlMapReferenceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setUrlMapTargetHttpProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectTargetHttpProxyName targetHttpProxy = + ProjectTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]"); + UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build(); + + client.setUrlMapTargetHttpProxy(targetHttpProxy, urlMapReferenceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetHttpsProxyClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetHttpsProxyClientTest.java new file mode 100644 index 000000000000..bd147fecbe76 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetHttpsProxyClientTest.java @@ -0,0 +1,680 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetHttpsProxyClient.ListTargetHttpsProxiesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpsProxyStub.deleteTargetHttpsProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpsProxyStub.getTargetHttpsProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpsProxyStub.insertTargetHttpsProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpsProxyStub.listTargetHttpsProxiesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpsProxyStub.setSslCertificatesTargetHttpsProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpsProxyStub.setSslPolicyTargetHttpsProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetHttpsProxyStub.setUrlMapTargetHttpsProxyMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.TargetHttpsProxyStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class TargetHttpsProxyClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteTargetHttpsProxyMethodDescriptor, + getTargetHttpsProxyMethodDescriptor, + insertTargetHttpsProxyMethodDescriptor, + listTargetHttpsProxiesMethodDescriptor, + setSslCertificatesTargetHttpsProxyMethodDescriptor, + setSslPolicyTargetHttpsProxyMethodDescriptor, + setUrlMapTargetHttpsProxyMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, TargetHttpsProxyStubSettings.getDefaultEndpoint()); + + private static TargetHttpsProxyClient client; + private static TargetHttpsProxySettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + TargetHttpsProxySettings.newBuilder() + .setTransportChannelProvider( + TargetHttpsProxySettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TargetHttpsProxyClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteTargetHttpsProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetHttpsProxyName targetHttpsProxy = + ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]"); + + Operation actualResponse = client.deleteTargetHttpsProxy(targetHttpsProxy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteTargetHttpsProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetHttpsProxyName targetHttpsProxy = + ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]"); + + client.deleteTargetHttpsProxy(targetHttpsProxy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getTargetHttpsProxyTest() { + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + String kind = "kind3292052"; + ProjectGlobalSslPolicyName sslPolicy = + ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]"); + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetHttpsProxy expectedResponse = + TargetHttpsProxy.newBuilder() + .setUrlMap(urlMap.toString()) + .setKind(kind) + .setSslPolicy(sslPolicy.toString()) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetHttpsProxyName targetHttpsProxy = + ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]"); + + TargetHttpsProxy actualResponse = client.getTargetHttpsProxy(targetHttpsProxy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getTargetHttpsProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetHttpsProxyName targetHttpsProxy = + ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]"); + + client.getTargetHttpsProxy(targetHttpsProxy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertTargetHttpsProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + TargetHttpsProxy targetHttpsProxyResource = TargetHttpsProxy.newBuilder().build(); + + Operation actualResponse = client.insertTargetHttpsProxy(project, targetHttpsProxyResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertTargetHttpsProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + TargetHttpsProxy targetHttpsProxyResource = TargetHttpsProxy.newBuilder().build(); + + client.insertTargetHttpsProxy(project, targetHttpsProxyResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listTargetHttpsProxiesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetHttpsProxy itemsElement = TargetHttpsProxy.newBuilder().build(); + List items = Arrays.asList(itemsElement); + TargetHttpsProxyList expectedResponse = + TargetHttpsProxyList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListTargetHttpsProxiesPagedResponse pagedListResponse = client.listTargetHttpsProxies(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listTargetHttpsProxiesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listTargetHttpsProxies(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setSslCertificatesTargetHttpsProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectTargetHttpsProxyName targetHttpsProxy = + ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]"); + TargetHttpsProxiesSetSslCertificatesRequest + targetHttpsProxiesSetSslCertificatesRequestResource = + TargetHttpsProxiesSetSslCertificatesRequest.newBuilder().build(); + + Operation actualResponse = + client.setSslCertificatesTargetHttpsProxy( + targetHttpsProxy, targetHttpsProxiesSetSslCertificatesRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setSslCertificatesTargetHttpsProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectTargetHttpsProxyName targetHttpsProxy = + ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]"); + TargetHttpsProxiesSetSslCertificatesRequest + targetHttpsProxiesSetSslCertificatesRequestResource = + TargetHttpsProxiesSetSslCertificatesRequest.newBuilder().build(); + + client.setSslCertificatesTargetHttpsProxy( + targetHttpsProxy, targetHttpsProxiesSetSslCertificatesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setSslPolicyTargetHttpsProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetHttpsProxyName targetHttpsProxy = + ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]"); + SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build(); + + Operation actualResponse = + client.setSslPolicyTargetHttpsProxy(targetHttpsProxy, sslPolicyReferenceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setSslPolicyTargetHttpsProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetHttpsProxyName targetHttpsProxy = + ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]"); + SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build(); + + client.setSslPolicyTargetHttpsProxy(targetHttpsProxy, sslPolicyReferenceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setUrlMapTargetHttpsProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectTargetHttpsProxyName targetHttpsProxy = + ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]"); + UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build(); + + Operation actualResponse = + client.setUrlMapTargetHttpsProxy(targetHttpsProxy, urlMapReferenceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setUrlMapTargetHttpsProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectTargetHttpsProxyName targetHttpsProxy = + ProjectTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]"); + UrlMapReference urlMapReferenceResource = UrlMapReference.newBuilder().build(); + + client.setUrlMapTargetHttpsProxy(targetHttpsProxy, urlMapReferenceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetInstanceClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetInstanceClientTest.java new file mode 100644 index 000000000000..a995d97f1c5a --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetInstanceClientTest.java @@ -0,0 +1,459 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetInstanceClient.AggregatedListTargetInstancesPagedResponse; +import static com.google.cloud.compute.v1.TargetInstanceClient.ListTargetInstancesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetInstanceStub.aggregatedListTargetInstancesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetInstanceStub.deleteTargetInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetInstanceStub.getTargetInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetInstanceStub.insertTargetInstanceMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetInstanceStub.listTargetInstancesMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.TargetInstanceStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class TargetInstanceClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListTargetInstancesMethodDescriptor, + deleteTargetInstanceMethodDescriptor, + getTargetInstanceMethodDescriptor, + insertTargetInstanceMethodDescriptor, + listTargetInstancesMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, TargetInstanceStubSettings.getDefaultEndpoint()); + + private static TargetInstanceClient client; + private static TargetInstanceSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + TargetInstanceSettings.newBuilder() + .setTransportChannelProvider( + TargetInstanceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TargetInstanceClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListTargetInstancesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetInstancesScopedList itemsItem = TargetInstancesScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + TargetInstanceAggregatedList expectedResponse = + TargetInstanceAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListTargetInstancesPagedResponse pagedListResponse = + client.aggregatedListTargetInstances(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListTargetInstancesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListTargetInstances(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteTargetInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneTargetInstanceName targetInstance = + ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]"); + + Operation actualResponse = client.deleteTargetInstance(targetInstance); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteTargetInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneTargetInstanceName targetInstance = + ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]"); + + client.deleteTargetInstance(targetInstance); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getTargetInstanceTest() { + ProjectZoneInstanceName instance = + ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String natPolicy = "natPolicy-1637703152"; + String selfLink = "selfLink-1691268851"; + TargetInstance expectedResponse = + TargetInstance.newBuilder() + .setInstance(instance.toString()) + .setZone(zone.toString()) + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setNatPolicy(natPolicy) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneTargetInstanceName targetInstance = + ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]"); + + TargetInstance actualResponse = client.getTargetInstance(targetInstance); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getTargetInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneTargetInstanceName targetInstance = + ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]"); + + client.getTargetInstance(targetInstance); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertTargetInstanceTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone2 = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone2.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + TargetInstance targetInstanceResource = TargetInstance.newBuilder().build(); + + Operation actualResponse = client.insertTargetInstance(zone, targetInstanceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertTargetInstanceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + TargetInstance targetInstanceResource = TargetInstance.newBuilder().build(); + + client.insertTargetInstance(zone, targetInstanceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listTargetInstancesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetInstance itemsElement = TargetInstance.newBuilder().build(); + List items = Arrays.asList(itemsElement); + TargetInstanceList expectedResponse = + TargetInstanceList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + ListTargetInstancesPagedResponse pagedListResponse = client.listTargetInstances(zone); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listTargetInstancesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + client.listTargetInstances(zone); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetPoolClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetPoolClientTest.java new file mode 100644 index 000000000000..12f60655798f --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetPoolClientTest.java @@ -0,0 +1,998 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetPoolClient.AggregatedListTargetPoolsPagedResponse; +import static com.google.cloud.compute.v1.TargetPoolClient.ListTargetPoolsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetPoolStub.addHealthCheckTargetPoolMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetPoolStub.addInstanceTargetPoolMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetPoolStub.aggregatedListTargetPoolsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetPoolStub.deleteTargetPoolMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetPoolStub.getHealthTargetPoolMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetPoolStub.getTargetPoolMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetPoolStub.insertTargetPoolMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetPoolStub.listTargetPoolsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetPoolStub.removeHealthCheckTargetPoolMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetPoolStub.removeInstanceTargetPoolMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetPoolStub.setBackupTargetPoolMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.TargetPoolStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class TargetPoolClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + addHealthCheckTargetPoolMethodDescriptor, + addInstanceTargetPoolMethodDescriptor, + aggregatedListTargetPoolsMethodDescriptor, + deleteTargetPoolMethodDescriptor, + getTargetPoolMethodDescriptor, + getHealthTargetPoolMethodDescriptor, + insertTargetPoolMethodDescriptor, + listTargetPoolsMethodDescriptor, + removeHealthCheckTargetPoolMethodDescriptor, + removeInstanceTargetPoolMethodDescriptor, + setBackupTargetPoolMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, TargetPoolStubSettings.getDefaultEndpoint()); + + private static TargetPoolClient client; + private static TargetPoolSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + TargetPoolSettings.newBuilder() + .setTransportChannelProvider( + TargetPoolSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TargetPoolClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void addHealthCheckTargetPoolTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = + TargetPoolsAddHealthCheckRequest.newBuilder().build(); + + Operation actualResponse = + client.addHealthCheckTargetPool(targetPool, targetPoolsAddHealthCheckRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void addHealthCheckTargetPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = + TargetPoolsAddHealthCheckRequest.newBuilder().build(); + + client.addHealthCheckTargetPool(targetPool, targetPoolsAddHealthCheckRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void addInstanceTargetPoolTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = + TargetPoolsAddInstanceRequest.newBuilder().build(); + + Operation actualResponse = + client.addInstanceTargetPool(targetPool, targetPoolsAddInstanceRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void addInstanceTargetPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = + TargetPoolsAddInstanceRequest.newBuilder().build(); + + client.addInstanceTargetPool(targetPool, targetPoolsAddInstanceRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void aggregatedListTargetPoolsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetPoolsScopedList itemsItem = TargetPoolsScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + TargetPoolAggregatedList expectedResponse = + TargetPoolAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListTargetPoolsPagedResponse pagedListResponse = + client.aggregatedListTargetPools(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListTargetPoolsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListTargetPools(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteTargetPoolTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + + Operation actualResponse = client.deleteTargetPool(targetPool); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteTargetPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + + client.deleteTargetPool(targetPool); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getTargetPoolTest() { + String kind = "kind3292052"; + String sessionAffinity = "sessionAffinity1000759473"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + Float failoverRatio = -8.6107481E7F; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String backupPool = "backupPool1119626361"; + String selfLink = "selfLink-1691268851"; + TargetPool expectedResponse = + TargetPool.newBuilder() + .setKind(kind) + .setSessionAffinity(sessionAffinity) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setFailoverRatio(failoverRatio) + .setId(id) + .setRegion(region.toString()) + .setBackupPool(backupPool) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + + TargetPool actualResponse = client.getTargetPool(targetPool); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getTargetPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + + client.getTargetPool(targetPool); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getHealthTargetPoolTest() { + String kind = "kind3292052"; + TargetPoolInstanceHealth expectedResponse = + TargetPoolInstanceHealth.newBuilder().setKind(kind).build(); + mockService.addResponse(expectedResponse); + + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build(); + + TargetPoolInstanceHealth actualResponse = + client.getHealthTargetPool(targetPool, instanceReferenceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getHealthTargetPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build(); + + client.getHealthTargetPool(targetPool, instanceReferenceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertTargetPoolTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + TargetPool targetPoolResource = TargetPool.newBuilder().build(); + + Operation actualResponse = client.insertTargetPool(region, targetPoolResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertTargetPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + TargetPool targetPoolResource = TargetPool.newBuilder().build(); + + client.insertTargetPool(region, targetPoolResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listTargetPoolsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetPool itemsElement = TargetPool.newBuilder().build(); + List items = Arrays.asList(itemsElement); + TargetPoolList expectedResponse = + TargetPoolList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListTargetPoolsPagedResponse pagedListResponse = client.listTargetPools(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listTargetPoolsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listTargetPools(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void removeHealthCheckTargetPoolTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = + TargetPoolsRemoveHealthCheckRequest.newBuilder().build(); + + Operation actualResponse = + client.removeHealthCheckTargetPool(targetPool, targetPoolsRemoveHealthCheckRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void removeHealthCheckTargetPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = + TargetPoolsRemoveHealthCheckRequest.newBuilder().build(); + + client.removeHealthCheckTargetPool(targetPool, targetPoolsRemoveHealthCheckRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void removeInstanceTargetPoolTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = + TargetPoolsRemoveInstanceRequest.newBuilder().build(); + + Operation actualResponse = + client.removeInstanceTargetPool(targetPool, targetPoolsRemoveInstanceRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void removeInstanceTargetPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = + TargetPoolsRemoveInstanceRequest.newBuilder().build(); + + client.removeInstanceTargetPool(targetPool, targetPoolsRemoveInstanceRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setBackupTargetPoolTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + Float failoverRatio = -8.6107481E7F; + TargetReference targetReferenceResource = TargetReference.newBuilder().build(); + + Operation actualResponse = + client.setBackupTargetPool(targetPool, failoverRatio, targetReferenceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setBackupTargetPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionTargetPoolName targetPool = + ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]"); + Float failoverRatio = -8.6107481E7F; + TargetReference targetReferenceResource = TargetReference.newBuilder().build(); + + client.setBackupTargetPool(targetPool, failoverRatio, targetReferenceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetSslProxyClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetSslProxyClientTest.java new file mode 100644 index 000000000000..ecf6d8291c59 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetSslProxyClientTest.java @@ -0,0 +1,783 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetSslProxyClient.ListTargetSslProxiesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetSslProxyStub.deleteTargetSslProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetSslProxyStub.getTargetSslProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetSslProxyStub.insertTargetSslProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetSslProxyStub.listTargetSslProxiesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetSslProxyStub.setBackendServiceTargetSslProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetSslProxyStub.setProxyHeaderTargetSslProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetSslProxyStub.setSslCertificatesTargetSslProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetSslProxyStub.setSslPolicyTargetSslProxyMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.TargetSslProxyStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class TargetSslProxyClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteTargetSslProxyMethodDescriptor, + getTargetSslProxyMethodDescriptor, + insertTargetSslProxyMethodDescriptor, + listTargetSslProxiesMethodDescriptor, + setBackendServiceTargetSslProxyMethodDescriptor, + setProxyHeaderTargetSslProxyMethodDescriptor, + setSslCertificatesTargetSslProxyMethodDescriptor, + setSslPolicyTargetSslProxyMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, TargetSslProxyStubSettings.getDefaultEndpoint()); + + private static TargetSslProxyClient client; + private static TargetSslProxySettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + TargetSslProxySettings.newBuilder() + .setTransportChannelProvider( + TargetSslProxySettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TargetSslProxyClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteTargetSslProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + + Operation actualResponse = client.deleteTargetSslProxy(targetSslProxy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteTargetSslProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + + client.deleteTargetSslProxy(targetSslProxy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getTargetSslProxyTest() { + String kind = "kind3292052"; + String service = "service1984153269"; + ProjectGlobalSslPolicyName sslPolicy = + ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]"); + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String proxyHeader = "proxyHeader-1987109506"; + String selfLink = "selfLink-1691268851"; + TargetSslProxy expectedResponse = + TargetSslProxy.newBuilder() + .setKind(kind) + .setService(service) + .setSslPolicy(sslPolicy.toString()) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setProxyHeader(proxyHeader) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + + TargetSslProxy actualResponse = client.getTargetSslProxy(targetSslProxy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getTargetSslProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + + client.getTargetSslProxy(targetSslProxy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertTargetSslProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + TargetSslProxy targetSslProxyResource = TargetSslProxy.newBuilder().build(); + + Operation actualResponse = client.insertTargetSslProxy(project, targetSslProxyResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertTargetSslProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + TargetSslProxy targetSslProxyResource = TargetSslProxy.newBuilder().build(); + + client.insertTargetSslProxy(project, targetSslProxyResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listTargetSslProxiesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetSslProxy itemsElement = TargetSslProxy.newBuilder().build(); + List items = Arrays.asList(itemsElement); + TargetSslProxyList expectedResponse = + TargetSslProxyList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListTargetSslProxiesPagedResponse pagedListResponse = client.listTargetSslProxies(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listTargetSslProxiesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listTargetSslProxies(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setBackendServiceTargetSslProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + TargetSslProxiesSetBackendServiceRequest targetSslProxiesSetBackendServiceRequestResource = + TargetSslProxiesSetBackendServiceRequest.newBuilder().build(); + + Operation actualResponse = + client.setBackendServiceTargetSslProxy( + targetSslProxy, targetSslProxiesSetBackendServiceRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setBackendServiceTargetSslProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + TargetSslProxiesSetBackendServiceRequest targetSslProxiesSetBackendServiceRequestResource = + TargetSslProxiesSetBackendServiceRequest.newBuilder().build(); + + client.setBackendServiceTargetSslProxy( + targetSslProxy, targetSslProxiesSetBackendServiceRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setProxyHeaderTargetSslProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource = + TargetSslProxiesSetProxyHeaderRequest.newBuilder().build(); + + Operation actualResponse = + client.setProxyHeaderTargetSslProxy( + targetSslProxy, targetSslProxiesSetProxyHeaderRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setProxyHeaderTargetSslProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + TargetSslProxiesSetProxyHeaderRequest targetSslProxiesSetProxyHeaderRequestResource = + TargetSslProxiesSetProxyHeaderRequest.newBuilder().build(); + + client.setProxyHeaderTargetSslProxy( + targetSslProxy, targetSslProxiesSetProxyHeaderRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setSslCertificatesTargetSslProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + TargetSslProxiesSetSslCertificatesRequest targetSslProxiesSetSslCertificatesRequestResource = + TargetSslProxiesSetSslCertificatesRequest.newBuilder().build(); + + Operation actualResponse = + client.setSslCertificatesTargetSslProxy( + targetSslProxy, targetSslProxiesSetSslCertificatesRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setSslCertificatesTargetSslProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + TargetSslProxiesSetSslCertificatesRequest targetSslProxiesSetSslCertificatesRequestResource = + TargetSslProxiesSetSslCertificatesRequest.newBuilder().build(); + + client.setSslCertificatesTargetSslProxy( + targetSslProxy, targetSslProxiesSetSslCertificatesRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setSslPolicyTargetSslProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build(); + + Operation actualResponse = + client.setSslPolicyTargetSslProxy(targetSslProxy, sslPolicyReferenceResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setSslPolicyTargetSslProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetSslProxyName targetSslProxy = + ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]"); + SslPolicyReference sslPolicyReferenceResource = SslPolicyReference.newBuilder().build(); + + client.setSslPolicyTargetSslProxy(targetSslProxy, sslPolicyReferenceResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetTcpProxyClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetTcpProxyClientTest.java new file mode 100644 index 000000000000..bb83dfbfe5af --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetTcpProxyClientTest.java @@ -0,0 +1,586 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetTcpProxyClient.ListTargetTcpProxiesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetTcpProxyStub.deleteTargetTcpProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetTcpProxyStub.getTargetTcpProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetTcpProxyStub.insertTargetTcpProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetTcpProxyStub.listTargetTcpProxiesMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetTcpProxyStub.setBackendServiceTargetTcpProxyMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetTcpProxyStub.setProxyHeaderTargetTcpProxyMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.TargetTcpProxyStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class TargetTcpProxyClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteTargetTcpProxyMethodDescriptor, + getTargetTcpProxyMethodDescriptor, + insertTargetTcpProxyMethodDescriptor, + listTargetTcpProxiesMethodDescriptor, + setBackendServiceTargetTcpProxyMethodDescriptor, + setProxyHeaderTargetTcpProxyMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, TargetTcpProxyStubSettings.getDefaultEndpoint()); + + private static TargetTcpProxyClient client; + private static TargetTcpProxySettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + TargetTcpProxySettings.newBuilder() + .setTransportChannelProvider( + TargetTcpProxySettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TargetTcpProxyClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteTargetTcpProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetTcpProxyName targetTcpProxy = + ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]"); + + Operation actualResponse = client.deleteTargetTcpProxy(targetTcpProxy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteTargetTcpProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetTcpProxyName targetTcpProxy = + ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]"); + + client.deleteTargetTcpProxy(targetTcpProxy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getTargetTcpProxyTest() { + String kind = "kind3292052"; + String service = "service1984153269"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String proxyHeader = "proxyHeader-1987109506"; + String selfLink = "selfLink-1691268851"; + TargetTcpProxy expectedResponse = + TargetTcpProxy.newBuilder() + .setKind(kind) + .setService(service) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setProxyHeader(proxyHeader) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetTcpProxyName targetTcpProxy = + ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]"); + + TargetTcpProxy actualResponse = client.getTargetTcpProxy(targetTcpProxy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getTargetTcpProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetTcpProxyName targetTcpProxy = + ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]"); + + client.getTargetTcpProxy(targetTcpProxy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertTargetTcpProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + TargetTcpProxy targetTcpProxyResource = TargetTcpProxy.newBuilder().build(); + + Operation actualResponse = client.insertTargetTcpProxy(project, targetTcpProxyResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertTargetTcpProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + TargetTcpProxy targetTcpProxyResource = TargetTcpProxy.newBuilder().build(); + + client.insertTargetTcpProxy(project, targetTcpProxyResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listTargetTcpProxiesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetTcpProxy itemsElement = TargetTcpProxy.newBuilder().build(); + List items = Arrays.asList(itemsElement); + TargetTcpProxyList expectedResponse = + TargetTcpProxyList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListTargetTcpProxiesPagedResponse pagedListResponse = client.listTargetTcpProxies(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listTargetTcpProxiesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listTargetTcpProxies(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setBackendServiceTargetTcpProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetTcpProxyName targetTcpProxy = + ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]"); + TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource = + TargetTcpProxiesSetBackendServiceRequest.newBuilder().build(); + + Operation actualResponse = + client.setBackendServiceTargetTcpProxy( + targetTcpProxy, targetTcpProxiesSetBackendServiceRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setBackendServiceTargetTcpProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetTcpProxyName targetTcpProxy = + ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]"); + TargetTcpProxiesSetBackendServiceRequest targetTcpProxiesSetBackendServiceRequestResource = + TargetTcpProxiesSetBackendServiceRequest.newBuilder().build(); + + client.setBackendServiceTargetTcpProxy( + targetTcpProxy, targetTcpProxiesSetBackendServiceRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setProxyHeaderTargetTcpProxyTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalTargetTcpProxyName targetTcpProxy = + ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]"); + TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource = + TargetTcpProxiesSetProxyHeaderRequest.newBuilder().build(); + + Operation actualResponse = + client.setProxyHeaderTargetTcpProxy( + targetTcpProxy, targetTcpProxiesSetProxyHeaderRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void setProxyHeaderTargetTcpProxyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalTargetTcpProxyName targetTcpProxy = + ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]"); + TargetTcpProxiesSetProxyHeaderRequest targetTcpProxiesSetProxyHeaderRequestResource = + TargetTcpProxiesSetProxyHeaderRequest.newBuilder().build(); + + client.setProxyHeaderTargetTcpProxy( + targetTcpProxy, targetTcpProxiesSetProxyHeaderRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetVpnGatewayClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetVpnGatewayClientTest.java new file mode 100644 index 000000000000..82090ab7b5c2 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetVpnGatewayClientTest.java @@ -0,0 +1,459 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse; +import static com.google.cloud.compute.v1.TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetVpnGatewayStub.aggregatedListTargetVpnGatewaysMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetVpnGatewayStub.deleteTargetVpnGatewayMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetVpnGatewayStub.getTargetVpnGatewayMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetVpnGatewayStub.insertTargetVpnGatewayMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonTargetVpnGatewayStub.listTargetVpnGatewaysMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.TargetVpnGatewayStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class TargetVpnGatewayClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListTargetVpnGatewaysMethodDescriptor, + deleteTargetVpnGatewayMethodDescriptor, + getTargetVpnGatewayMethodDescriptor, + insertTargetVpnGatewayMethodDescriptor, + listTargetVpnGatewaysMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, TargetVpnGatewayStubSettings.getDefaultEndpoint()); + + private static TargetVpnGatewayClient client; + private static TargetVpnGatewaySettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + TargetVpnGatewaySettings.newBuilder() + .setTransportChannelProvider( + TargetVpnGatewaySettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TargetVpnGatewayClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListTargetVpnGatewaysTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetVpnGatewaysScopedList itemsItem = TargetVpnGatewaysScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + TargetVpnGatewayAggregatedList expectedResponse = + TargetVpnGatewayAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListTargetVpnGatewaysPagedResponse pagedListResponse = + client.aggregatedListTargetVpnGateways(project); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListTargetVpnGatewaysExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListTargetVpnGateways(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteTargetVpnGatewayTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionTargetVpnGatewayName targetVpnGateway = + ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]"); + + Operation actualResponse = client.deleteTargetVpnGateway(targetVpnGateway); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteTargetVpnGatewayExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionTargetVpnGatewayName targetVpnGateway = + ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]"); + + client.deleteTargetVpnGateway(targetVpnGateway); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getTargetVpnGatewayTest() { + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]"); + String selfLink = "selfLink-1691268851"; + String status = "status-892481550"; + TargetVpnGateway expectedResponse = + TargetVpnGateway.newBuilder() + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setRegion(region.toString()) + .setNetwork(network.toString()) + .setSelfLink(selfLink) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionTargetVpnGatewayName targetVpnGateway = + ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]"); + + TargetVpnGateway actualResponse = client.getTargetVpnGateway(targetVpnGateway); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getTargetVpnGatewayExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionTargetVpnGatewayName targetVpnGateway = + ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]"); + + client.getTargetVpnGateway(targetVpnGateway); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertTargetVpnGatewayTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + TargetVpnGateway targetVpnGatewayResource = TargetVpnGateway.newBuilder().build(); + + Operation actualResponse = client.insertTargetVpnGateway(region, targetVpnGatewayResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertTargetVpnGatewayExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + TargetVpnGateway targetVpnGatewayResource = TargetVpnGateway.newBuilder().build(); + + client.insertTargetVpnGateway(region, targetVpnGatewayResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listTargetVpnGatewaysTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + TargetVpnGateway itemsElement = TargetVpnGateway.newBuilder().build(); + List items = Arrays.asList(itemsElement); + TargetVpnGatewayList expectedResponse = + TargetVpnGatewayList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListTargetVpnGatewaysPagedResponse pagedListResponse = client.listTargetVpnGateways(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listTargetVpnGatewaysExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listTargetVpnGateways(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/UrlMapClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/UrlMapClientTest.java new file mode 100644 index 000000000000..b5cf326bc414 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/UrlMapClientTest.java @@ -0,0 +1,713 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.UrlMapClient.ListUrlMapsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonUrlMapStub.deleteUrlMapMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonUrlMapStub.getUrlMapMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonUrlMapStub.insertUrlMapMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonUrlMapStub.invalidateCacheUrlMapMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonUrlMapStub.listUrlMapsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonUrlMapStub.patchUrlMapMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonUrlMapStub.updateUrlMapMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonUrlMapStub.validateUrlMapMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.UrlMapStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class UrlMapClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteUrlMapMethodDescriptor, + getUrlMapMethodDescriptor, + insertUrlMapMethodDescriptor, + invalidateCacheUrlMapMethodDescriptor, + listUrlMapsMethodDescriptor, + patchUrlMapMethodDescriptor, + updateUrlMapMethodDescriptor, + validateUrlMapMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, UrlMapStubSettings.getDefaultEndpoint()); + + private static UrlMapClient client; + private static UrlMapSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + UrlMapSettings.newBuilder() + .setTransportChannelProvider( + UrlMapSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = UrlMapClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteUrlMapTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + + Operation actualResponse = client.deleteUrlMap(urlMap); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteUrlMapExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + + client.deleteUrlMap(urlMap); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getUrlMapTest() { + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String fingerprint = "fingerprint-1375934236"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + String defaultService = "defaultService1980854967"; + String selfLink = "selfLink-1691268851"; + UrlMap expectedResponse = + UrlMap.newBuilder() + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setFingerprint(fingerprint) + .setName(name) + .setDescription(description) + .setId(id) + .setDefaultService(defaultService) + .setSelfLink(selfLink) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + + UrlMap actualResponse = client.getUrlMap(urlMap); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getUrlMapExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + + client.getUrlMap(urlMap); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertUrlMapTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + UrlMap urlMapResource = UrlMap.newBuilder().build(); + + Operation actualResponse = client.insertUrlMap(project, urlMapResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertUrlMapExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + UrlMap urlMapResource = UrlMap.newBuilder().build(); + + client.insertUrlMap(project, urlMapResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void invalidateCacheUrlMapTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + CacheInvalidationRule cacheInvalidationRuleResource = + CacheInvalidationRule.newBuilder().build(); + + Operation actualResponse = client.invalidateCacheUrlMap(urlMap, cacheInvalidationRuleResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void invalidateCacheUrlMapExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + CacheInvalidationRule cacheInvalidationRuleResource = + CacheInvalidationRule.newBuilder().build(); + + client.invalidateCacheUrlMap(urlMap, cacheInvalidationRuleResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listUrlMapsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + UrlMap itemsElement = UrlMap.newBuilder().build(); + List items = Arrays.asList(itemsElement); + UrlMapList expectedResponse = + UrlMapList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListUrlMapsPagedResponse pagedListResponse = client.listUrlMaps(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listUrlMapsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listUrlMaps(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void patchUrlMapTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + UrlMap urlMapResource = UrlMap.newBuilder().build(); + + Operation actualResponse = client.patchUrlMap(urlMap, urlMapResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void patchUrlMapExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + UrlMap urlMapResource = UrlMap.newBuilder().build(); + + client.patchUrlMap(urlMap, urlMapResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateUrlMapTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + UrlMap urlMapResource = UrlMap.newBuilder().build(); + + Operation actualResponse = client.updateUrlMap(urlMap, urlMapResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void updateUrlMapExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + UrlMap urlMapResource = UrlMap.newBuilder().build(); + + client.updateUrlMap(urlMap, urlMapResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void validateUrlMapTest() { + UrlMapsValidateResponse expectedResponse = UrlMapsValidateResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + UrlMapsValidateRequest urlMapsValidateRequestResource = + UrlMapsValidateRequest.newBuilder().build(); + + UrlMapsValidateResponse actualResponse = + client.validateUrlMap(urlMap, urlMapsValidateRequestResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void validateUrlMapExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]"); + UrlMapsValidateRequest urlMapsValidateRequestResource = + UrlMapsValidateRequest.newBuilder().build(); + + client.validateUrlMap(urlMap, urlMapsValidateRequestResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/VpnTunnelClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/VpnTunnelClientTest.java new file mode 100644 index 000000000000..d6585dbe7be2 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/VpnTunnelClientTest.java @@ -0,0 +1,472 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.VpnTunnelClient.AggregatedListVpnTunnelsPagedResponse; +import static com.google.cloud.compute.v1.VpnTunnelClient.ListVpnTunnelsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonVpnTunnelStub.aggregatedListVpnTunnelsMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonVpnTunnelStub.deleteVpnTunnelMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonVpnTunnelStub.getVpnTunnelMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonVpnTunnelStub.insertVpnTunnelMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonVpnTunnelStub.listVpnTunnelsMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.VpnTunnelStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class VpnTunnelClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + aggregatedListVpnTunnelsMethodDescriptor, + deleteVpnTunnelMethodDescriptor, + getVpnTunnelMethodDescriptor, + insertVpnTunnelMethodDescriptor, + listVpnTunnelsMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, VpnTunnelStubSettings.getDefaultEndpoint()); + + private static VpnTunnelClient client; + private static VpnTunnelSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + VpnTunnelSettings.newBuilder() + .setTransportChannelProvider( + VpnTunnelSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = VpnTunnelClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListVpnTunnelsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + VpnTunnelsScopedList itemsItem = VpnTunnelsScopedList.newBuilder().build(); + Map items = new HashMap<>(); + items.put("items", itemsItem); + VpnTunnelAggregatedList expectedResponse = + VpnTunnelAggregatedList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .putAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + AggregatedListVpnTunnelsPagedResponse pagedListResponse = + client.aggregatedListVpnTunnels(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getItemsMap().values().iterator().next(), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void aggregatedListVpnTunnelsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.aggregatedListVpnTunnels(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteVpnTunnelTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionVpnTunnelName vpnTunnel = + ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]"); + + Operation actualResponse = client.deleteVpnTunnel(vpnTunnel); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteVpnTunnelExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionVpnTunnelName vpnTunnel = + ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]"); + + client.deleteVpnTunnel(vpnTunnel); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getVpnTunnelTest() { + String sharedSecretHash = "sharedSecretHash935752803"; + String kind = "kind3292052"; + String description = "description-1724546052"; + Integer ikeVersion = 1292118044; + String selfLink = "selfLink-1691268851"; + ProjectRegionRouterName router = + ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + String detailedStatus = "detailedStatus-740240799"; + String peerIp = "peerIp-690492124"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String sharedSecret = "sharedSecret-154938422"; + ProjectRegionTargetVpnGatewayName targetVpnGateway = + ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]"); + String status = "status-892481550"; + VpnTunnel expectedResponse = + VpnTunnel.newBuilder() + .setSharedSecretHash(sharedSecretHash) + .setKind(kind) + .setDescription(description) + .setIkeVersion(ikeVersion) + .setSelfLink(selfLink) + .setRouter(router.toString()) + .setDetailedStatus(detailedStatus) + .setPeerIp(peerIp) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setId(id) + .setRegion(region.toString()) + .setSharedSecret(sharedSecret) + .setTargetVpnGateway(targetVpnGateway.toString()) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionVpnTunnelName vpnTunnel = + ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]"); + + VpnTunnel actualResponse = client.getVpnTunnel(vpnTunnel); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getVpnTunnelExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionVpnTunnelName vpnTunnel = + ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]"); + + client.getVpnTunnel(vpnTunnel); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void insertVpnTunnelTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region2 = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region2.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + VpnTunnel vpnTunnelResource = VpnTunnel.newBuilder().build(); + + Operation actualResponse = client.insertVpnTunnel(region, vpnTunnelResource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void insertVpnTunnelExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + VpnTunnel vpnTunnelResource = VpnTunnel.newBuilder().build(); + + client.insertVpnTunnel(region, vpnTunnelResource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listVpnTunnelsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + VpnTunnel itemsElement = VpnTunnel.newBuilder().build(); + List items = Arrays.asList(itemsElement); + VpnTunnelList expectedResponse = + VpnTunnelList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + ListVpnTunnelsPagedResponse pagedListResponse = client.listVpnTunnels(region); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listVpnTunnelsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + + client.listVpnTunnels(region); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ZoneClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ZoneClientTest.java new file mode 100644 index 000000000000..a2bcabedf199 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ZoneClientTest.java @@ -0,0 +1,201 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.ZoneClient.ListZonesPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonZoneStub.getZoneMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonZoneStub.listZonesMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.ZoneStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class ZoneClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + getZoneMethodDescriptor, listZonesMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, ZoneStubSettings.getDefaultEndpoint()); + + private static ZoneClient client; + private static ZoneSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + ZoneSettings.newBuilder() + .setTransportChannelProvider( + ZoneSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ZoneClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void getZoneTest() { + String kind = "kind3292052"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + String description = "description-1724546052"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String selfLink = "selfLink-1691268851"; + String status = "status-892481550"; + Zone expectedResponse = + Zone.newBuilder() + .setKind(kind) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setDescription(description) + .setId(id) + .setRegion(region.toString()) + .setSelfLink(selfLink) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + Zone actualResponse = client.getZone(zone); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getZoneExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + client.getZone(zone); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listZonesTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Zone itemsElement = Zone.newBuilder().build(); + List items = Arrays.asList(itemsElement); + ZoneList expectedResponse = + ZoneList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListZonesPagedResponse pagedListResponse = client.listZones(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listZonesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + + client.listZones(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ZoneOperationClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ZoneOperationClientTest.java new file mode 100644 index 000000000000..6b534af7519b --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/ZoneOperationClientTest.java @@ -0,0 +1,276 @@ +/* + * Copyright 2018 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 + * + * https://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.compute.v1; + +import static com.google.cloud.compute.v1.ZoneOperationClient.ListZoneOperationsPagedResponse; +import static com.google.cloud.compute.v1.stub.HttpJsonZoneOperationStub.deleteZoneOperationMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonZoneOperationStub.getZoneOperationMethodDescriptor; +import static com.google.cloud.compute.v1.stub.HttpJsonZoneOperationStub.listZoneOperationsMethodDescriptor; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode.Code; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.compute.v1.stub.ZoneOperationStubSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class ZoneOperationClientTest { + + private static final List METHOD_DESCRIPTORS = + ImmutableList.copyOf( + Lists.newArrayList( + deleteZoneOperationMethodDescriptor, + getZoneOperationMethodDescriptor, + listZoneOperationsMethodDescriptor)); + private static final MockHttpService mockService = + new MockHttpService(METHOD_DESCRIPTORS, ZoneOperationStubSettings.getDefaultEndpoint()); + + private static ZoneOperationClient client; + private static ZoneOperationSettings clientSettings; + + @BeforeClass + public static void setUp() throws IOException { + clientSettings = + ZoneOperationSettings.newBuilder() + .setTransportChannelProvider( + ZoneOperationSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ZoneOperationClient.create(clientSettings); + } + + @After + public void cleanUp() { + mockService.reset(); + } + + @AfterClass + public static void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void deleteZoneOperationTest() { + mockService.addNullResponse(); + + ProjectZoneOperationName operation = + ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]"); + + client.deleteZoneOperation(operation); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void deleteZoneOperationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneOperationName operation = + ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]"); + + client.deleteZoneOperation(operation); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getZoneOperationTest() { + String httpErrorMessage = "httpErrorMessage1276263769"; + String targetId = "targetId-815576439"; + String kind = "kind3292052"; + String description = "description-1724546052"; + String statusMessage = "statusMessage-239442758"; + String selfLink = "selfLink-1691268851"; + String insertTime = "insertTime-103148397"; + Integer httpErrorStatusCode = 1386087020; + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + String targetLink = "targetLink-2084812312"; + String creationTimestamp = "creationTimestamp567396278"; + String name = "name3373707"; + Integer progress = 1001078227; + String operationType = "operationType-1432962286"; + String startTime = "startTime-1573145462"; + String endTime = "endTime1725551537"; + String id = "id3355"; + ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); + String clientOperationId = "clientOperationId-239630617"; + String user = "user3599307"; + String status = "status-892481550"; + Operation expectedResponse = + Operation.newBuilder() + .setHttpErrorMessage(httpErrorMessage) + .setTargetId(targetId) + .setKind(kind) + .setDescription(description) + .setStatusMessage(statusMessage) + .setSelfLink(selfLink) + .setInsertTime(insertTime) + .setHttpErrorStatusCode(httpErrorStatusCode) + .setZone(zone.toString()) + .setTargetLink(targetLink) + .setCreationTimestamp(creationTimestamp) + .setName(name) + .setProgress(progress) + .setOperationType(operationType) + .setStartTime(startTime) + .setEndTime(endTime) + .setId(id) + .setRegion(region.toString()) + .setClientOperationId(clientOperationId) + .setUser(user) + .setStatus(status) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneOperationName operation = + ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]"); + + Operation actualResponse = client.getZoneOperation(operation); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void getZoneOperationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneOperationName operation = + ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]"); + + client.getZoneOperation(operation); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listZoneOperationsTest() { + String kind = "kind3292052"; + String nextPageToken = ""; + String id = "id3355"; + String selfLink = "selfLink-1691268851"; + Operation itemsElement = Operation.newBuilder().build(); + List items = Arrays.asList(itemsElement); + OperationList expectedResponse = + OperationList.newBuilder() + .setKind(kind) + .setNextPageToken(nextPageToken) + .setId(id) + .setSelfLink(selfLink) + .addAllItems(items) + .build(); + mockService.addResponse(expectedResponse); + + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + ListZoneOperationsPagedResponse pagedListResponse = client.listZoneOperations(zone); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + @SuppressWarnings("all") + public void listZoneOperationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); + + client.listZoneOperations(zone); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +}